pub struct BundlePuller { /* private fields */ }Expand description
Pulls bundles into a directory over one paid run: one pool, one connection per node, one progress clock.
Build it with Self::builder. One puller serves one run: a manifest
fetch and one Self::pull, or several pulls that share the run’s lanes.
Implementations§
Source§impl BundlePuller
impl BundlePuller
Sourcepub fn builder(
chain: ChainConfig,
site: PullSite,
endpoint: Endpoint,
store: Arc<dyn BuyerPoolStore>,
funding: Funding,
discovery: DiscoveryOptions,
nodes: NodeSelection,
) -> BundlePullerBuilder
pub fn builder( chain: ChainConfig, site: PullSite, endpoint: Endpoint, store: Arc<dyn BuyerPoolStore>, funding: Funding, discovery: DiscoveryOptions, nodes: NodeSelection, ) -> BundlePullerBuilder
A builder for a pull on chain, keeping its peer store and scratch
files in site, dialing from endpoint, recording its pool and lanes
in store, and paying from funding. discovery and nodes
(select_nodes) say where entries find their holders.
Sourcepub async fn fetch_manifest(
&self,
hash: [u8; 32],
out_dir: &Path,
use_cache: bool,
) -> Result<BundleManifest>
pub async fn fetch_manifest( &self, hash: [u8; 32], out_dir: &Path, use_cache: bool, ) -> Result<BundleManifest>
Fetch the manifest blob hash, and cache it in out_dir. With
use_cache, a manifest an earlier pull cached there is read instead,
and nothing is paid; a cache file that cannot be read is reported to
the observer and fetched over.
§Errors
The fetch fails, or the bytes are not a manifest.
Sourcepub async fn pull(
&mut self,
manifest: &BundleManifest,
out_dir: &Path,
overwrite: bool,
cancel: &CancellationToken,
) -> BundleOutcome
pub async fn pull( &mut self, manifest: &BundleManifest, out_dir: &Path, overwrite: bool, cancel: &CancellationToken, ) -> BundleOutcome
Pull every entry of manifest into out_dir. With overwrite, files
already on disk are fetched again instead of skipped. A fired cancel
stops every fetch where it is; what landed is recorded, and the next
pull resumes.
An entry that fails does not stop the others. A fault only the user
can fix, or the stop policy, ends the pull (BundleEnd).
Sourcepub fn replacements(&self) -> Vec<PoolReplaced>
pub fn replacements(&self) -> Vec<PoolReplaced>
Every pool replacement this puller’s funding recovery steps made, in
order: its manifest fetches’ and its pulls’ alike, and a step in a
pull its caller dropped or cancelled. Each closed pool may still hold
a balance to reclaim once its dispute window ends. A replacement that
ended a manifest fetch is in no BundleOutcome.
Sourcepub fn funding_shortfall(&self) -> Option<String>
pub fn funding_shortfall(&self) -> Option<String>
The warning for a wallet seen to hold too little USDC to top the pool up during this run, if one was.
Sourcepub const fn unconfirmed_escrows(&self) -> &UnconfirmedEscrows
pub const fn unconfirmed_escrows(&self) -> &UnconfirmedEscrows
The handle that holds each openPool and topUp of the puller that no
local record credits yet, and each that escrowed with no local record
crediting it: the one passed to
BundlePullerBuilder::unconfirmed_escrows, or the puller’s own.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BundlePuller
impl !RefUnwindSafe for BundlePuller
impl !UnwindSafe for BundlePuller
impl Send for BundlePuller
impl Sync for BundlePuller
impl Unpin for BundlePuller
impl UnsafeUnpin for BundlePuller
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more