pub struct SyncerState { /* private fields */ }Implementations§
Source§impl SyncerState
impl SyncerState
pub fn open(dir: PathBuf) -> LeanResult<SyncerState>
pub fn marker_present(&self) -> bool
Sourcepub fn sync_tree(&self) -> LeanResult<()>
pub fn sync_tree(&self) -> LeanResult<()>
Flush the filesystem holding the tree (the state dir lives in it) so everything materialised so far is on stable storage.
Sourcepub fn write_drained(&self, seq: Option<u64>, acks: usize) -> LeanResult<()>
pub fn write_drained(&self, seq: Option<u64>, acks: usize) -> LeanResult<()>
The drain’s attestation. seq is the manifest the drain left
installed, when it knows it.
Sourcepub fn clear_drained(&self) -> LeanResult<()>
pub fn clear_drained(&self) -> LeanResult<()>
A fresh incarnation owes its own attestation; a stale one from an earlier life of this tree must not vouch for it.
pub fn drained_path(&self) -> PathBuf
Sourcepub fn write_marker(&self) -> LeanResult<()>
pub fn write_marker(&self) -> LeanResult<()>
Written LAST at checkout: the agent-start gate.
pub fn load_baseline(&self) -> LeanResult<Baseline>
Sourcepub fn save_baseline(&self, b: &Baseline) -> LeanResult<()>
pub fn save_baseline(&self, b: &Baseline) -> LeanResult<()>
COMPACT: the baseline is the other O(files) document, rewritten
on the cadence tick and re-parsed several times per barrier. The
agent-facing O(1) files (gauges, capabilities, acks) stay pretty
— those exist to be cat-ed.
Sourcepub fn load_scope(&self) -> LeanResult<Option<Vec<String>>>
pub fn load_scope(&self) -> LeanResult<Option<Vec<String>>>
What this workspace was admitted to hold, or None for an
unscoped (whole-manifest) checkout.
fs::read directly, with NO exists() pre-check: exists()
answers false for EACCES and EIO alike, and an unreadable scope
answered as “unscoped” is the same class of bug as an unreadable
path answered as “deleted” (barrier.rs, 14b3637c). Only
NotFound means absent.
Sourcepub fn save_scope(&self, scope: Option<&[String]>) -> LeanResult<()>
pub fn save_scope(&self, scope: Option<&[String]>) -> LeanResult<()>
Some writes the admitted set; None REMOVES the document.
Removing matters: a scoped checkout that crashed before its
marker leaves a scope behind, and the whole-tree checkout that
replaces it must not inherit a claim it did not make.
Sourcepub fn load_scope_intent(&self) -> LeanResult<Option<ScopeIntent>>
pub fn load_scope_intent(&self) -> LeanResult<Option<ScopeIntent>>
Read a rescope in flight. None = none in flight.
pub fn save_scope_intent(&self, intent: &ScopeIntent) -> LeanResult<()>
Sourcepub fn clear_scope_intent(&self) -> LeanResult<()>
pub fn clear_scope_intent(&self) -> LeanResult<()>
Cleared LAST, after the new scope is durable. Clearing it first would turn a crash into a workspace whose scope says one thing and whose held set says another, with nothing left to replay.
pub fn load_incarnation(&self) -> LeanResult<Option<Incarnation>>
pub fn save_incarnation(&self, i: &Incarnation) -> LeanResult<()>
Sourcepub fn load_foreign_queue(&self) -> LeanResult<Vec<ForeignChange>>
pub fn load_foreign_queue(&self) -> LeanResult<Vec<ForeignChange>>
The writer-local foreign-change queue. Only NotFound means empty (an unreadable queue answered as empty would strand every change in it).
pub fn save_foreign_queue(&self, q: &[ForeignChange]) -> LeanResult<()>
Sourcepub fn queue_foreign(&self, changes: &[ForeignChange]) -> LeanResult<()>
pub fn queue_foreign(&self, changes: &[ForeignChange]) -> LeanResult<()>
Upsert changes into the foreign queue by path — a later change to
a path replaces the queued one — and save it. Idempotent.
Sourcepub fn requeue_installed_foreign(&self) -> LeanResult<usize>
pub fn requeue_installed_foreign(&self) -> LeanResult<usize>
Move an install’s journalled foreign changes into the queue, if a
restart kept its step 7 from doing so (installed_foreign). The
queue is saved before the journal lets go of them.
pub fn load_intent(&self) -> LeanResult<IntentJournal>
pub fn save_intent(&self, j: &IntentJournal) -> LeanResult<()>
Sourcepub fn clear_intent_keys(&self) -> LeanResult<()>
pub fn clear_intent_keys(&self) -> LeanResult<()>
Clear the per-barrier key list but KEEP the uuid history (the AdoptOwn recognizer needs uuids from completed barriers whose baseline rewrite raced a crash).
pub fn append_conflict(&self, c: &ConflictRecord) -> LeanResult<()>
Sourcepub fn conflicts_dropped(&self) -> LeanResult<u64>
pub fn conflicts_dropped(&self) -> LeanResult<u64>
Records lost to rotation. A caller rendering conflicts owes the user this number: a truncated list that does not say it was truncated reads as a complete one.
Sourcepub fn load_conflicts(&self) -> LeanResult<Vec<ConflictRecord>>
pub fn load_conflicts(&self) -> LeanResult<Vec<ConflictRecord>>
The rotated generation first, then the live one: oldest to newest, unbroken across a single rotation.