Expand description
The git→mkit import driver (SPEC-GIT-IMPORT §3).
Pure translation engine: reads git objects through a GitSource,
writes serialized mkit objects through an ObjectSink, signs
through caller-supplied callbacks (the crate stays crypto-free —
the CLI passes its CommitSigner), and records sha1→blake3 pairs
plus retained raw commit/tag bytes through caller-supplied hooks.
Everything here is deterministic given (git bytes, signing key, import-spec version): deterministic Ed25519 means the engine can be re-run idempotently and the map is a rebuildable cache under the same key (SPEC-GIT-IMPORT §1.2).
Structs§
- Depth
Memo - Memoized tree heights and tag-chain lengths, keyed by git id. Needed because a map hit skips recursion: a previously-imported LEGAL subtree (or tag chain) re-referenced deeper in a new parent could compose past the normative caps without it.
- Import
Options - Per-run options.
- Import
Signer - Signing callbacks: given the unsigned object (zeroed signature),
return the 64-byte signature. The signer pubkey is supplied
separately so the engine can fill the
signerfield first. - Imported
Ref - Outcome of importing one ref tip.
- Importer
- The import engine.
mapis the sha1→blake3 cache (load it from the state dir; pairs accumulate across calls). - MemGit
Source - In-memory source for tests and golden vectors.
- MemSink
- In-memory sink for tests.
Constants§
- CHUNK_
THRESHOLD - SPEC-GIT-IMPORT §3.1: the normative chunking threshold.
- IMPORT_
SPEC_ VERSION - This implementation’s import-spec version (SPEC-GIT-IMPORT §1.2).
- MAX_
TAG_ CHAIN - SPEC-GIT-IMPORT §3.4: tag→tag chains beyond this depth refuse.
- MAX_
TREE_ DEPTH - Tree nesting cap, matching mkit-core’s
MAX_TREE_DEPTHdefense (the importer is the most untrusted boundary in the system).
Traits§
- GitSource
- Where the driver reads git objects from.
CatFileBatchfor real repositories; an in-memory map for hermetic tests/vectors. - Object
Sink - Where serialized mkit objects land. Implemented for
mkit_core::ObjectStore(per-object fsync) and the CLI’s bulk writer; tests use an in-memory map.
Type Aliases§
- Retain
RawFn - Hook receiving (upstream sha1, framed raw git bytes) for retention.
The explicit lifetime keeps the trait object bound to the
borrower’s scope (a bare
dynalias would default to'static).