Skip to main content

Crate mkit_core

Crate mkit_core 

Source
Expand description

§mkit-core

Content-addressed VCS primitives for mkit: BLAKE3 hashing, canonical objects, refs, packs, and the transport trait every backend implements.

The byte layout this crate produces is defined, normatively, in docs/specs/SPEC-OBJECTS.md (version 0x01, magic "MKT1") — any change here must update the spec in the same PR. The crate depends only on std: no serde, no anyhow, no panics on unchecked input.

§What’s in here

  • hash / object — BLAKE3 hashing and the canonical v1 byte encoding for blobs, trees, commits, remixes, and chunked blobs.
  • pack / index — packfile format and the index over it.
  • refs — ref storage semantics shared by every transport.
  • store — the on-disk object store (worktree, .mkit/ layout, ignore, repo_lock).
  • sign — Ed25519 signing/verification for commits and remixes (see docs/specs/SPEC-SIGNING.md).
  • protocol — the Transport trait (list_refs, read_ref, write_ref, pack_exists, download_pack, upload_pack) every mkit-transport-* crate implements.
  • chunker / deltaFastCDC content-defined chunking and delta encoding for large blobs.
  • ops — the higher-level repository operations (commit, merge, rebase, cherry-pick, …) mkit-cli drives.

Optional features (history-mmr, sparse-checkout, pack-shards) gate heavier commonware-*-backed paths — see the crate’s Cargo.toml for what each pulls in.

mkit-core — BLAKE3 hashing and canonical v1 object byte format.

The byte layout implemented here is defined, normatively, in docs/specs/SPEC-OBJECTS.md (version 0x01, magic "MKT1"). Any change to this crate MUST update the spec in the same PR.

The library depends on std to keep the code readable. No serde, no anyhow, no panics on unchecked input.

Re-exports§

pub use sparse::MAX_FILTER_PATHS as SPARSE_MAX_FILTER_PATHS;
pub use sparse::MAX_LEAVES as SPARSE_MAX_LEAVES;
pub use sparse::SPARSE_CACHE_DIR;
pub use sparse::SPARSE_CACHE_MAGIC;
pub use sparse::SPARSE_CACHE_VERSION;
pub use sparse::SPARSE_WIRE_MAGIC;
pub use sparse::SPARSE_WIRE_MAX_BYTES;
pub use sparse::SPARSE_WIRE_VERSION;
pub use sparse::SparseError;
pub use sparse::SparseManifest;
pub use sparse::SparseProof;
pub use sparse::SparseResponse;
pub use sparse::SparseWireError;
pub use sparse::build_sparse;
pub use sparse::decode_sparse_cache;
pub use sparse::decode_sparse_response;
pub use sparse::encode_sparse_cache;
pub use sparse::encode_sparse_response;
pub use sparse::hash_filter;
pub use sparse::verify_sparse;
pub use hash::HASH_LEN;
pub use hash::HEX_LEN;
pub use hash::Hash;
pub use hash::Hasher;
pub use hash::to_hex;
pub use hash::to_hex_bytes;
pub use object::Blob;
pub use object::ChunkedBlob;
pub use object::Commit;
pub use object::Delta;
pub use object::EntryMode;
pub use object::IDENTITY_MAX_LEN;
pub use object::Identity;
pub use object::IdentityKind;
pub use object::MAGIC;
pub use object::MkitError;
pub use object::Object;
pub use object::ObjectType;
pub use object::Remix;
pub use object::RemixSource;
pub use object::SCHEMA_VERSION;
pub use object::TAG_NAME_MAX_LEN;
pub use object::Tag;
pub use object::Tree;
pub use object::TreeEntry;
pub use serialize::deserialize;
pub use serialize::serialize;
pub use sign::COMMIT_DOMAIN;
pub use sign::KeyPair;
pub use sign::PublicKey;
pub use sign::REMIX_DOMAIN;
pub use sign::SecretSeed;
pub use sign::Signature;
pub use sign::TAG_DOMAIN;
pub use sign::commit_signing_bytes;
pub use sign::commit_signing_hash;
pub use sign::remix_signing_bytes;
pub use sign::remix_signing_hash;
pub use sign::sign_commit;
pub use sign::sign_remix;
pub use sign::sign_tag;
pub use sign::tag_signing_bytes;
pub use sign::tag_signing_hash;
pub use sign::verify;
pub use sign::verify_commit;
pub use sign::verify_remix;
pub use sign::verify_tag;
pub use store::MAX_RAW_OBJECT_SIZE;
pub use store::MAX_TREE_DEPTH;
pub use store::MKIT_DIR;
pub use store::OBJECTS_DIR;
pub use store::ObjectStore;
pub use store::StoreError;
pub use store::StoreResult;
pub use chunker::AVG_SIZE as CHUNK_AVG_SIZE;
pub use chunker::ChunkBoundary;
pub use chunker::ChunkIterator;
pub use chunker::FastCdc;
pub use chunker::MASK_L as CHUNK_MASK_L;
pub use chunker::MASK_S as CHUNK_MASK_S;
pub use chunker::MAX_SIZE as CHUNK_MAX_SIZE;
pub use chunker::MIN_SIZE as CHUNK_MIN_SIZE;
pub use chunker::SEED as CHUNK_SEED;
pub use chunker::chunk_boundaries;
pub use chunker::gear_table_digest;
pub use delta::HEADER_LEN as DELTA_HEADER_LEN;
pub use delta::MAX_INSERT_LEN;
pub use delta::OP_COPY;
pub use delta::STREAM_VERSION;
pub use pack::HEADER_LEN as PACK_HEADER_LEN;
pub use pack::MAGIC as PACK_MAGIC;
pub use pack::MAX_ENTRIES as PACK_MAX_ENTRIES;
pub use pack::MAX_TOTAL_PAYLOAD as PACK_MAX_TOTAL_PAYLOAD;
pub use pack::PackError;
pub use pack::PackReader;
pub use pack::PackWriter;
pub use pack::TRAILER_LEN as PACK_TRAILER_LEN;
pub use pack::UnpackReport;
pub use pack::VERSION as PACK_VERSION;
pub use pack::pack_key;
pub use ignore::IgnoreError;
pub use ignore::IgnoreList;
pub use ignore::MAX_IGNORE_FILE_BYTES;
pub use ignore::Pattern;
pub use ignore::glob_match;
pub use index::EntryStatus;
pub use index::INDEX_FILE;
pub use index::Index;
pub use index::IndexEntry;
pub use index::IndexError;
pub use index::IndexResult;
pub use index::MAGIC as INDEX_MAGIC;
pub use index::MAX_INDEX_BYTES;
pub use index::MAX_PATH_LEN;
pub use index::validate_index_path;
pub use layout::RepoLayout;
pub use refs::HEAD_FILE;
pub use refs::HEADS_DIR;
pub use refs::Head;
pub use refs::REFS_DIR;
pub use refs::Ref;
pub use refs::RefError;
pub use refs::RefResult;
pub use refs::RefWriteCondition;
pub use refs::SHALLOW_FILE;
pub use refs::TAGS_DIR;
pub use refs::decode_ref_wire;
pub use refs::encode_ref_wire;
pub use refs::validate_ref_name;
pub use refs::validate_ref_prefix;
pub use repo_lock::DEFAULT_TIMEOUT as LOCK_DEFAULT_TIMEOUT;
pub use repo_lock::LockError;
pub use repo_lock::LockResult;
pub use repo_lock::RepoLock;
pub use worktree::CHUNK_THRESHOLD;
pub use worktree::LoadedBlob;
pub use worktree::MAX_FILE_BYTES;
pub use worktree::WorktreeError;
pub use worktree::WorktreeResult;
pub use worktree::read_blob;
pub use worktree::store_file_object;
pub use protocol::AdvanceOutcome;
pub use protocol::BACKOFF_CAP;
pub use protocol::BACKOFF_INITIAL;
pub use protocol::BACKOFF_MAX_ATTEMPTS;
pub use protocol::BackoffIterator;
pub use protocol::PackKey;
pub use protocol::Transport;
pub use protocol::TransportError;
pub use protocol::TransportResult;
pub use protocol::is_retryable;
pub use protocol::pack_key_from_hex;
pub use ops::CherryPickError;
pub use ops::CherryPickResult;
pub use ops::Conflict;
pub use ops::ConflictKind;
pub use ops::DiffEntry;
pub use ops::DiffError;
pub use ops::DiffKind;
pub use ops::DiffResult;
pub use ops::MergeResult;
pub use ops::StatusEntry;
pub use ops::StatusStaging;
pub use ops::cherry_pick;
pub use ops::cherry_pick;
pub use ops::collect_ancestor_set;
pub use ops::diff_trees;
pub use ops::find_merge_base;
pub use ops::is_ancestor;
pub use ops::merge_trees;
pub use ops::status_diff;

Modules§

batch
Batched-durability object writes.
chunker
FastCDC content-defined chunker.
delta
Delta instruction stream — implements the versioned format required by docs/specs/SPEC-DELTA.md.
hash
BLAKE3 hashing helpers.
history
Append-only commit-history Merkle Mountain Range (MMR).
ignore
.mkitignore / .gitignore glob patterns.
index
Staging-area index.
layout
Repository path layout: the single authority for resolving on-disk state under .mkit/ (issue #493, Phase 0).
merkle
Merkle (BMT) content-addressing for ChunkedBlob and Tree.
object
mkit object types.
ops
mkit_core::ops — high-level history operations on top of the content-addressed object store.
pack
Packfile writer / reader — conformant to docs/specs/SPEC-PACKFILE.md.
pack_shard
Erasure-coded pack delivery via Reed-Solomon shards.
protocol
Cross-transport types: error taxonomy, the Transport trait, the PackKey digest wrapper, and the retry/backoff helpers used by every transport implementation (memory, file, HTTP, S3, SSH, enc). retrying is the single shared driver of the SPEC-TRANSPORT §7 ladder — every transport’s retrying/with_retry method is a thin wrapper around it, so the backoff/classification policy lives in exactly one place instead of being reimplemented per crate.
refs
Refs subsystem.
repo_lock
Repo-level lockfile helper (named repo_lock to avoid collision with std::sync::*Lock).
serialize
Canonical byte (de)serialization for Object.
sign
Ed25519 commit / remix signing.
sparse
Verifiable sparse-checkout (in-process manifest-build + verify core).
store
Local content-addressed object store.
transfer
Transfer-layer helpers: delta-aware pack planning and the packlist discovery wire format.
worktree
Worktree → tree-object builder.