pub trait ProjectionStore: Send + Sync {
type Txn<'a>: ProjectionTxn
where Self: 'a;
// Required methods
fn open(cfg: ProjectionConfig) -> Result<Self>
where Self: Sized;
fn close(&self) -> Result<()>;
fn begin_txn(&self) -> Result<Self::Txn<'_>>;
fn get_cursor(&self) -> Result<EventId>;
fn migrate(&self, target_version: u32) -> Result<()>;
fn backup_to(&self, path: &Path) -> Result<()>;
fn restore_from(path: &Path, cfg: ProjectionConfig) -> Result<Self>
where Self: Sized;
fn schema_version(&self) -> Result<u32>;
}Expand description
Projection store: SQL database for derived tables
Provides:
- Schema management and migrations
- Cursor tracking for event application
- Transactional batch application
- Backup and restore
Required Associated Types§
type Txn<'a>: ProjectionTxn where Self: 'a
Required Methods§
Sourcefn open(cfg: ProjectionConfig) -> Result<Self>where
Self: Sized,
fn open(cfg: ProjectionConfig) -> Result<Self>where
Self: Sized,
Open a projection store
Sourcefn get_cursor(&self) -> Result<EventId>
fn get_cursor(&self) -> Result<EventId>
Get the current cursor (last applied event ID)
Sourcefn restore_from(path: &Path, cfg: ProjectionConfig) -> Result<Self>where
Self: Sized,
fn restore_from(path: &Path, cfg: ProjectionConfig) -> Result<Self>where
Self: Sized,
Restore from a backup
Sourcefn schema_version(&self) -> Result<u32>
fn schema_version(&self) -> Result<u32>
Get the schema version
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.