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§
Sourcefn read(&self, h: &Hash) -> StoreResult<Vec<u8>>
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§
Sourcefn read_object(&self, h: &Hash) -> StoreResult<Object>
fn read_object(&self, h: &Hash) -> StoreResult<Object>
Sourcefn read_unverified(&self, h: &Hash) -> StoreResult<Vec<u8>>
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".