Skip to main content

FileDistribution

Trait FileDistribution 

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

Source

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 distribute
  • scope - Target scope (all nodes, formation, specific nodes, capable)
  • priority - Transfer priority level
§Returns

Handle for tracking distribution progress

Source

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.

Source

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.

Source

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,

Wait for distribution to complete (or fail)

Blocks until all targets complete or the timeout expires.

§Arguments
  • handle - Distribution handle
  • timeout - Maximum time to wait
§Returns

Final distribution status, or error if timeout or other failure

Source

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.

Implementors§