Trait mz_storage::client::controller::StorageController
source · [−]pub trait StorageController: Debug + Send {
type Timestamp;
fn collection(
&self,
id: GlobalId
) -> Result<&CollectionState<Self::Timestamp>, StorageError>;
fn collection_mut(
&mut self,
id: GlobalId
) -> Result<&mut CollectionState<Self::Timestamp>, StorageError>;
fn create_collections<'life0, 'async_trait>(
&'life0 mut self,
collections: Vec<(GlobalId, CollectionDescription)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn drop_sources<'life0, 'async_trait>(
&'life0 mut self,
identifiers: Vec<GlobalId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn append<'life0, 'async_trait>(
&'life0 mut self,
commands: Vec<(GlobalId, Vec<Update<Self::Timestamp>>, Self::Timestamp)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn snapshot<'life0, 'async_trait>(
&'life0 mut self,
id: GlobalId,
as_of: Self::Timestamp
) -> Pin<Box<dyn Future<Output = Result<Vec<(Row, Diff)>, StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn set_read_policy<'life0, 'async_trait>(
&'life0 mut self,
policies: Vec<(GlobalId, ReadPolicy<Self::Timestamp>)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn update_write_frontiers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [(GlobalId, ChangeBatch<Self::Timestamp>)]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn update_read_capabilities<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 mut BTreeMap<GlobalId, ChangeBatch<Self::Timestamp>>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn ready<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = ()> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn process<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
}
Required Associated Types
Required Methods
fn collection(
&self,
id: GlobalId
) -> Result<&CollectionState<Self::Timestamp>, StorageError>
fn collection(
&self,
id: GlobalId
) -> Result<&CollectionState<Self::Timestamp>, StorageError>
Acquire an immutable reference to the collection state, should it exist.
fn collection_mut(
&mut self,
id: GlobalId
) -> Result<&mut CollectionState<Self::Timestamp>, StorageError>
fn collection_mut(
&mut self,
id: GlobalId
) -> Result<&mut CollectionState<Self::Timestamp>, StorageError>
Acquire a mutable reference to the collection state, should it exist.
fn create_collections<'life0, 'async_trait>(
&'life0 mut self,
collections: Vec<(GlobalId, CollectionDescription)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_collections<'life0, 'async_trait>(
&'life0 mut self,
collections: Vec<(GlobalId, CollectionDescription)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Create the sources described in the individual CreateSourceCommand commands.
Each command carries the source id, the source description, and any associated metadata needed to ingest the particular source.
This command installs collection state for the indicated sources, and the are
now valid to use in queries at times beyond the initial since
frontiers. Each
collection also acquires a read capability at this frontier, which will need to
be repeatedly downgraded with allow_compaction()
to permit compaction.
fn drop_sources<'life0, 'async_trait>(
&'life0 mut self,
identifiers: Vec<GlobalId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn drop_sources<'life0, 'async_trait>(
&'life0 mut self,
identifiers: Vec<GlobalId>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Drops the read capability for the sources and allows their resources to be reclaimed.
Append updates
into the local input named id
and advance its upper to upper
.
Returns the snapshot of the contents of the local input named id
at as_of
.
fn set_read_policy<'life0, 'async_trait>(
&'life0 mut self,
policies: Vec<(GlobalId, ReadPolicy<Self::Timestamp>)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn set_read_policy<'life0, 'async_trait>(
&'life0 mut self,
policies: Vec<(GlobalId, ReadPolicy<Self::Timestamp>)>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Assigns a read policy to specific identifiers.
The policies are assigned in the order presented, and repeated identifiers should conclude with the last policy. Changing a policy will immediately downgrade the read capability if appropriate, but it will not “recover” the read capability if the prior capability is already ahead of it.
Identifiers not present in policies
retain their existing read policies.
fn update_write_frontiers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [(GlobalId, ChangeBatch<Self::Timestamp>)]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update_write_frontiers<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 [(GlobalId, ChangeBatch<Self::Timestamp>)]
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Accept write frontier updates from the compute layer.
fn update_read_capabilities<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 mut BTreeMap<GlobalId, ChangeBatch<Self::Timestamp>>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update_read_capabilities<'life0, 'life1, 'async_trait>(
&'life0 mut self,
updates: &'life1 mut BTreeMap<GlobalId, ChangeBatch<Self::Timestamp>>
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Applies updates
and sends any appropriate compaction command.
Waits until the controller is ready to process a response.
This method may block for an arbitrarily long time.
When the method returns, the owner should call
StorageController::process
to process the ready message.
This method is cancellation safe.
Processes the work queued by StorageController::ready
.
This method is guaranteed to return “quickly” unless doing so would compromise the correctness of the system.
This method is not guaranteed to be cancellation safe. It must be awaited to completion.