Skip to main content

StreamStore

Trait StreamStore 

Source
pub trait StreamStore: Store {
    // Required methods
    fn has_object(&self, checksum: &str) -> Result<bool, StoreError>;
    fn get_object(&self, checksum: &str) -> Result<Vec<u8>, StoreError>;
    fn put_object(
        &self,
        checksum: &str,
        bytes: Vec<u8>,
    ) -> Result<(), StoreError>;
    fn put_manifest(
        &self,
        id: &str,
        manifest: &Manifest,
    ) -> Result<(), StoreError>;
}
Expand description

Raw, content-addressed object/manifest streaming on top of a Store.

See the module docs for the store-to-store sync motivation and the verification invariants. The Store supertrait means every implementor also offers get_manifest, fetch_files, and push.

Required Methods§

Source

fn has_object(&self, checksum: &str) -> Result<bool, StoreError>

Returns true if an object with this content-address already exists in the store.

This is the existence check a store-to-store orchestrator uses to skip re-copying blobs the destination already holds. It does not read or verify the object body.

§Errors

StoreError::Io / StoreError::Backend on transport failure.

Source

fn get_object(&self, checksum: &str) -> Result<Vec<u8>, StoreError>

Reads the raw object blob filed under checksum, verifying its bytes hash (BLAKE3) back to checksum before returning them.

§Errors
Source

fn put_object(&self, checksum: &str, bytes: Vec<u8>) -> Result<(), StoreError>

Writes a raw object blob at its content-address, verifying bytes hash (BLAKE3) to checksum before storing anything.

A mismatch stores nothing and returns an error, so a corrupt blob can never land at a content-address it does not belong to.

§Errors
Source

fn put_manifest(&self, id: &str, manifest: &Manifest) -> Result<(), StoreError>

Writes the manifest object for id, verifying the manifest’s bytes hash back to id before storing it.

This is the final step of a store-to-store copy: it is written only after every referenced object has landed, so a manifest is never observable before the content it references (mirroring push).

§Errors

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§