pub trait Find {
    type Error: Error + 'static;

    fn contains(&self, id: impl AsRef<oid>) -> bool;
    fn try_find_cached<'a>(
        &self,
        id: impl AsRef<oid>,
        buffer: &'a mut Vec<u8>,
        pack_cache: &mut impl DecodeEntry
    ) -> Result<Option<(Data<'a>, Option<Location>)>, Self::Error>; fn location_by_oid(
        &self,
        id: impl AsRef<oid>,
        buf: &mut Vec<u8>
    ) -> Option<Location>; fn pack_offsets_and_oid(
        &self,
        pack_id: u32
    ) -> Option<Vec<(Offset, ObjectId)>>; fn entry_by_location(&self, location: &Location) -> Option<Entry>; fn try_find<'a>(
        &self,
        id: impl AsRef<oid>,
        buffer: &'a mut Vec<u8>
    ) -> Result<Option<(Data<'a>, Option<Location>)>, Self::Error> { ... } }
Expand description

Describe how object can be located in an object store with built-in facilities to supports packs specifically.

Notes

Find effectively needs generic associated types to allow a trait for the returned object type. Until then, we will have to make due with explicit types and give them the potentially added features we want.

Required Associated Types

The error returned by try_find()

Required Methods

Returns true if the object exists in the database.

Like Find::try_find(), but with support for controlling the pack cache. A pack_cache can be used to speed up subsequent lookups, set it to crate::cache::Never if the workload isn’t suitable for caching.

Returns Some object if it was present in the database, or the error that occurred during lookup or object retrieval.

Find the packs location where an object with id can be found in the database, or None if there is no pack holding the object.

Note that this is always None if the object isn’t packed.

Obtain a vector of all offsets, in index order, along with their object id.

Return the find::Entry for location if it is backed by a pack.

Note that this is only in the interest of avoiding duplicate work during pack generation. Pack locations can be obtained from Find::try_find().

Notes

Custom implementations might be interested in providing their own meta-data with object, which currently isn’t possible as the Locate trait requires GATs to work like that.

Provided Methods

Find an object matching id in the database while placing its raw, undecoded data into buffer. A pack_cache can be used to speed up subsequent lookups, set it to crate::cache::Never if the workload isn’t suitable for caching.

Returns Some object if it was present in the database, or the error that occurred during lookup or object retrieval.

Implementations on Foreign Types

Implementors