Skip to main content

git_internal/
lib.rs

1//! Git-Internal: a high-performance Rust library for Git objects and pack files—encode/decode, delta (ref/offset/zstd),
2//! caching, streaming, and sync/async pipelines.
3//!
4//! Goals
5//! - Provide high-performance parsing and generation of Git pack format and Git objects.
6//! - Support both file-based and streaming inputs of Git Pack.
7//! - Offer synchronous and asynchronous APIs for multi-threaded and Tokio runtimes.
8//!
9//! Core Capabilities
10//! - Decoding: base objects and delta objects (Ref-Delta, Offset-Delta, ZstdDelta).
11//! - Encoding: serial and parallel pipelines; offset deltas and Zstd-based deltas.
12//! - Streaming: `decode_stream` for `Stream<Bytes>`; `decode_async` decodes in a new thread and sends entries.
13//! - Caching & memory: LRU-based cache; `MemSizeRecorder` tracks heap usage; optional `mem_limit` to bound memory.
14//! - Utilities: Hash-stream helpers, zlib, delta, zstdelta toolkits.
15//!
16//! Modules
17//! - `internal::pack`: decode/encode, caches, waitlists, parallel pipelines, helpers.
18//! - `internal::object`: Blob/Tree/Commit/Tag/Note objects, type enum, object trait.
19//! - `internal::zlib`: compression/decompression stream utilities.
20//! - `delta` and `zstdelta`: delta algorithms and rebuild helpers.
21//! - `errors`: unified error types.
22//! - `hash`: Hash helpers.
23//! - `utils`: common utilities (e.g., `CountingReader`).
24//!
25//! Typical Usage
26//! - Offline large-file decode: `Pack::decode_async(reader, sender)` decodes in a thread and sends `Entry`s.
27//! - Stream decode: `Pack::decode_stream(stream, sender)` consumes `ReaderStream` under Tokio.
28//! - Parallel encode: `encode_async` / `parallel_encode` build packs from many objects.
29//!
30//! Test Data
31//! - Located under `tests/data/`, includes real pack files and object sets.
32
33mod delta;
34pub mod diff;
35pub mod errors;
36pub mod hash;
37pub mod internal;
38pub mod protocol;
39pub mod utils;
40mod zstdelta;
41
42// Core traits and types that external users need to implement/use
43pub use diff::{Diff, DiffItem};
44pub use protocol::{
45    AuthenticationService, GitProtocol, ProtocolError, RepositoryAccess, ServiceType,
46};