Struct mz_dataflow_types::client::replicated::ActiveReplication
source · [−]pub struct ActiveReplication<T> {
replicas: HashMap<ReplicaId, (UnboundedSender<ComputeCommand<T>>, UnboundedReceiverStream<Result<ComputeResponse<T>, Error>>)>,
peeks: HashMap<Uuid, PendingPeek>,
tails: HashMap<GlobalId, Antichain<T>>,
uppers: HashMap<GlobalId, (Antichain<T>, HashMap<ReplicaId, MutableAntichain<T>>)>,
history: ComputeCommandHistory<T>,
last_command_count: usize,
pending_response: VecDeque<ActiveReplicationResponse<T>>,
}
Expand description
A client backed by multiple replicas.
Fields
replicas: HashMap<ReplicaId, (UnboundedSender<ComputeCommand<T>>, UnboundedReceiverStream<Result<ComputeResponse<T>, Error>>)>
Handles to the replicas themselves.
peeks: HashMap<Uuid, PendingPeek>
Outstanding peek identifiers, to guide responses (and which to suppress).
tails: HashMap<GlobalId, Antichain<T>>
Reported frontier of each in-progress tail.
uppers: HashMap<GlobalId, (Antichain<T>, HashMap<ReplicaId, MutableAntichain<T>>)>
Frontier information, both unioned across all replicas and from each individual replica.
history: ComputeCommandHistory<T>
The command history, used when introducing new replicas or restarting existing replicas.
last_command_count: usize
Most recent count of the volume of unpacked commands (e.g. dataflows in CreateDataflows
).
pending_response: VecDeque<ActiveReplicationResponse<T>>
Responses that should be emitted on the next recv
call.
This is introduced to produce peek cancelation responses eagerly, without awaiting a replica
responding with the response itself, which allows us to compact away the peek in self.history
.
Implementations
sourceimpl<T> ActiveReplication<T> where
T: Timestamp,
impl<T> ActiveReplication<T> where
T: Timestamp,
sourcepub fn add_replica<C: ComputeClient<T> + 'static>(
&mut self,
id: ReplicaId,
client: C
)
pub fn add_replica<C: ComputeClient<T> + 'static>(
&mut self,
id: ReplicaId,
client: C
)
Introduce a new replica, and catch it up to the commands of other replicas.
It is not yet clear under which circumstances a replica can be removed.
pub fn get_replica_ids(&self) -> impl Iterator<Item = ReplicaId> + '_
sourcepub fn remove_replica(&mut self, id: ReplicaId)
pub fn remove_replica(&mut self, id: ReplicaId)
Remove a replica by its identifier.
sourcefn hydrate_replica(&mut self, replica_id: ReplicaId)
fn hydrate_replica(&mut self, replica_id: ReplicaId)
Pipes a command stream at the indicated replica, introducing new dataflow identifiers.
Trait Implementations
sourceimpl<T: Debug> Debug for ActiveReplication<T>
impl<T: Debug> Debug for ActiveReplication<T>
sourceimpl<T> Default for ActiveReplication<T>
impl<T> Default for ActiveReplication<T>
sourceimpl<T> GenericClient<ComputeCommand<T>, ActiveReplicationResponse<T>> for ActiveReplication<T> where
T: Timestamp + Lattice + Debug,
impl<T> GenericClient<ComputeCommand<T>, ActiveReplicationResponse<T>> for ActiveReplication<T> where
T: Timestamp + Lattice + Debug,
sourcefn send<'life0, 'async_trait>(
&'life0 mut self,
cmd: ComputeCommand<T>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 mut self,
cmd: ComputeCommand<T>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The ADAPTER layer’s isolation from COMPUTE depends on the fact that this function is essentially non-blocking, i.e. the ADAPTER blindly awaits calls to this function. This lets the ADAPTER continue operating even in the face of unhealthy or absent replicas.
If this function every become blocking (e.g. making networking calls), the ADAPTER must amend its contract with COMPUTE.
Auto Trait Implementations
impl<T> !RefUnwindSafe for ActiveReplication<T>
impl<T> Send for ActiveReplication<T> where
T: Send,
impl<T> Sync for ActiveReplication<T> where
T: Send + Sync,
impl<T> Unpin for ActiveReplication<T> where
T: Unpin,
impl<T> !UnwindSafe for ActiveReplication<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more