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. replacements is an iterator over pairs of old and new object ids for replacement support. This means that when asking for object X, one will receive object X-replaced given an iterator like Some((X, X-replaced)).

Handle creation

The amount of times a ref-delta base can be followed when multi-indices are involved.

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.

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.

Return metrics collected in a racy fashion, giving an idea of what’s currently going on in the store.

Use this to decide whether a new instance should be created to get a chance at dropping all open handles.

The root path at which we expect to find all objects and packs, and which is the source of the alternate file traversal in case there are linked repositories.

The kind of object hash to assume when dealing with pack indices and pack data files.

Whether or not we are allowed to use multi-pack indices

An iterator over replacements from object-ids X to X-replaced as (X, X-replaced), sorted by the original id X.

Return information about all files known to us as well as their loading state.

Note that this call is expensive as it gathers additional information about loose object databases. Note that it may change as we collect information due to the highly volatile nature of the implementation. The likelihood of actual changes is low though as these still depend on something changing on disk and somebody reading at the same time.

Trait Implementations

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.