Skip to main content

ObjectSource

Trait ObjectSource 

Source
pub trait ObjectSource {
    // Required method
    fn read(&self, h: &Hash) -> StoreResult<Vec<u8>>;

    // Provided methods
    fn read_object(&self, h: &Hash) -> StoreResult<Object> { ... }
    fn read_unverified(&self, h: &Hash) -> StoreResult<Vec<u8>> { ... }
}
Expand description

Read source shared by ObjectStore and snapshot overlays, so tree-diff code can resolve objects from either the durable store or an in-memory EphemeralSink.

Required Methods§

Source

fn read(&self, h: &Hash) -> StoreResult<Vec<u8>>

Read and integrity-verify the raw bytes of h.

§Errors

StoreError::ObjectNotFound / StoreError::HashMismatch / I/O errors, as for ObjectStore::read.

Provided Methods§

Source

fn read_object(&self, h: &Hash) -> StoreResult<Object>

Read and decode h into a typed Object.

§Errors

As Self::read, plus decode errors.

Source

fn read_unverified(&self, h: &Hash) -> StoreResult<Vec<u8>>

Read h without integrity verification, for display-only rendering — see ObjectStore::read_unverified for the full policy (#625). Defaults to the fully-verifying Self::read, so every existing and third-party ObjectSource stays verifying unless it explicitly opts in by overriding this method.

§Errors

As Self::read (an opting-in override may narrow this to never return StoreError::HashMismatch).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§