pub mod durability;
pub mod persistence;
mod default;
pub use default::DefaultBlockOrchestrator;
pub use durability::{DurabilityMode, PersistenceSettings};
pub use persistence::PersistenceContext;
use crate::block_journal::SyncPolicy;
use crate::error::StoreResult;
use crate::metrics::StoreMetrics;
use crate::types::{BlockId, Operation, StoreKey as Key, Value};
pub trait BlockOrchestrator: Send + Sync {
fn apply_operations(&self, block_height: BlockId, ops: Vec<Operation>) -> StoreResult<()>;
fn revert_to(&self, block: BlockId) -> StoreResult<()>;
fn fetch(&self, key: Key) -> StoreResult<Value>;
fn fetch_many(&self, keys: &[Key]) -> StoreResult<Vec<Value>>;
fn pop(&self, block_height: BlockId, key: Key) -> StoreResult<Value>;
fn metrics(&self) -> Option<&StoreMetrics>;
fn current_block(&self) -> StoreResult<BlockId>;
fn applied_block_height(&self) -> BlockId;
fn durable_block_height(&self) -> StoreResult<BlockId>;
fn shutdown(&self) -> StoreResult<()>;
fn ensure_healthy(&self) -> StoreResult<()>;
fn record_fatal_error(&self, _block: BlockId, _reason: String) {}
fn set_sync_policy(&self, _policy: SyncPolicy) {
}
fn set_metadata_sync_interval(&self, _sync_every_n_blocks: usize) -> StoreResult<()> {
Ok(())
}
fn flush(&self) -> StoreResult<()> {
Ok(()) }
}