Skip to main content

LooseObjectStore

Struct LooseObjectStore 

Source
pub struct LooseObjectStore { /* private fields */ }

Implementations§

Source§

impl LooseObjectStore

Source

pub fn new(objects_dir: impl Into<PathBuf>, format: ObjectFormat) -> Self

Source

pub fn from_git_dir(git_dir: impl AsRef<Path>, format: ObjectFormat) -> Self

Source

pub fn object_path(&self, oid: &ObjectId) -> Result<PathBuf>

Source

pub fn exists(&self, oid: &ObjectId) -> Result<bool>

Source

pub fn disk_size(&self, oid: &ObjectId) -> Result<Option<u64>>

Source

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.

Source

pub fn object_ids(&self) -> Result<Vec<ObjectId>>

Loose object ids in this store, sorted by hex.

Source

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 ”), unlike the oid-form messages of the normal read path. Returns Ok(None) when no loose file exists for oid.

Trait Implementations§

Source§

impl Clone for LooseObjectStore

Source§

fn clone(&self) -> LooseObjectStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LooseObjectStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ObjectReader for LooseObjectStore

Source§

fn read_object(&self, oid: &ObjectId) -> Result<Arc<EncodedObject>>

Source§

fn is_shallow_graft(&self, _oid: &ObjectId) -> bool

Graft-points seam (shallow clones today, replace refs/grafts later): 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 more
Source§

fn has_shallow_grafts(&self) -> bool

Whether this reader has any shallow/graft boundaries at all. Walkers can use this to choose dense graph-only traversal when no boundary can cut parent edges.
Source§

fn is_promised_object(&self, _oid: &ObjectId) -> bool

True when 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

Source§

fn write_object(&self, object: EncodedObject) -> Result<ObjectId>

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.