pub struct Store { /* private fields */ }
Expand description
The object store for use in any applications with support for auto-updates in the light of changes to the object database.
Features
- entirely lazy, creating an instance does no disk IO at all if
Slots::Given
is used. - multi-threaded lazy-loading of indices and packs
- per-thread pack and object caching avoiding cache trashing.
- most-recently-used packs are always first for speedups if objects are stored in the same pack, typical for packs organized by commit graph and object age.
- lock-free reading for perfect scaling across all cores, and changes to it don’t affect readers as long as these don’t want to enter the same branch.
- sync with the state on disk if objects aren’t found to catch up with changes if an object seems to be missing.
- turn off the behaviour above for all handles if objects are expected to be missing due to spare checkouts.
Implementations
Like Handle::iter()
, but accessible directly on the store.
Open the store at objects_dir
(containing loose objects and packs/
), which must only be a directory for
the store to be created without any additional work being done.
slots
defines how many multi-pack-indices as well as indices we can know about at a time, which includes
the allowance for all additional object databases coming in via alternates
as well.
Note that the slots
isn’t used for packs, these are included with their multi-index or index respectively.
For example, In a repository with 250m objects and geometric packing one would expect 27 index/pack pairs,
or a single multi-pack index.
Handle creation
Create a new cache filled with a handle to this store, if this store is supporting shared ownership.
Note that the actual type of OwnShared
depends on the parallel
feature toggle of the git-features
crate.
Create a new cache filled with a handle to this store if this store is held in an Arc
.
Create a new database handle to this store if this store is supporting shared ownership.
See also, to_cache()
which is probably more useful.
Create a new database handle to this store if this store is held in an Arc
.
This method is useful in applications that know they will use threads.
Transform the only instance into an Arc<Self>
or panic if this is not the only Rc handle
to the contained store.
This is meant to be used when the git_features::threading::OwnShared
refers to an Rc
as it was compiled without the
parallel
feature toggle.
pub fn verify_integrity<C, P, F>(
&self,
progress: P,
should_interrupt: &AtomicBool,
options: Options<F>
) -> Result<Outcome<P>, Error> where
P: Progress,
C: DecodeEntry,
F: Fn() -> C + Send + Clone,
pub fn verify_integrity<C, P, F>(
&self,
progress: P,
should_interrupt: &AtomicBool,
options: Options<F>
) -> Result<Outcome<P>, Error> where
P: Progress,
C: DecodeEntry,
F: Fn() -> C + Send + Clone,
Check the integrity of all objects as per the given options
.
Note that this will not not force loading all indices or packs permanently, as we will only use the momentarily loaded disk state. This does, however, include all alternates.