Skip to main content

Crate znippy_plugin_git

Crate znippy_plugin_git 

Source
Expand description

znippy handler for git object stores — the git package format.

One archive holds one git repository (D12: one .znippy per repo). The consumer is gunnar, a pure-Rust git server whose repack() writes the cold tier.

§The two tiers a repository can be stored as

tierdata entrieswhat it preserves
objectsone per object, named by its oid hex, holding its canonical bytes "<type> <size>\0<content>"the oid is checkable by re-hashing the entry
packspack-<id>.pack + pack-<id>.idxthe client’s own deflate and every delta chain

The object tier is the one this format was designed around and is what the __gunnar_* sub-indexes describe. The pack tier is what gunnar actually seals, and the reason is measured: a git object in a pack is already deflated and often a delta, so storing it inflated per oid costs an OpenZL decode plus a fresh zlib deflate on every fetch, for ever, and forecloses pack-copy permanently. gunnar measured an archive of 60000 small git objects at 3.4× larger than its input. See sections::GitIndexBuilder::pack_tier.

§What this format adds on top of a plain archive

column / modulecarries
object_typeblob / tree / commit / tag for the object tier; packfile / pack-index for the pack tier — typed listing with no reads
object_sizecontent length, so quota gates and size analytics are index-only
__gunnar_oid__an stree over the first 8 bytes of every oid → its lookup row
__gunnar_graph__the commit graph as Arrow: oid, parents[], tree, committer_time, generation
__gunnar_reach__per-commit reachability bitmaps (roaring) over object ordinals
__gunnar_refs__ / __gunnar_secrets__the server’s push logs, on either tier

The last three object modules are emitted for the object tier only — a pack carries its own .idx, which is a better oid index than __gunnar_oid__ because it addresses pack offsets.

All of these modules are reserved (znippy_common::is_reserved_module), so znippy list, decompress, the iceberg sink and the manifest readers skip them exactly as they skip the lookup and the trie.

§Laws it honours

P-1 one archive = one ecosystem (--format git); P-2 it writes only the columns it declared; P-3 it is discovered through [meta]; P-4 a malformed or hostile entry never panics — object_type degrades to unknown and the archive still writes.

§Who writes the reserved sections

GitIndexBuilder does, handed to ArrowIpcSink::with_reserved_builder by the writer that knows the object set — gunnar’s repack(). It is deliberately not wired into znippy compress --format git: the CLI’s small-file batch pass never sees objects that take the big-file path, so a CLI-built index would be silently incomplete, and a silently incomplete oid index is worse than none. znippy compress --format git therefore writes the two columns and no reserved sections; znippy run git lookup|graph reads archives that carry them.

Native builtin, registered in znippy-cli/src/handlers.rs::builtin_handlers. Deliberately not a WASM plugin: the oid index’s hot path is stree, which needs AVX2, an mmap and prefetch, none of which wasm offers.

Re-exports§

pub use graph::CommitNode;
pub use graph::decode_graph;
pub use graph::graph_schema;
pub use graph::read_graph;
pub use object::GitHashKind;
pub use object::GitObject;
pub use object::GitObjectKind;
pub use object::PACKFILE_TYPE;
pub use object::PACK_INDEX_TYPE;
pub use object::PackFileKind;
pub use object::canonical;
pub use object::is_oid_path;
pub use object::pack_path_kind;
pub use object::parse_canonical;
pub use object::parse_commit;
pub use object::tree_entries;
pub use oid_index::GitOidIndex;
pub use oid_index::OidEntry;
pub use oid_index::OidHit;
pub use oid_index::key_for_oid;
pub use pushlog::CompactionPolicy;
pub use pushlog::CompactionReport;
pub use pushlog::Finish;
pub use pushlog::PushLog;
pub use pushlog::PushLogScan;
pub use pushlog::scan_frames;
pub use reach::ReachEntry;
pub use reach::ReachPolicy;
pub use reach::decode_reach;
pub use reach::read_reach;
pub use reach::reach_schema;
pub use refs::RefLog;
pub use refs::RefState;
pub use refs::RefUpdate;
pub use refs::read_refs;
pub use refs::refs_schema;
pub use secrets::SecretState;
pub use secrets::SecretUpdate;
pub use secrets::SecretsLog;
pub use secrets::read_secrets;
pub use secrets::secrets_schema;
pub use sections::GitIndexBuilder;

Modules§

graph
__gunnar_graph__ — the commit graph as Arrow.
object
Canonical git object bytes — the unit a git-format znippy archive stores.
oid_index
__gunnar_oid__ — the reserved oid index.
pushlog
The append-only push log: the one mechanism __gunnar_refs__ and __gunnar_secrets__ are both built from.
reach
__gunnar_reach__ — reachability bitmaps.
refs
__gunnar_refs__ — the ref namespace as an append-only Arrow push log.
secrets
__gunnar_secrets__ — per-repository secret material, on the same one-RecordBatch-per-push log as crate::refs.
sections
GitIndexBuilder — turns a set of git objects into the three reserved sections a git-format archive carries.

Structs§

NativeGitPlugin
Native git-object handler.

Constants§

GIT_TYPE_ID
DenseUnion / pkg_type discriminant. Clear of the built-ins (1–25), media (25), skidbladnir (40) and rust-toolchain (41).
UNKNOWN_OBJECT_TYPE
object_type written when the entry is not parseable as a canonical git object. A distinct, queryable state — never a silent blob.