Trait git_odb::Find[][src]

pub trait Find {
    type Error: Error + 'static;
    fn find<'a>(
        &self,
        id: impl AsRef<oid>,
        buffer: &'a mut Vec<u8>,
        pack_cache: &mut impl DecodeEntry
    ) -> Result<Option<Object<'a>>, Self::Error>;
fn pack_entry(&self, object: &Object<'_>) -> Option<PackEntry<'_>>; }

Describe how object can be located in an object store

Notes

Locate 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

type Error: Error + 'static[src]

The error returned by find()

Loading content...

Required methods

fn find<'a>(
    &self,
    id: impl AsRef<oid>,
    buffer: &'a mut Vec<u8>,
    pack_cache: &mut impl DecodeEntry
) -> Result<Option<Object<'a>>, Self::Error>
[src]

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 pack::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.

fn pack_entry(&self, object: &Object<'_>) -> Option<PackEntry<'_>>[src]

Return the PackEntry for object if it is backed by a pack.

Note that this is only in the interest of avoiding duplicate work during pack generation as the input for this is an already decoded data::Object that is fully known.

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.

Loading content...

Implementations on Foreign Types

impl<T> Find for Arc<T> where
    T: Find
[src]

type Error = T::Error

impl<T> Find for Box<T> where
    T: Find
[src]

type Error = T::Error

Loading content...

Implementors

impl Find for &Db[src]

type Error = Error

impl Find for Db[src]

type Error = Error

Loading content...