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
idsinSelf::load_chunksmust be known to the provider (i.e. root chunks present inSelf::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::manifestandSelf::raw_manifestare stable for the lifetime of the provider — they never change once constructed.
Required Methods§
Sourcefn manifest(&self) -> &Arc<RrdManifest> ⓘ
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.
Sourcefn raw_manifest(&self) -> &Arc<RawRrdManifest> ⓘ
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".