Expand description
§turbovault-git — git-native write substrate
Every vault mutation is a git commit built from plumbing — blobs written to
the object DB, a tree assembled in an isolated/ephemeral index (never the
shared .git/index), a commit-tree, and a compare-and-swap ref advance
— then materialized into the working tree. Git history is the rollback/audit
log; update-ref CAS is the cross-process serialization primitive.
Design: git-write-substrate-architecture.md. This crate replaces the
legacy VaultManager write path (mutators, batch executor, path-lock
registry, audit/snapshot rollback).
Layers (built bottom-up):
VaultRepo— repo handle + detection + branch/HEAD resolution (GWS.1).TreeChange+build_tree/commit_tree— object-DB plumbing (GWS.2).cas_ref/commit_with_retry— ref compare-and-swap + optimistic rebuild-on-conflict (GWS.3).- (next) per-file precondition, materialization, changesets (GWS.4+).
Structs§
- Changeset
- A unit of change applied as a single commit.
- Changeset
Result - Outcome of a committed changeset.
- Commit
Locks - A process-wide registry of per-worktree commit mutexes. Share one
Arcacross everyVaultReposo handles to the same worktree serialize. - Fanout
Info - Stateless handle to an open fan-out scratch worktree — everything needed
to merge OR abandon the fan-out later, without holding a borrowed
FanoutWorktreeacross the wait (e.g. between MCP tool calls). - Fanout
Worktree - An open fan-out scratch worktree. Hold txns through
worktree_repo(); finalize viacommit_fanout(merge back) orabandon_fanout(discard). - Merge
Back Result - Result of a successful merge-back.
- Oid
- Re-exported so substrate consumers (e.g.
turbovault-tools) can talk about blob/commit oids without taking a directgit2dep — preserves the substrate’s role as the only crate that knows about libgit2. Unique identity of any object (commit, tree, blob, tag). - Orphan
Fanout - One fan-out artifact (
wip-<id>worktree +wip/<id>branch) found on disk byVaultRepo::list_orphan_fanouts. Whether a given entry is truly “orphan” — i.e. not tracked by a live caller — is a server-layer concern; the substrate just enumerates. - Precondition
- A precondition on one path: the blob oid the caller expects to find in the
base tree.
expected == Noneasserts the path is absent (a create). - Vault
Repo - A handle to the git repository backing a vault.
Enums§
- Error
- Errors from the git write substrate.
- Merge
Strategy - How a fan-out merges back into main.
- Tree
Change - A single change to apply to a tree. Moves are modeled at the op-mapping layer
(GWS.8) as
Remove(old)+Upsert(new).
Type Aliases§
- Commit
Hook - Callback fired by
VaultRepo::commit_changesetafter a successful commit + materialize, inside the commit lock. Arguments are the commit’s first-parent oid (orNonefor the initial commit on an unborn branch) and the new commit oid. - Result
- Result alias for the git write substrate.