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
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]
&self,
id: impl AsRef<oid>,
buffer: &'a mut Vec<u8>,
pack_cache: &mut impl DecodeEntry
) -> Result<Option<Object<'a>>, Self::Error>
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.