Skip to main content

ChunkStore

Trait ChunkStore 

Source
pub trait ChunkStore: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        digest: &'life1 B3Digest,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn has<'life0, 'life1, 'async_trait>(
        &'life0 self,
        digest: &'life1 B3Digest,
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'async_trait>(
        &'life0 self,
        chunk: Chunk,
    ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Allows reading (or uploading) content-addressed chunks of raw data.

BLAKE3 is used as a hashing function for the data. Uploading a blob will return the BLAKE3 digest of it, and that’s the identifier used to Read/Stat them too.

Chunks are considered small enough to not require any further chunking.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieves a Chunk by its B3Digest, if it exists.

Source

fn has<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a Chunk with this B3Digest exists.

Source

fn put<'life0, 'async_trait>( &'life0 self, chunk: Chunk, ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Upload a Chunk, returns its B3Digest.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + ChunkStore + ?Sized> ChunkStore for &'a T
where &'a T: Send + Sync,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn has<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn put<'life0, 'async_trait>( &'life0 self, chunk: Chunk, ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<'a, T: 'a + ChunkStore + ?Sized> ChunkStore for &'a mut T
where &'a mut T: Send + Sync,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn has<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn put<'life0, 'async_trait>( &'life0 self, chunk: Chunk, ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<T: ChunkStore + ?Sized> ChunkStore for Box<T>
where Box<T>: Send + Sync,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn has<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn put<'life0, 'async_trait>( &'life0 self, chunk: Chunk, ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<T: ChunkStore + ?Sized> ChunkStore for Arc<T>
where Arc<T>: Send + Sync,

Source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<Option<Chunk>, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn has<'life0, 'life1, 'async_trait>( &'life0 self, digest: &'life1 B3Digest, ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn put<'life0, 'async_trait>( &'life0 self, chunk: Chunk, ) -> Pin<Box<dyn Future<Output = Result<B3Digest, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§

Source§

impl ChunkStore for MemoryChunkStore

Source§

impl ChunkStore for ObjectStoreChunkStore

Source§

impl<CN, CF> ChunkStore for Cache<CN, CF>
where CN: ChunkStore, CF: ChunkStore,

Source§

impl<CS> ChunkStore for Priority<CS>
where CS: ChunkStore,

Source§

impl<CS> ChunkStore for Race<CS>
where CS: ChunkStore,

Source§

impl<T> ChunkStore for GrpcChunkStore<T>
where T: GrpcService<Body> + Send + Sync + Clone + 'static, T::ResponseBody: Body<Data = Bytes> + Send + 'static, <T::ResponseBody as Body>::Error: Into<StdError> + Send, T::Future: Send,