Skip to main content

ModuleTransport

Trait ModuleTransport 

Source
pub trait ModuleTransport: Send + Sync {
    // Required methods
    fn get_module_info<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        provider_peer_id: &'life1 str,
        store_id: &'life2 str,
        root: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<ModuleInfo, DownloadError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn fetch_module_range<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        provider_peer_id: &'life1 str,
        store_id: &'life2 str,
        root: &'life3 str,
        offset: u64,
        length: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, DownloadError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

The two peer calls the module pull needs, abstracted for testability (in-memory MockModuleTransport in tests; the real dig-nat/dig-peer adapter is wired by dig-node’s serve/client legs, #1576 sub-family 4).

Required Methods§

Source

fn get_module_info<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, provider_peer_id: &'life1 str, store_id: &'life2 str, root: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<ModuleInfo, DownloadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

dig.getModuleInfo — the transfer descriptor for the (store_id, root) module from provider_peer_id. store_id / root are the 64-hex generation ids.

§Errors

A recoverable DownloadError::Transport on connect/stream failure — the caller tries another holder.

Source

fn fetch_module_range<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, provider_peer_id: &'life1 str, store_id: &'life2 str, root: &'life3 str, offset: u64, length: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, DownloadError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

dig.fetchModuleRange — the [offset, offset+length) window of the module blob from provider_peer_id.

§Errors

A recoverable DownloadError::Transport/DownloadError::Timeout — the caller re-fetches the chunk from another holder.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§