pub trait NarSource: Send + Sync {
// Required method
fn open<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, StoreError>> + Send>>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided method
fn size_hint(&self) -> Option<u64> { ... }
}Expand description
A re-openable NAR byte source.
open yields a fresh bounded-chunk stream over the same
bytes every time it is called, so a fan-out writer feeds each destination in
order from its own stream and never has to materialize the NAR to serve more
than one consumer. See the module docs for why the write side needs this and
a plain Stream will not do.
Required Methods§
Sourcefn open<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, StoreError>> + Send>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn open<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Bytes, StoreError>> + Send>>, StoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Open a fresh chunk stream over the same bytes.
§Errors
Returns a StoreError if the underlying bytes cannot be (re-)opened —
a spool file that was removed, a lower tier that lost the content
between the probe and the promotion.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".