Skip to main content

FileObjectDatabase

Struct FileObjectDatabase 

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

Implementations§

Source§

impl FileObjectDatabase

Source

pub fn object_format(&self) -> ObjectFormat

The object-id format (hash algorithm) this database was opened with.

Source

pub fn objects_dir(&self) -> &Path

The repository object directory this database reads from.

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 refresh_read_cache(&self)

Drop cached pack registries, indexes, and decoded objects so the next read sees packs/objects installed after this handle was created (e.g. after fetch or install_pack). Long-lived [Repository] sessions call this via the owning repository’s refresh_objects hook.

Source

pub fn loose(&self) -> &LooseObjectStore

Source

pub fn presence_checker(&self) -> ObjectPresenceChecker

Source

pub fn install_pack(&self, pack: &PackWrite) -> Result<PackInstallResult>

Source

pub fn install_pack_with_options( &self, pack: &PackWrite, options: RawPackInstallOptions, ) -> Result<PackInstallResult>

Source

pub fn install_written_pack( &self, pack: &PackWrite, ) -> Result<PackInstallResult>

Install a pack that was produced in this process by PackFile::write_packed.

Unlike Self::install_raw_pack_with_options, this does not re-inflate every pack entry to rebuild the index. It validates the generated pack trailer and generated index against the writer’s object ids, CRCs, and offsets, then writes those bytes directly. Use the raw installer for arbitrary pack bytes received from an untrusted transport.

Source

pub fn install_written_pack_with_options( &self, pack: &PackWrite, options: RawPackInstallOptions, ) -> Result<PackInstallResult>

Source

pub fn install_raw_pack(&self, pack_bytes: &[u8]) -> Result<PackInstallResult>

Source

pub fn install_raw_pack_with_options( &self, pack_bytes: &[u8], options: RawPackInstallOptions, ) -> Result<PackInstallResult>

Source

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

Source

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

Source

pub fn object_storage_info( &self, oid: &ObjectId, ) -> Result<Option<ObjectStorageInfo>>

Source

pub fn resolve_prefix(&self, prefix: &str) -> Result<ObjectPrefixResolution>

Source

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

The object type and content size of oid without decoding its full body — git’s cat-file --batch-check fast path. Tries the decoded-object cache, then loose storage (inflating only the framing header), then packs (reading the entry header and, for deltas, only the delta’s leading varints), then alternates. Returns Ok(None) if the object is not present.

Unlike ObjectReader::read_object, this never materializes the body, so it stays cheap on huge blobs and deep delta chains. It does not populate the decoded-object cache (nothing is decoded).

Trait Implementations§

Source§

impl Clone for FileObjectDatabase

Source§

fn clone(&self) -> FileObjectDatabase

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 FileObjectDatabase

Source§

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

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

impl ObjectReader for FileObjectDatabase

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_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 read_object(&self, oid: &ObjectId) -> Result<Arc<EncodedObject>>

Source§

impl ObjectWriter for FileObjectDatabase

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.
Source§

impl RawPackInstaller for FileObjectDatabase

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.