Trait mz_catalog::durable::DurableCatalogState

source ·
pub trait DurableCatalogState: ReadOnlyDurableCatalogState {
    // Required methods
    fn is_read_only(&self) -> bool;
    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
    ) -> Pin<Box<dyn Future<Output = Result<(), 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;
    fn get_and_prune_storage_usage<'life0, 'async_trait>(
        &'life0 mut self,
        retention_period: Option<Duration>,
        boot_ts: Timestamp,
        wait_for_consolidation: bool
    ) -> Pin<Box<dyn Future<Output = Result<Vec<VersionedStorageUsage>, 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
    ) -> 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_system_ids<'life0, 'async_trait>(
        &'life0 mut self,
        amount: u64
    ) -> Pin<Box<dyn Future<Output = Result<Vec<GlobalId>, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn allocate_user_id<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<GlobalId, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn allocate_user_cluster_id<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<ClusterId, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn allocate_user_replica_id<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<ReplicaId, CatalogError>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'life0: 'async_trait { ... }
    fn allocate_system_replica_id<'life0, 'async_trait>(
        &'life0 mut self
    ) -> Pin<Box<dyn Future<Output = Result<ReplicaId, 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 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 ) -> Pin<Box<dyn Future<Output = Result<(), CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Commits a durable catalog state transaction.

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.

source

fn get_and_prune_storage_usage<'life0, 'async_trait>( &'life0 mut self, retention_period: Option<Duration>, boot_ts: Timestamp, wait_for_consolidation: bool ) -> Pin<Box<dyn Future<Output = Result<Vec<VersionedStorageUsage>, CatalogError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets all storage usage events and permanently deletes from the catalog those that happened more than the retention period ago from boot_ts.

Results are guaranteed to be sorted by ID.

Provided Methods§

source

fn allocate_id<'life0, 'life1, 'async_trait>( &'life0 mut self, id_type: &'life1 str, amount: u64 ) -> 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.

source

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

Allocates and returns amount system GlobalIds.

source

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

Allocates and returns a user GlobalId.

source

fn allocate_user_cluster_id<'life0, 'async_trait>( &'life0 mut self ) -> 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.

source

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

Allocates and returns a user ReplicaId.

source

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

Allocates and returns a system ReplicaId.

Implementors§