Skip to main content

storage/
lib.rs

1// This Source Code Form is subject to the terms of the Mozilla Public
2// License, v. 2.0. If a copy of the MPL was not distributed with this
3// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4// Copyright (c) 2026 2youg1 and the sprawling contributors
5
6//! Effect side of persistence: Ledger on disk, CAS, in-memory derived
7//! views, git checkpoints, queues. Implements kernel ports; holds no
8//! policy.
9
10mod error;
11
12pub use error::StorageError;
13
14mod alias;
15
16pub use alias::{AliasKind, WriteTarget};
17
18mod vfs;
19
20mod real_fs;
21
22mod reserved;
23
24mod jsonl;
25
26pub use jsonl::WriteObserver;
27pub use jsonl::{CheckedLine, LineCheck, LineFault, read_line};
28pub use jsonl::{JsonlLedger, OpenReport, TailTruncation, ledger_segments_at, read_raw_lines_at};
29pub use jsonl::{TailLine, TailLines};
30
31// The projection the Ledger lays down beside each building: one file per
32// room, disposable, read by nobody in the product (`crates/storage/spec/Sessions.lean` ยง8-24).
33mod sessions;
34
35pub use sessions::Sessions;
36
37#[cfg(any(test, feature = "fault"))]
38mod fault_fs;
39
40#[cfg(any(test, feature = "fault"))]
41pub use fault_fs::{FaultFs, FaultPlan, TornTail};
42
43mod bundle;
44
45pub use bundle::{Bundle, MANIFEST, Manifest, open_restored};
46
47mod cas;
48
49pub use cas::{BlockOrigin, Cas};
50
51mod index;
52
53pub use index::LedgerIndex;
54pub use index::LineReader;
55pub use index::Located;
56pub use index::Refreshed;
57
58mod hot;
59
60pub use hot::HotView;
61pub use hot::RECENT_FROZEN;
62pub use hot::RunHot;
63pub use hot::RunPhase;
64pub use hot::RunWaiting;
65
66mod attribution;
67
68pub use attribution::Attribution;
69pub use attribution::AttributionReport;
70pub use attribution::Unpriced;
71
72mod queue;
73
74pub use queue::EventQueue;
75pub use queue::QueueItem;
76pub use queue::QueueLane;
77
78mod chain_audit;
79
80pub use chain_audit::ChainAudit;
81pub use chain_audit::ChainHalt;
82pub use chain_audit::ProofCount;
83pub use chain_audit::Proven;
84pub use chain_audit::audit_chain;
85pub use chain_audit::prove_chain;
86
87mod verified_prefix;
88
89pub use verified_prefix::ProofRecords;
90pub use verified_prefix::line_check_version;
91
92mod snapshot;
93
94pub use snapshot::ChainSnapshot;
95pub use snapshot::SnapshotFit;
96pub use snapshot::SnapshotStart;
97pub use snapshot::StoredSnapshot;
98pub use snapshot::WholeFold;
99pub use snapshot::read_snapshot;
100pub use snapshot::start_from_snapshot;
101pub use snapshot::tail_after;
102pub use snapshot::write_snapshot;
103
104mod resident;
105
106pub use resident::RESIDENT_TOTAL_BYTES;
107pub use resident::Resident;
108
109mod digest_cache;
110
111pub use digest_cache::DigestCache;
112
113mod worktree;
114
115pub use worktree::FileWork;
116pub use worktree::Landing;
117pub use worktree::PlannedMerge;
118pub use worktree::WorktreeLease;
119pub use worktree::WorktreeName;
120pub use worktree::Worktrees;
121
122mod checkpoint;
123
124pub use checkpoint::ModelChoice;
125pub use checkpoint::Provenance;
126pub use checkpoint::recorded_effort;
127pub use checkpoint::{BaseProgress, Checkpoint};
128
129mod blob;
130mod changes;
131mod hunks;
132mod status;
133
134pub use blob::blob_at;
135pub use changes::{Head, between, parents_of};
136pub use hunks::{FilePatch, PatchLine, Withheld, of_file};
137pub use status::{Drift, WorkingStatus, working_status};