bookclerk_plugin_abi::backup_ops

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Host-facing backup/restore primitives (Send + Sync).

crate::AdapterDatabaseSession methods are ?Send Cap'n stubs. Library backup orchestration stores a AdapterBackupOps handle so capture/restore can call identity and catalog primitives without emitting dialect SQL.

Item Kind Summary
AdapterBackupOps trait Snapshot / identity / restore hooks implemented by first-party adapters.
SharedAdapterBackupOps type alias Shared handle stored on backup/restore options.

Traits

AdapterBackupOps

pub trait AdapterBackupOps: Send + Sync {
    fn export_identity<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DbIdentityHighWater>>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,;
    fn import_identity<'life0, 'life1, 'async_trait>(
        &'life0 self,
        rows: &'life1 [DbIdentityHighWater],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,;
    fn list_user_relations<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,;
    fn prepare_unit_restore<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,;
    fn drop_user_relations<'life0, 'life1, 'async_trait>(
        &'life0 self,
        names: &'life1 [String],
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,;
    fn assert_restore_constraints<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,;
}

Snapshot / identity / restore hooks implemented by first-party adapters.

AdapterBackupOps::export_identity

fn export_identity<'life0, 'async_trait>(
    &'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<DbIdentityHighWater>>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,

Identity high-water from adapter catalogs (sqlite_sequence, bookclerk_identity).

AdapterBackupOps::import_identity

fn import_identity<'life0, 'life1, 'async_trait>(
    &'life0 self,
    rows: &'life1 [DbIdentityHighWater],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,

Restore identity high-water into adapter catalogs.

AdapterBackupOps::list_user_relations

fn list_user_relations<'life0, 'async_trait>(
    &'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,

User-visible relation names (excludes engine catalogs such as sqlite_*).

AdapterBackupOps::prepare_unit_restore

fn prepare_unit_restore<'life0, 'async_trait>(
    &'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,

Prepare an open restore transaction (SQLite deferred FK checks).

AdapterBackupOps::drop_user_relations

fn drop_user_relations<'life0, 'life1, 'async_trait>(
    &'life0 self,
    names: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,

Drop named user relations (Postgres CASCADE + identity companions).

AdapterBackupOps::assert_restore_constraints

fn assert_restore_constraints<'life0, 'async_trait>(
    &'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
    Self: 'async_trait,
    'life0: 'async_trait,

Fail closed when the restore transaction still has FK violations.

Type aliases

SharedAdapterBackupOps

pub type SharedAdapterBackupOps = Arc<dyn AdapterBackupOps>;

Shared handle stored on backup/restore options.

Generated from crates/bookclerk-plugin-abi at main · View as Markdown