Trait mz_catalog::durable::DurableCatalogState

source ·
pub trait DurableCatalogState: ReadOnlyDurableCatalogState {
    // Required methods
    fn is_read_only(&self) -> bool;
    fn is_savepoint(&self) -> bool;
    fn mark_bootstrap_complete(&mut self);
    fn transaction<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Transaction<'_>, CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn commit_transaction<'life0, 'async_trait>(
        &'life0 mut self,
        txn_batch: TransactionBatch,
        commit_ts: Timestamp,
    ) -> Pin<Box<dyn Future<Output = Result<Timestamp, CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn confirm_leadership<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CatalogError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn allocate_id<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        id_type: &'life1 str,
        amount: u64,
        commit_ts: Timestamp,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn allocate_user_id<'life0, 'async_trait>(
        &'life0 mut self,
        commit_ts: Timestamp,
    ) -> Pin<Box<dyn Future<Output = Result<(CatalogItemId, GlobalId), CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn allocate_user_cluster_id<'life0, 'async_trait>(
        &'life0 mut self,
        commit_ts: Timestamp,
    ) -> Pin<Box<dyn Future<Output = Result<ClusterId, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A read-write API for the durable catalog state.

Required Methods§

source

fn is_read_only(&self) -> bool

Returns true if the catalog is opened in read only mode, false otherwise.

source

fn is_savepoint(&self) -> bool

Returns true if the catalog is opened is savepoint mode, false otherwise.

source

fn mark_bootstrap_complete(&mut self)

Marks the bootstrap process as complete.

source

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

Creates a new durable catalog state transaction.

source

fn commit_transaction<'life0, 'async_trait>( &'life0 mut self, txn_batch: TransactionBatch, commit_ts: Timestamp, ) -> Pin<Box<dyn Future<Output = Result<Timestamp, CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Commits a durable catalog state transaction. The transaction will be committed at commit_ts.

Returns what the upper was directly after the transaction committed.

Panics if commit_ts is not greater than or equal to the most recent upper seen by this process.

source

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

Confirms that this catalog is connected as the current leader.

NB: We may remove this in later iterations of Pv2.

Provided Methods§

source

fn allocate_id<'life0, 'life1, 'async_trait>( &'life0 mut self, id_type: &'life1 str, amount: u64, commit_ts: Timestamp, ) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, CatalogError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allocates and returns amount IDs of id_type.

See Self::commit_transaction for details on commit_ts.

source

fn allocate_user_id<'life0, 'async_trait>( &'life0 mut self, commit_ts: Timestamp, ) -> Pin<Box<dyn Future<Output = Result<(CatalogItemId, GlobalId), CatalogError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Allocates and returns both a user CatalogItemId and GlobalId.

See Self::commit_transaction for details on commit_ts.

source

fn allocate_user_cluster_id<'life0, 'async_trait>( &'life0 mut self, commit_ts: Timestamp, ) -> Pin<Box<dyn Future<Output = Result<ClusterId, CatalogError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Allocates and returns a user ClusterId.

See Self::commit_transaction for details on commit_ts.

Implementors§