Skip to main content

SyncerState

Struct SyncerState 

Source
pub struct SyncerState { /* private fields */ }

Implementations§

Source§

impl SyncerState

Source

pub fn open(dir: PathBuf) -> LeanResult<SyncerState>

Source

pub fn marker_present(&self) -> bool

Source

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.

Source

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.

Source

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.

Source

pub fn drained_path(&self) -> PathBuf

Source

pub fn write_marker(&self) -> LeanResult<()>

Written LAST at checkout: the agent-start gate.

Source

pub fn load_baseline(&self) -> LeanResult<Baseline>

Source

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.

Source

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.

Source

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.

Source

pub fn load_scope_intent(&self) -> LeanResult<Option<ScopeIntent>>

Read a rescope in flight. None = none in flight.

Source

pub fn save_scope_intent(&self, intent: &ScopeIntent) -> LeanResult<()>

Source

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.

Source

pub fn load_incarnation(&self) -> LeanResult<Option<Incarnation>>

Source

pub fn save_incarnation(&self, i: &Incarnation) -> LeanResult<()>

Source

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).

Source

pub fn save_foreign_queue(&self, q: &[ForeignChange]) -> LeanResult<()>

Source

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.

Source

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.

Source

pub fn load_intent(&self) -> LeanResult<IntentJournal>

Source

pub fn save_intent(&self, j: &IntentJournal) -> LeanResult<()>

Source

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).

Source

pub fn append_conflict(&self, c: &ConflictRecord) -> LeanResult<()>

Source

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.

Source

pub fn load_conflicts(&self) -> LeanResult<Vec<ConflictRecord>>

The rotated generation first, then the live one: oldest to newest, unbroken across a single rotation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.