pub trait FileDistribution: Send + Sync {
// Required methods
fn distribute<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_token: &'life1 BlobToken,
scope: DistributionScope,
priority: TransferPriority,
) -> Pin<Box<dyn Future<Output = Result<DistributionHandle>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn wait_for_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn subscribe_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<Receiver<DistributionStatus>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
File distribution service for targeted delivery
Provides higher-level API for distributing blobs to specific targets with progress tracking and status monitoring.
Required Methods§
Sourcefn distribute<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_token: &'life1 BlobToken,
scope: DistributionScope,
priority: TransferPriority,
) -> Pin<Box<dyn Future<Output = Result<DistributionHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn distribute<'life0, 'life1, 'async_trait>(
&'life0 self,
blob_token: &'life1 BlobToken,
scope: DistributionScope,
priority: TransferPriority,
) -> Pin<Box<dyn Future<Output = Result<DistributionHandle>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Distribute blob to target nodes
Initiates distribution of a blob to nodes matching the scope. Returns a handle for tracking progress.
§Distribution Behavior by Backend
Ditto: Creates document with blob reference in a distribution collection. Target nodes subscribe to this collection and fetch the blob via attachment protocol when they see the reference.
Iroh: Connects directly to target nodes and pushes blob.
§Arguments
blob_token- Token identifying the blob to distributescope- Target scope (all nodes, formation, specific nodes, capable)priority- Transfer priority level
§Returns
Handle for tracking distribution progress
Sourcefn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn status<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get current distribution status
Returns the current status of all transfers in a distribution.
Sourcefn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancel an in-progress distribution
Stops any pending or in-progress transfers. Completed transfers are not rolled back.
Sourcefn wait_for_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn wait_for_completion<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = Result<DistributionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn subscribe_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<Receiver<DistributionStatus>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 DistributionHandle,
) -> Pin<Box<dyn Future<Output = Result<Receiver<DistributionStatus>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to distribution progress updates
Returns a broadcast receiver that emits status updates as transfers progress.