Skip to main content

ChunkStore

Trait ChunkStore 

Source
pub trait ChunkStore: Send {
    // Required methods
    fn put(&mut self, data: &[u8]) -> Result<ContentHash, StoreError>;
    fn get(&self, hash: &ContentHash) -> Result<Vec<u8>, StoreError>;
    fn has(&self, hash: &ContentHash) -> bool;
}
Expand description

The chunk-store seam (D7). Conformance suite: tests/conformance.rs.

put is content-addressed and idempotent; get must return exactly the bytes that hash to hash or an error, never silently wrong data.

Required Methods§

Source

fn put(&mut self, data: &[u8]) -> Result<ContentHash, StoreError>

Stores data and returns its content address. Idempotent.

Source

fn get(&self, hash: &ContentHash) -> Result<Vec<u8>, StoreError>

Retrieves the bytes for hash, verifying them against the address.

Source

fn has(&self, hash: &ContentHash) -> bool

Whether hash is present.

Implementors§