Skip to main content

ChunkProvider

Trait ChunkProvider 

Source
pub trait ChunkProvider: Send + Sync {
    // Required methods
    fn manifest(&self) -> &Arc<RrdManifest> ;
    fn raw_manifest(&self) -> &Arc<RawRrdManifest> ;
    fn source(&self) -> String;
    fn load_chunks<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ids: &'life1 [ChunkId],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<Chunk>>, ChunkProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Backend that exposes an indexed chunk source.

A provider serves both the index (which chunks exist and their metadata) and the bytes (the chunks themselves).

§Contract

  • All ids in Self::load_chunks must be known to the provider (i.e. root chunks present in Self::manifest). Unknown ids produce an error and abort the batch.
  • The returned Vec<Arc<Chunk>> may be in any order; callers must not rely on input ordering.
  • Self::manifest and Self::raw_manifest are stable for the lifetime of the provider — they never change once constructed.

Required Methods§

Source

fn manifest(&self) -> &Arc<RrdManifest>

The validated, indexed manifest of chunks this provider serves.

A provider serving the chunks of more than one segment, e.g. a dataset segment and the assets it references, describes all of them in this one manifest.

Source

fn raw_manifest(&self) -> &Arc<RawRrdManifest>

The raw, as-parsed manifest. Kept around so consumers (e.g. the server’s GetRrdManifest handler) can re-serialize without re-validating.

Source

fn source(&self) -> String

Human-readable identifier for this provider’s backing source, used in diagnostic messages (e.g. an RRD path or a segment id). Not parsed; format is purely for display.

Source

fn load_chunks<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [ChunkId], ) -> Pin<Box<dyn Future<Output = Result<Vec<Arc<Chunk>>, ChunkProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Load chunks by id.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§