pub struct FilesSource { /* private fields */ }Expand description
Read/write object storage backed by one objects/ directory tree.
Implementations§
Source§impl FilesSource
impl FilesSource
Sourcepub fn open(
pack_store: Arc<PackStore>,
loose: LooseStore,
use_midx: bool,
midx_tip_listing_for_exists: bool,
diagnostics: DiagnosticsHandle,
) -> Result<Self>
pub fn open( pack_store: Arc<PackStore>, loose: LooseStore, use_midx: bool, midx_tip_listing_for_exists: bool, diagnostics: DiagnosticsHandle, ) -> Result<Self>
Open a files source for pack_store’s directory.
use_midx enables multi-pack-index reads when a chain is present.
midx_tip_listing_for_exists matches Git’s MIDX membership probe for ObjectStore::contains.
§Errors
Propagates MidxObjects::new failures other than a missing index.
Sourcepub fn objects_dir(&self) -> &Path
pub fn objects_dir(&self) -> &Path
objects/ root for this source.
Sourcepub fn loose_store(&self) -> &LooseStore
pub fn loose_store(&self) -> &LooseStore
Loose-object backend (writes target this store).
Sourcepub fn packed_objects(&self) -> &PackedObjects
pub fn packed_objects(&self) -> &PackedObjects
Shared pack read backend.
Sourcepub fn midx_objects(&self) -> &MidxObjects
pub fn midx_objects(&self) -> &MidxObjects
MIDX layer for this directory.
Sourcepub fn exists_local_materialized(&self, oid: &ObjectId) -> bool
pub fn exists_local_materialized(&self, oid: &ObjectId) -> bool
Whether oid is materialized under this objects/ tree (local loose or non-promisor pack).
Sourcepub fn try_finish_duplicate_write(
&self,
oid: &ObjectId,
options: WriteOptions,
) -> Result<Option<ObjectId>>
pub fn try_finish_duplicate_write( &self, oid: &ObjectId, options: WriteOptions, ) -> Result<Option<ObjectId>>
Resolve duplicate-write short-circuit for this directory before creating a loose file.
Returns Some(oid) when the object is already present locally and was freshened when
appropriate. When options.trust_new_loose is set, only an existing loose file stops the
write (callers may still consult alternates).
Sourcepub fn write_zlib_prehashed(
&self,
oid: &ObjectId,
zlib_store: &[u8],
options: WriteOptions,
) -> Result<ObjectId>
pub fn write_zlib_prehashed( &self, oid: &ObjectId, zlib_store: &[u8], options: WriteOptions, ) -> Result<ObjectId>
Write zlib-compressed store bytes for a precomputed oid into this source’s loose store.
§Errors
Same as WritableObjectStore::write.
Sourcepub fn local_loose_exists_but_unreadable(
&self,
oid: &ObjectId,
err: &Error,
) -> bool
pub fn local_loose_exists_but_unreadable( &self, oid: &ObjectId, err: &Error, ) -> bool
Whether a loose object file exists but could not be parsed (caller may consult alternates).
Trait Implementations§
Source§impl Debug for FilesSource
impl Debug for FilesSource
Source§impl ObjectStore for FilesSource
impl ObjectStore for FilesSource
Source§fn read(&self, oid: &ObjectId) -> Result<Option<Object>>
fn read(&self, oid: &ObjectId) -> Result<Option<Object>>
Source§fn read_into(
&self,
oid: &ObjectId,
buf: &mut Vec<u8>,
) -> Result<Option<ObjectKind>>
fn read_into( &self, oid: &ObjectId, buf: &mut Vec<u8>, ) -> Result<Option<ObjectKind>>
buf, reusing its capacity when possible. Read moreSource§fn read_info(&self, oid: &ObjectId) -> Result<Option<ObjectInfo>>
fn read_info(&self, oid: &ObjectId) -> Result<Option<ObjectInfo>>
Source§fn contains(&self, oid: &ObjectId) -> Result<bool>
fn contains(&self, oid: &ObjectId) -> Result<bool>
oid is stored in this backend (without reading the payload). Read more