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>;
// Provided method
fn objects_needed(
&self,
checksums: &[String],
) -> Result<Vec<String>, 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§
Sourcefn has_object(&self, checksum: &str) -> Result<bool, StoreError>
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.
Sourcefn get_object(&self, checksum: &str) -> Result<Vec<u8>, StoreError>
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
StoreError::ObjectNotFoundif no object is stored atchecksum.StoreError::Integrityif the stored bytes do not hash tochecksum(the blob is corrupt or tampered).StoreError::Io/StoreError::Backendon transport failure.
Sourcefn put_object(&self, checksum: &str, bytes: Vec<u8>) -> Result<(), StoreError>
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
StoreError::Integrityifbytesdo not hash tochecksum.StoreError::Io/StoreError::Backendon transport failure.
Sourcefn put_manifest(&self, id: &str, manifest: &Manifest) -> Result<(), StoreError>
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
StoreError::Integrityif the manifest does not hash toid.StoreError::Io/StoreError::Backendon transport failure.
Provided Methods§
Sourcefn objects_needed(
&self,
checksums: &[String],
) -> Result<Vec<String>, StoreError>
fn objects_needed( &self, checksums: &[String], ) -> Result<Vec<String>, StoreError>
Returns the subset of checksums NOT present in the store, PRESERVING
INPUT ORDER.
This is the diff primitive behind the snapdir objects-needed wire
plumbing (SNAPPACK acceleration, see crate::pack): a sender offers
a snapshot’s full object list and the receiver answers with exactly the
objects it still needs, so only those ride the pack stream.
Semantics:
- Fail closed: every checksum is validated against
^[0-9a-f]{64}$(crate::pack::is_hex64) BEFORE the first existence probe; any invalid entry is a hard error and nothing is returned (a malformed request must never be partially answered). - Order-preserving, no dedup: the returned complement keeps the input order, and deduplication is the CALLER’s job — an absent checksum supplied twice is reported twice.
- The default implementation loops
has_object(one existence probe per checksum). Follow-up (not this gate): the S3/GCS backends should override this with their batched listing APIs to cut round trips — any override must preserve the exact contract above.
§Errors
StoreError::Backendif any checksum is not 64 lowercase hex characters (fail closed, before any probe).- Whatever
has_objectsurfaces on transport failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".