pub trait StagingBackend:
Debug
+ Send
+ Sync {
// Required methods
fn stage(&self, write: StagedWrite) -> bool;
fn commit(&self) -> Result<CommitResult, Error>;
fn rollback(&self);
fn pending_count(&self) -> usize;
}Expand description
Trait for staging write operations before committing to the filesystem.
Defined in brainwires-core so that ToolContext can hold an
Arc<dyn StagingBackend> without depending on brainwires-tools,
which would create a circular crate dependency.
The concrete implementation lives in brainwires-tools::transaction::TransactionManager.
Required Methods§
Sourcefn stage(&self, write: StagedWrite) -> bool
fn stage(&self, write: StagedWrite) -> bool
Stage a write operation.
Returns true if newly staged, false if key was already present
(idempotent — same key staged twice is a no-op).
Sourcefn commit(&self) -> Result<CommitResult, Error>
fn commit(&self) -> Result<CommitResult, Error>
Commit all staged writes to the filesystem.
Each staged file is moved (or copied) to its target path atomically. On success the staging queue is cleared.
Sourcefn pending_count(&self) -> usize
fn pending_count(&self) -> usize
Return the number of pending staged writes.