pub struct FileObjectDatabase { /* private fields */ }Implementations§
Source§impl FileObjectDatabase
impl FileObjectDatabase
Sourcepub fn object_format(&self) -> ObjectFormat
pub fn object_format(&self) -> ObjectFormat
The object-id format (hash algorithm) this database was opened with.
Sourcepub fn objects_dir(&self) -> &Path
pub fn objects_dir(&self) -> &Path
The repository object directory this database reads from.
pub fn new(objects_dir: impl Into<PathBuf>, format: ObjectFormat) -> Self
pub fn from_git_dir(git_dir: impl AsRef<Path>, format: ObjectFormat) -> Self
Sourcepub fn refresh_read_cache(&self)
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.
pub fn loose(&self) -> &LooseObjectStore
pub fn presence_checker(&self) -> ObjectPresenceChecker
pub fn install_pack(&self, pack: &PackWrite) -> Result<PackInstallResult>
pub fn install_pack_with_options( &self, pack: &PackWrite, options: RawPackInstallOptions, ) -> Result<PackInstallResult>
Sourcepub fn install_written_pack(
&self,
pack: &PackWrite,
) -> Result<PackInstallResult>
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.
pub fn install_written_pack_with_options( &self, pack: &PackWrite, options: RawPackInstallOptions, ) -> Result<PackInstallResult>
pub fn install_raw_pack(&self, pack_bytes: &[u8]) -> Result<PackInstallResult>
pub fn install_raw_pack_with_options( &self, pack_bytes: &[u8], options: RawPackInstallOptions, ) -> Result<PackInstallResult>
pub fn contains(&self, oid: &ObjectId) -> Result<bool>
pub fn object_ids(&self) -> Result<Vec<ObjectId>>
pub fn object_storage_info( &self, oid: &ObjectId, ) -> Result<Option<ObjectStorageInfo>>
pub fn resolve_prefix(&self, prefix: &str) -> Result<ObjectPrefixResolution>
Sourcepub fn read_object_header(
&self,
oid: &ObjectId,
) -> Result<Option<(ObjectType, u64)>>
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
impl Clone for FileObjectDatabase
Source§fn clone(&self) -> FileObjectDatabase
fn clone(&self) -> FileObjectDatabase
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 FileObjectDatabase
impl Debug for FileObjectDatabase
Source§impl ObjectReader for FileObjectDatabase
impl ObjectReader for FileObjectDatabase
Source§fn has_shallow_grafts(&self) -> bool
fn has_shallow_grafts(&self) -> bool
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 morefn read_object(&self, oid: &ObjectId) -> Result<Arc<EncodedObject>>
Source§impl ObjectWriter for FileObjectDatabase
impl ObjectWriter for FileObjectDatabase
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.