Skip to main content

ClusterControllerCtx

Trait ClusterControllerCtx 

Source
pub trait ClusterControllerCtx: Send {
    // Required methods
    fn now(&self) -> Timestamp;
    fn cluster_states<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        clusters: &'life1 [ClusterId],
    ) -> Pin<Box<dyn Future<Output = Vec<ClusterState>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn managed_cluster_ids<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Vec<ClusterId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn apply<'life0, 'async_trait>(
        &'life0 mut self,
        decisions: Vec<Decision>,
    ) -> Pin<Box<dyn Future<Output = ApplyOutcome> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The strategy-agnostic pull/apply interface between the controller and its environment.

The controller depends on exactly this trait. Reads are batched and pulled on demand; the single write applies a tick’s batch under a compare-and-append guard. Implementations marshal these to wherever the live signals live (for v1, the Coordinator’s catalog and compute/storage controllers, reached over a channel from the controller’s own task, hence the Send bound).

Required Methods§

Source

fn now(&self) -> Timestamp

Current wall-clock time, as the controller’s strategies should see it.

Source

fn cluster_states<'life0, 'life1, 'async_trait>( &'life0 mut self, clusters: &'life1 [ClusterId], ) -> Pin<Box<dyn Future<Output = Vec<ClusterState>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A consistent durable view of the given managed clusters and their replicas. Clusters that do not exist or are unmanaged are omitted from the result.

Source

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

The ids of all managed clusters the controller owns this tick.

Source

fn apply<'life0, 'async_trait>( &'life0 mut self, decisions: Vec<Decision>, ) -> Pin<Box<dyn Future<Output = ApplyOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Apply a tick’s batch of decisions under their compare-and-append guards. Each decision carries the ExpectedClusterState it was derived from; the implementation re-reads every target cluster and, if any has since diverged, returns ApplyOutcome::Rejected without transacting anything. Otherwise the batch’s catalog operations are transacted together.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§