pub trait ObjectSource {
// Required methods
fn get_tree(&self, hash: &ContentHash) -> Result<Option<Tree>>;
fn get_state(&self, id: &StateId) -> Result<Option<State>>;
fn get_blob(&self, hash: &ContentHash) -> Result<Option<Blob>>;
// Provided methods
fn decoded_blob_len(&self, hash: &ContentHash) -> Result<Option<u64>> { ... }
fn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<Bytes>> { ... }
}Expand description
Read-only object access needed by object graph walkers.
Required Methods§
fn get_tree(&self, hash: &ContentHash) -> Result<Option<Tree>>
fn get_state(&self, id: &StateId) -> Result<Option<State>>
fn get_blob(&self, hash: &ContentHash) -> Result<Option<Blob>>
Provided Methods§
Sourcefn decoded_blob_len(&self, hash: &ContentHash) -> Result<Option<u64>>
fn decoded_blob_len(&self, hash: &ContentHash) -> Result<Option<u64>>
Uncompressed byte length without requiring content.
The default falls back to Self::get_blob. Stores that can answer
from a header or index should override this so blame can reject an
oversized blob before materializing it.
Sourcefn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<Bytes>>
fn get_blob_bytes(&self, hash: &ContentHash) -> Result<Option<Bytes>>
Zero-copy variant of get_blob.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".