pub struct PersistenceEngine { /* private fields */ }Expand description
The persistence engine — wraps KanbanStore + RelationsStore with dirty tracking, atomic saves (via arrow-graph-git), and graph-native commits.
Implementations§
Source§impl PersistenceEngine
impl PersistenceEngine
Sourcepub fn new(config: PersistenceConfig) -> Self
pub fn new(config: PersistenceConfig) -> Self
Create a new persistence engine with the given config.
Sourcepub fn mark_dirty(&mut self)
pub fn mark_dirty(&mut self)
Mark state as dirty (a mutation occurred).
Sourcepub fn periodic_save_due(&self) -> bool
pub fn periodic_save_due(&self) -> bool
Check if a periodic save is due.
Sourcepub fn git_backup_due(&self) -> bool
pub fn git_backup_due(&self) -> bool
Check if a graph-native commit is due.
Sourcepub fn save(
&mut self,
store: &KanbanStore,
relations: &RelationsStore,
) -> Result<SaveMetrics>
pub fn save( &mut self, store: &KanbanStore, relations: &RelationsStore, ) -> Result<SaveMetrics>
Save the kanban state to Parquet atomically.
Delegates to persist::save_all() which uses arrow-graph-git::save_named_batches()
for crash-safe atomic writes with WAL protection.
Sourcepub fn git_backup(&mut self, item_count: usize) -> Result<GitBackupMetrics>
pub fn git_backup(&mut self, item_count: usize) -> Result<GitBackupMetrics>
Create a graph-native commit for the audit trail.
Replaces shell git add + git commit with a CommitsTable entry
persisted as JSON. History is queryable via commits().
Sourcepub fn load_commits(&mut self) -> Result<()>
pub fn load_commits(&mut self) -> Result<()>
Load commit history from disk (call after startup).
Sourcepub fn commits(&self) -> &CommitsTable
pub fn commits(&self) -> &CommitsTable
Get the commit history (graph-native audit trail).
Sourcepub fn check_wal_recovery(root: &Path) -> Result<bool>
pub fn check_wal_recovery(root: &Path) -> Result<bool>
Check for and recover from an incomplete save (WAL present on startup).
If a WAL file exists, the previous save was interrupted. The Parquet files may be in an inconsistent state. Since we use atomic file replacement (write .tmp then rename), the old files are still valid. Remove the WAL and proceed — the old state is correct.
Sourcepub fn shutdown(
&mut self,
store: &KanbanStore,
relations: &RelationsStore,
) -> Result<()>
pub fn shutdown( &mut self, store: &KanbanStore, relations: &RelationsStore, ) -> Result<()>
Graceful shutdown — save state before exit.
Sourcepub fn health(
&self,
store: &KanbanStore,
relations: &RelationsStore,
) -> HealthMetrics
pub fn health( &self, store: &KanbanStore, relations: &RelationsStore, ) -> HealthMetrics
Get current health metrics.