Expand description
Git stores all of its data as Objects, which are data along with a hash over all data. Thus it’s an object store indexed by the signature of data itself with inherent deduplication: the same data will have the same hash, and thus occupy the same space within the store.
There is only one all-round object store, also known as the Store, as it supports everything most of what git has to offer.
- loose object reading and writing
- access to packed objects
- multiple loose objects and pack locations as gathered from
alternatesfiles.
§Write And Read Loose Objects
use gix_object::{FindExt, Write};
let (_dir, odb) = doctest::empty_store()?;
let id = odb.write_buf(gix_object::Kind::Blob, b"hello")?;
let mut buf = Vec::new();
let object = odb.find(&id, &mut buf)?;
assert_eq!(object.kind, gix_object::Kind::Blob);
assert_eq!(object.data, b"hello");§Inspect Headers Without Decoding The Object
use gix_object::Write;
use gix_odb::HeaderExt;
let (_dir, odb) = doctest::empty_store()?;
let id = odb.write_buf(gix_object::Kind::Blob, b"hello")?;
let header = odb.header(&id)?;
assert_eq!(header.kind(), gix_object::Kind::Blob);
assert_eq!(header.size(), 5);§Feature Flags
sha1— Enable support for the SHA-1 hash by enabling the respective feature in thegix-hashcrate.serde— Data structures implementserde::Serializeandserde::Deserialize.
Re-exports§
pub use gix_pack as pack;
Modules§
- alternate
- A file with directories of other git object databases to use when reading objects.
- cache
- find
- loose
- An object database storing each object in a zlib compressed file with its hash in the path
- memory
- store
- The standard object store which should fit all needs.
Structs§
- Cache
- A way to access objects along with pre-configured thread-local caches for packed base objects as well as objects themselves.
- Sink
- It can optionally compress the content, similarly to what would happen when using a
loose::Store. - Store
- The object store for use in any applications with support for auto-updates in the light of changes to the object database.
Traits§
- Header
- A way to obtain object properties without fully decoding it.
- Header
Ext - An extension trait with convenience functions.
Functions§
- at
- Create a new cached handle to the object store.
- at_opts
- Create a new cached handle to the object store with support for additional options.
- sink
- Create a new
Sinkwith compression disabled.