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 with_promisor_remote_present(self, present: bool) -> Self
pub fn with_promisor_remote_present(self, present: bool) -> Self
Declare whether the owning repository has a promisor remote configured.
Only when this holds does ObjectReader::is_promised_object treat
objects in .promisor packs (and their transitive references) as
promised — matching git’s is_promisor_object, which is gated on
repo_has_promisor_remote(). Callers that know the repo config (e.g. the
fsck driver) opt in; readers built without config keep the safe default
of false, so a stray .promisor sidecar never silently excuses a
genuinely missing object.
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 write_blob_as_pack( &self, oid: ObjectId, object: &EncodedObject, compression_level: u32, ) -> Result<ObjectId>
pub fn write_blobs_as_pack( &self, objects: &[(ObjectId, EncodedObject)], compression_level: u32, ) -> Result<()>
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_from_reader<R>(
&self,
reader: &mut R,
) -> Result<PackInstallResult>where
R: Read,
pub fn begin_raw_pack_install( &self, expected_pack_id: ObjectId, expected_pack_size: u64, ) -> Result<RawPackStreamingInstall>
pub fn begin_raw_pack_install_with_options( &self, expected_pack_id: ObjectId, expected_pack_size: u64, options: RawPackInstallOptions, ) -> Result<RawPackStreamingInstall>
pub fn install_raw_pack_from_reader_with_options<R>(
&self,
reader: &mut R,
options: RawPackInstallOptions,
) -> Result<PackInstallResult>where
R: Read,
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>
pub fn object_ids_with_prefix(&self, prefix: &str) -> Result<Vec<ObjectId>>
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 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§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.