pub struct CompositeStore { /* private fields */ }Expand description
Read-only store that consults an ordered list of backends.
§Errors
Reads (ObjectStore::read, read_into, read_info, open_stream) skip past a backend
whose copy is damaged (Error::Zlib or Error::CorruptObject) and return a later
backend’s good copy. When no backend returns the object, the first such corruption error is
returned instead of Ok(None). Any other backend error is returned immediately.
Implementations§
Source§impl CompositeStore
impl CompositeStore
Sourcepub fn new(stores: Vec<Arc<dyn ObjectStore>>, hash_algo: HashAlgo) -> Self
pub fn new(stores: Vec<Arc<dyn ObjectStore>>, hash_algo: HashAlgo) -> Self
Build a composite from stores in lookup order (first match wins).
hash_algo is used when every child is empty; otherwise the first store’s algorithm applies.
Sourcepub fn stores(&self) -> &[Arc<dyn ObjectStore>]
pub fn stores(&self) -> &[Arc<dyn ObjectStore>]
Backends in lookup order (read-only).
Trait Implementations§
Source§impl Debug for CompositeStore
impl Debug for CompositeStore
Source§impl ObjectStore for CompositeStore
impl ObjectStore for CompositeStore
Source§fn read(&self, oid: &ObjectId) -> Result<Option<Object>>
fn read(&self, oid: &ObjectId) -> Result<Option<Object>>
Load the full object, if present. Read more
Source§fn read_into(
&self,
oid: &ObjectId,
buf: &mut Vec<u8>,
) -> Result<Option<ObjectKind>>
fn read_into( &self, oid: &ObjectId, buf: &mut Vec<u8>, ) -> Result<Option<ObjectKind>>
Load object payload into
buf, reusing its capacity when possible. Read moreSource§fn read_info(&self, oid: &ObjectId) -> Result<Option<ObjectInfo>>
fn read_info(&self, oid: &ObjectId) -> Result<Option<ObjectInfo>>
Object kind and size without loading the full payload. Read more
Source§fn contains(&self, oid: &ObjectId) -> Result<bool>
fn contains(&self, oid: &ObjectId) -> Result<bool>
Whether
oid is stored in this backend (without reading the payload). Read moreSource§fn contains_many(&self, oids: &[ObjectId]) -> Result<Vec<bool>>
fn contains_many(&self, oids: &[ObjectId]) -> Result<Vec<bool>>
For each id in
oids, whether it is stored in this backend; the result has
one entry per input id, in input order. Read moreSource§fn open_stream(&self, oid: &ObjectId) -> Result<Option<ObjectStream<'_>>>
fn open_stream(&self, oid: &ObjectId) -> Result<Option<ObjectStream<'_>>>
Open a stream over the object’s uncompressed payload. Read more
Source§fn for_each_object(
&self,
f: &mut dyn FnMut(&ObjectId) -> ControlFlow<()>,
) -> Result<()>
fn for_each_object( &self, f: &mut dyn FnMut(&ObjectId) -> ControlFlow<()>, ) -> Result<()>
Auto Trait Implementations§
impl !RefUnwindSafe for CompositeStore
impl !UnwindSafe for CompositeStore
impl Freeze for CompositeStore
impl Send for CompositeStore
impl Sync for CompositeStore
impl Unpin for CompositeStore
impl UnsafeUnpin for CompositeStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more