Skip to main content

ProjectionStore

Trait ProjectionStore 

Source
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§

Source

type Txn<'a>: ProjectionTxn where Self: 'a

Required Methods§

Source

fn open(cfg: ProjectionConfig) -> Result<Self>
where Self: Sized,

Open a projection store

Source

fn close(&self) -> Result<()>

Close the store

Source

fn begin_txn(&self) -> Result<Self::Txn<'_>>

Begin a transaction

Source

fn get_cursor(&self) -> Result<EventId>

Get the current cursor (last applied event ID)

Source

fn migrate(&self, target_version: u32) -> Result<()>

Run migrations to target schema version

Source

fn backup_to(&self, path: &Path) -> Result<()>

Create a backup

Source

fn restore_from(path: &Path, cfg: ProjectionConfig) -> Result<Self>
where Self: Sized,

Restore from a backup

Source

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.

Implementors§