Trait git_pack::Find[][src]

pub trait Find {
    type Error: Error + 'static;
    fn try_find<'a>(
        &self,
        id: impl AsRef<oid>,
        buffer: &'a mut Vec<u8>,
        pack_cache: &mut impl DecodeEntry
    ) -> Result<Option<Object<'a>>, Self::Error>;
fn location_by_oid(
        &self,
        id: impl AsRef<oid>,
        buf: &mut Vec<u8>
    ) -> Option<Location>;
fn bundle_by_pack_id(&self, pack_id: u32) -> Option<&Bundle>;
fn entry_by_location(&self, location: &Location) -> Option<Entry<'_>>; }
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.

Associated Types

The error returned by try_find()

Required 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.

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 the object database may have no notion of packs and thus always returns None.

Find the bundle matching pack_id, or None if there is no such pack.

Note that the object database may have no notion of packs and thus always returns None.

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 a data::Object.

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.

Implementations on Foreign Types

Implementors