pub trait DataResolver: Sync {
// Required method
fn get_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn get_path_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_path_decoded<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_path_decoded_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Generic mechanism for obtaining content at a given path.
This trait is used to define a generic mechanism for resolving content given a lookup key/path.
Implementations only need to implement get_path(). The other members have
default implementations that should do the correct thing by default.
Required Methods§
Sourcefn get_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_path<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the content of a relative path as an async reader.
This obtains a reader for path data and returns the raw data without any decoding applied.
Provided Methods§
Sourcefn get_path_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_path_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Obtain a reader that performs content integrity checking.
Because content digests can only be computed once all content is read, the reader emits data as it is streaming but only compares the cryptographic digest once all data has been read. If there is a content digest mismatch, an error will be raised once the final byte is read.
Validation only occurs if the stream is read to completion. Failure to read the entire stream could result in reading of unexpected content.
Sourcefn get_path_decoded<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_path_decoded<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the content of a relative path with decompression transparently applied.
Sourcefn get_path_decoded_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_path_decoded_with_digest_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
compression: Compression,
expected_size: u64,
expected_digest: ContentDigest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn AsyncRead + Send>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Like Self::get_path_decoded() but also perform content integrity verification.
The digest is matched against the original fetched content, before decompression.