Skip to main content

grit_lib/objects/
mod.rs

1//! Git objects: ids, kinds, in-memory representations, and the object database stack.
2//!
3//! Canonical layout groups loose/packed storage, hashing, deltas, and reachability
4//! bitmaps under this module.
5//!
6//! Library guide: [mod](https://grit-scm.com/docs/library/objects)
7//!
8//! ```rust
9//! use grit_lib::repo::{InitOptions, Repository};
10//! # fn main() -> grit_lib::error::Result<()> {
11//! let dir = tempfile::tempdir()?;
12//! let _repo = Repository::init(dir.path(), &InitOptions::default())?;
13//! let _odb = _repo.odb();
14//!
15//! # Ok(())
16//! # }
17//! ```
18
19mod commit_ref;
20mod core;
21mod extra_headers;
22pub(crate) mod handle;
23mod oid_hashtable;
24mod write;
25
26pub(crate) use commit_ref::commit_author_and_message_lenient;
27pub use commit_ref::CommitRef;
28pub use core::*;
29pub use extra_headers::{
30    extra_header_values, insert_header_before_signature, iter_extra_headers, next_header_block,
31    remove_header_lines, set_extra_header, ExtraHeaderIter,
32};
33pub use handle::Objects;
34pub use oid_hashtable::{
35    empty_object_id_hash_set, empty_oid_byte_filter_map, empty_oid_set, oid_hash_map,
36    oid_hash_map_from, oid_hash_map_with_capacity, oid_hash_set, oid_hash_set_from,
37    oid_hash_set_with_capacity, OidBuildHasher, OidHashMap, OidHashSet, OidHasher,
38};
39pub use write::{NewCommit, TreeEntryError, WriteTreeOptions};
40
41pub mod odb {
42    //! Object database backends and loose/packed storage.
43    pub use crate::odb::builder::OdbBuilder;
44    pub use crate::odb::store;
45    pub use crate::odb::store::{ObjectStore, WritableObjectStore};
46    pub use crate::odb::{
47        ObjectStream, Odb, WriteOptions, BULK_NEW_LOOSE_WRITE, BULK_TRACKED_RESTAGE_LOOSE_WRITE,
48    };
49}
50
51pub mod pack {
52    //! Pack files, indexes, and packfile I/O.
53    pub use crate::pack::{
54        clear_pack_cache, hash_object_bytes, oid_bytes_to_hex, read_alternates_recursive,
55        read_idx_object_ids, read_local_pack_indexes, read_object_from_pack_at_offset,
56        read_object_from_packs, read_pack_index, read_pack_index_cached,
57        read_packed_delta_dependency, skip_one_pack_object, write_v2_pack_index,
58        write_v2_pack_index_with_trailer, PackIndex, PackIndexEntryRef, SingleLocalPackReader,
59        DEFAULT_PACK_DEPTH,
60    };
61    pub use crate::pack_reuse_root::*;
62}
63
64pub(crate) mod pack_reuse {
65    pub use crate::pack_reuse_root::*;
66}
67
68#[allow(unused_imports)]
69pub(crate) mod pack_write {
70    pub use crate::pack_write_root::*;
71}
72
73pub mod midx {
74    //! Multi-pack-index (MIDX) read and write.
75    pub use crate::midx::{
76        clear_pack_midx_state, midx_lookup_pack_and_offset, read_midx_btmp_ranges,
77        read_midx_objects, try_read_info_via_midx, try_read_object_via_midx,
78        write_multi_pack_index_with_options, MidxBitmapWriteOutcome, WriteMultiPackIndexOptions,
79    };
80}
81
82pub mod hash {
83    //! Object-id hashing, file checksums, and hash algorithm selection.
84    pub use crate::hash::{
85        backend, hash_object, hash_objects_parallel, par_hash_with, parallel_hash_worthwhile,
86        try_par_hash_with, try_par_hash_with_force, verify_trailer, Backend, ChecksumHasher,
87        HashingWriter, ObjectHasher, ParallelHashError, Parallelism, PAR_HASH_MIN_ITEMS,
88        PAR_HASH_MIN_TOTAL_BYTES,
89    };
90}
91
92pub mod commit_graph {
93    //! Commit-graph files for reachability and generation numbers.
94    pub use crate::commit_graph_file::BloomWalkStatsHandle;
95}
96
97pub mod bitmap {
98    //! Pack and commit reachability bitmaps.
99    pub use crate::bitmap_walk::{
100        BitmapWalkError, BitmapWalkUnsupported, ReachabilityQuery, ReachableSet,
101    };
102    pub use crate::pack_bitmap::{
103        BitmapError, BitmapIndex, BitmapIndexCache, CommitReachabilityBitmap, MidxBitmapWriter,
104        PackBitmapWriteError, PackBitmapWriteOptions, PackBitmapWriter, TypeBitmap,
105    };
106}
107
108pub mod delta_encode {
109    //! Delta compression encoding for pack streams.
110    pub use crate::delta_encode::{encode_delta, encode_lcp_delta, DeltaIndex};
111}
112
113pub(crate) mod delta_islands {}
114
115pub mod index_pack {
116    //! Index-pack and thin-pack handling.
117    pub use crate::index_pack::{
118        build_pack_index_records, ingest_received_pack, ingest_received_pack_path,
119        ingest_received_pack_path_with_progress, install_pack_bytes, install_pack_path,
120        install_pack_path_with_progress, IngestPackOptions, IngestedPack, ObjectKindCounts,
121    };
122}
123
124pub(crate) mod pack_name_hash {}
125
126pub(crate) mod pack_rev {}
127
128pub mod pack_store {
129    //! Pack-backed object store implementation.
130    pub use crate::pack_store::PackStore;
131}
132
133pub mod unpack_objects {
134    //! Unpack loose objects from pack streams.
135    pub use crate::unpack_objects::{
136        apply_delta, apply_delta_into, ingest_pack_into, pack_index_records_with_threads,
137        UnpackOptions,
138    };
139}
140
141pub(crate) mod prune_packed {}
142
143pub mod promisor {
144    //! promisor API (re-exported at this path).
145    pub use crate::promisor::{repo_treats_promisor_packs, PROMISOR_MISSING_FILE};
146    pub use crate::promisor_fetch::{
147        DefaultPromisorFetcher, PromisorFetcher, PROMISOR_LAZY_FETCH_CONFIG,
148    };
149}
150
151pub mod promisor_remote {
152    //! Promisor remote configuration for partial clones.
153    pub use crate::promisor_remote::{
154        configured_promisor_remotes, lazy_fetch_order, PromisorAcceptPolicy, PromisorAdvertisement,
155        PromisorConfigWarning, PromisorDecision, PromisorField, PromisorHandshake,
156        PromisorRejection, PromisorReplyError,
157    };
158}
159
160pub mod pack_objects {
161    //! Pack-objects negotiation and encoding.
162    pub use crate::pack_objects::{
163        build_pack, build_pack_from_send_list, build_pack_with_shallow_and_filter,
164        write_pack_for_push, write_upload_pack_stream, PackBuildOptions, PackObjects,
165        PackObjectsOptions, PackProgress, PackStats, SERVE_WINDOW_MEMORY,
166    };
167}
168
169pub mod pack_object_select {
170    //! Object selection heuristics for packing.
171    pub use crate::pack_object_select::{
172        enumerate_pack_objects, HaveBoundary, PackEnumerateOptions,
173    };
174}
175
176#[allow(unused_imports)]
177pub(crate) mod pack_receive {
178    pub use crate::pack_receive::*;
179}
180
181pub(crate) mod pack_stream_scan {
182    pub use crate::pack_stream_scan::*;
183}