pub struct LooseObjectStore { /* private fields */ }Implementations§
Source§impl LooseObjectStore
impl LooseObjectStore
pub fn new(objects_dir: impl Into<PathBuf>, format: ObjectFormat) -> Self
pub fn from_git_dir(git_dir: impl AsRef<Path>, format: ObjectFormat) -> Self
pub fn object_path(&self, oid: &ObjectId) -> Result<PathBuf>
pub fn exists(&self, oid: &ObjectId) -> Result<bool>
pub fn disk_size(&self, oid: &ObjectId) -> Result<Option<u64>>
Sourcepub fn read_header(&self, oid: &ObjectId) -> Result<Option<(ObjectType, u64)>>
pub fn read_header(&self, oid: &ObjectId) -> Result<Option<(ObjectType, u64)>>
The object type and content size of oid from loose storage, inflating only
the framing header ("<type> <size>\0") and not the body. Output-limited
reads keep miniz from inflating past the header even for large objects.
Returns Ok(None) when the loose object is absent.
Sourcepub fn object_ids(&self) -> Result<Vec<ObjectId>>
pub fn object_ids(&self) -> Result<Vec<ObjectId>>
Loose object ids in this store, sorted by hex.
Sourcepub fn verify_object(
&self,
oid: &ObjectId,
display_path: &str,
) -> Result<Option<LooseObjectIntegrity>>
pub fn verify_object( &self, oid: &ObjectId, display_path: &str, ) -> Result<Option<LooseObjectIntegrity>>
fsck’s loose-object integrity probe, mirroring C git’s read_loose_object
(object-file.c) as called from fsck_loose (builtin/fsck.c): inflate and
parse the file at oid’s loose path, then re-hash its content against the
path-derived oid. display_path appears verbatim in the error:-level
diagnostics — the path-form messages of read_loose_object (“unable to
unpack header of Ok(None) when no loose file exists for oid.
Trait Implementations§
Source§impl Clone for LooseObjectStore
impl Clone for LooseObjectStore
Source§fn clone(&self) -> LooseObjectStore
fn clone(&self) -> LooseObjectStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LooseObjectStore
impl Debug for LooseObjectStore
Source§impl ObjectReader for LooseObjectStore
impl ObjectReader for LooseObjectStore
fn read_object(&self, oid: &ObjectId) -> Result<Arc<EncodedObject>>
Source§fn is_shallow_graft(&self, _oid: &ObjectId) -> bool
fn is_shallow_graft(&self, _oid: &ObjectId) -> bool
true when history is cut at oid, so every walk must treat the
commit as parentless even though its raw body still names parents. Read moreSource§fn has_shallow_grafts(&self) -> bool
fn has_shallow_grafts(&self) -> bool
Source§fn is_promised_object(&self, _oid: &ObjectId) -> bool
fn is_promised_object(&self, _oid: &ObjectId) -> bool
oid is covered by a promisor pack. Partial clones are
allowed to omit promised objects until a later on-demand fetch hydrates
them; ordinary readers keep the default “no promised objects”.Source§impl ObjectWriter for LooseObjectStore
impl ObjectWriter for LooseObjectStore
Source§fn write_object(&self, object: EncodedObject) -> Result<ObjectId>
fn write_object(&self, object: EncodedObject) -> Result<ObjectId>
object, returning its id. Takes &self: every implementation’s
write state (in-memory map, loose-object cache) is behind interior
mutability, so a single handle can interleave reads and writes without a
&mut borrow. This lets the merge engine read and write through one db
instead of opening a second read-only handle that re-warms the caches.