Struct mz_controller::Controller
source · pub struct Controller<T = Timestamp> {
pub storage: Box<dyn StorageController<Timestamp = T>>,
pub compute: ComputeController<T>,
/* private fields */
}
Expand description
A client that maintains soft state and validates commands, in addition to forwarding them.
Fields§
§storage: Box<dyn StorageController<Timestamp = T>>
§compute: ComputeController<T>
Implementations§
source§impl<T> Controller<T>where
T: Timestamp + Lattice,
ComputeGrpcClient: ComputeClient<T>,
impl<T> Controller<T>where
T: Timestamp + Lattice,
ComputeGrpcClient: ComputeClient<T>,
sourcepub fn create_cluster(
&mut self,
id: ClusterId,
config: ClusterConfig
) -> Result<(), Error>
pub fn create_cluster(
&mut self,
id: ClusterId,
config: ClusterConfig
) -> Result<(), Error>
Creates a cluster with the specified identifier and configuration.
A cluster is a combination of a storage instance and a compute instance. A cluster has zero or more replicas; each replica colocates the storage and compute layers on the same physical resources.
sourcepub fn drop_cluster(&mut self, id: ClusterId)
pub fn drop_cluster(&mut self, id: ClusterId)
sourcepub async fn create_replicas(
&mut self,
replicas: Vec<(ClusterId, ReplicaId, ClusterRole, ReplicaConfig)>
) -> Result<(), Error>
pub async fn create_replicas(
&mut self,
replicas: Vec<(ClusterId, ReplicaId, ClusterRole, ReplicaConfig)>
) -> Result<(), Error>
Creates a replica of the specified cluster with the specified identifier and configuration.
This method is NOT idempotent; It can fail between processing of different
replicas and leave the controller in an inconsistent state. It is almost
always wrong to do anything but abort the process on Err
.
sourcepub async fn drop_replica(
&mut self,
cluster_id: ClusterId,
replica_id: ReplicaId
) -> Result<(), Error>
pub async fn drop_replica(
&mut self,
cluster_id: ClusterId,
replica_id: ReplicaId
) -> Result<(), Error>
Drops the specified replica of the specified cluster.
sourcepub async fn remove_orphaned_replicas(
&mut self,
next_replica_id: ReplicaId
) -> Result<(), Error>
pub async fn remove_orphaned_replicas(
&mut self,
next_replica_id: ReplicaId
) -> Result<(), Error>
Remove orphaned replicas.
pub fn events_stream(&self) -> BoxStream<'static, ClusterEvent>
source§impl<T> Controller<T>
impl<T> Controller<T>
pub fn active_compute(&mut self) -> ActiveComputeController<'_, T>
source§impl<T> Controller<T>where
T: Timestamp + Lattice,
ComputeGrpcClient: ComputeClient<T>,
impl<T> Controller<T>where
T: Timestamp + Lattice,
ComputeGrpcClient: ComputeClient<T>,
sourcepub fn initialization_complete(&mut self)
pub fn initialization_complete(&mut self)
Marks the end of any initialization commands.
The implementor may wait for this method to be called before implementing prior commands, and so it is important for a user to invoke this method as soon as it is comfortable. This method can be invoked immediately, at the potential expense of performance.
sourcepub async fn ready(&mut self)
pub async fn ready(&mut self)
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 Controller::ready
to
process the ready message.
This method is cancellation safe.
sourcepub async fn process(&mut self) -> Result<Option<ControllerResponse<T>>, Error>
pub async fn process(&mut self) -> Result<Option<ControllerResponse<T>>, Error>
Processes the work queued by Controller::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.
sourcepub fn recent_timestamp(
&self,
source_ids: impl Iterator<Item = GlobalId>
) -> BoxFuture<'static, T>
pub fn recent_timestamp(
&self,
source_ids: impl Iterator<Item = GlobalId>
) -> BoxFuture<'static, T>
Produces a timestamp that reflects all data available in
source_ids
at the time of the function call.
source§impl<T> Controller<T>where
T: Timestamp + Lattice + TotalOrder + TryInto<i64> + TryFrom<i64> + Codec64 + Unpin + From<EpochMillis> + TimestampManipulation,
<T as TryInto<i64>>::Error: Debug,
<T as TryFrom<i64>>::Error: Debug,
StorageCommand<T>: RustType<ProtoStorageCommand>,
StorageResponse<T>: RustType<ProtoStorageResponse>,
Controller<T>: StorageController<Timestamp = T>,
impl<T> Controller<T>where
T: Timestamp + Lattice + TotalOrder + TryInto<i64> + TryFrom<i64> + Codec64 + Unpin + From<EpochMillis> + TimestampManipulation,
<T as TryInto<i64>>::Error: Debug,
<T as TryFrom<i64>>::Error: Debug,
StorageCommand<T>: RustType<ProtoStorageCommand>,
StorageResponse<T>: RustType<ProtoStorageResponse>,
Controller<T>: StorageController<Timestamp = T>,
sourcepub async fn new(config: ControllerConfig, envd_epoch: NonZeroI64) -> Self
pub async fn new(config: ControllerConfig, envd_epoch: NonZeroI64) -> Self
Creates a new controller.
Auto Trait Implementations§
impl<T = Timestamp> !RefUnwindSafe for Controller<T>
impl<T> Send for Controller<T>where
T: Send,
impl<T = Timestamp> !Sync for Controller<T>
impl<T> Unpin for Controller<T>where
T: Unpin,
impl<T = Timestamp> !UnwindSafe for Controller<T>
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.