Skip to main content

BundlePuller

Struct BundlePuller 

Source
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

Source

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.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub async fn finish(self)

Wait for every queued peer-record and watermark write to land. Call it before the process exits, after a cancelled pull too, so the next run resumes each lane from what it paid.

Trait Implementations§

Source§

impl Debug for BundlePuller

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more