pub struct Cluster<'a, ClusterTag, Id = u32, Con: Consistency = NoConsistency> { /* private fields */ }Expand description
A multi-node location representing a group of identical processes.
Each member of the cluster runs the same dataflow program and is assigned a
unique MemberId that can be used to address it. The number of members
is determined at deployment time rather than at compile time.
The ClusterTag type parameter is a phantom tag used to distinguish between
different clusters in the type system, preventing accidental mixing of
member IDs across clusters. Id is the type of its members’ IDs (see MemberId).
Implementations§
Source§impl<'a, C> Cluster<'a, C>
impl<'a, C> Cluster<'a, C>
Sourcepub fn sim_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimClusterSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)where
T: Serialize + DeserializeOwned,
Available on crate feature sim only.
pub fn sim_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimClusterSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)where
T: Serialize + DeserializeOwned,
sim only.Sets up a MessagePack-encoded simulated input port on this cluster for testing.
Returns a SimClusterSender that sends (member_id, T) messages targeting
specific cluster members, and a Stream<T> received by each member. Use
Cluster::sim_input_with to select another codec.
This method is generic over the Ordering
and Retries guarantees of the produced
stream, mirroring Location::sim_input. For
unordered inputs (e.g. anything downstream of a NoOrder network channel), create the
input with O = NoOrder and drive it with
SimClusterSender::send_many_unordered.
Sourcepub fn sim_input_with<Codec: SimCodec<T>, T, O: Ordering, R: Retries>(
&self,
) -> (SimClusterSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)
Available on crate feature sim only.
pub fn sim_input_with<Codec: SimCodec<T>, T, O: Ordering, R: Retries>( &self, ) -> (SimClusterSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)
sim only.Sets up a simulated input port on this cluster using the codec Codec.
Returns a SimClusterSender that sends (member_id, T) messages targeting
specific cluster members, and a Stream<T> received by each member. The codec is a
type parameter; the message, ordering and retries types are usually inferred:
cluster.sim_input_with::<MyCodec, _, _, _>(). Custom codecs implement
SimCodec, which documents where they must be
defined. See Cluster::sim_input for the ordering and retries guarantees.
Trait Implementations§
Source§impl<C, Con: Consistency, Id> Clone for Cluster<'_, C, Id, Con>
impl<C, Con: Consistency, Id> Clone for Cluster<'_, C, Id, Con>
Source§impl<C, Con: Consistency, Id> Debug for Cluster<'_, C, Id, Con>
impl<C, Con: Consistency, Id> Debug for Cluster<'_, C, Id, Con>
impl<C, Con: Consistency, Id> Eq for Cluster<'_, C, Id, Con>
Source§impl<'a, C, Con: Consistency, Id> Location<'a> for Cluster<'a, C, Id, Con>
impl<'a, C, Con: Consistency, Id> Location<'a> for Cluster<'a, C, Id, Con>
Source§type SimHookScope = OnCluster<C>
type SimHookScope = OnCluster<C>
crate::sim_hooks) bindable to
unsafe operators at this location: OnProcess<P> for a Process<P>
root, OnCluster<C> for a Cluster<C> root. Operators name this in
their NonDet hook payload, so a handle can only bind to a matching location
kind.Source§type DropConsistency = Cluster<'a, C, Id>
type DropConsistency = Cluster<'a, C, Id>
Source§fn consistency() -> Option<ClusterConsistency>
fn consistency() -> Option<ClusterConsistency>
Source§fn drop_consistency(&self) -> Self::DropConsistency
fn drop_consistency(&self) -> Self::DropConsistency
Source§fn with_consistency_of<L2: Location<'a, DropConsistency = Self::DropConsistency>>(
&self,
) -> L2
fn with_consistency_of<L2: Location<'a, DropConsistency = Self::DropConsistency>>( &self, ) -> L2
Source§fn id(&self) -> LocationId
fn id(&self) -> LocationId
Source§fn spin(&self) -> Stream<(), Self, Unbounded, TotalOrder, ExactlyOnce>
fn spin(&self) -> Stream<(), Self, Unbounded, TotalOrder, ExactlyOnce>
(). Read moreSource§fn source_stream<T, E>(
&self,
e: impl QuotedWithContext<'a, E, Self>,
) -> Stream<T, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>
fn source_stream<T, E>( &self, e: impl QuotedWithContext<'a, E, Self>, ) -> Stream<T, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>
FuturesStream]. Read moreSource§fn source_iter<T, E>(
&self,
e: impl QuotedWithContext<'a, E, Self>,
) -> Stream<T, Self::DropConsistency, Bounded, TotalOrder, ExactlyOnce>where
E: IntoIterator<Item = T>,
Self: Sized,
fn source_iter<T, E>(
&self,
e: impl QuotedWithContext<'a, E, Self>,
) -> Stream<T, Self::DropConsistency, Bounded, TotalOrder, ExactlyOnce>where
E: IntoIterator<Item = T>,
Self: Sized,
Source§fn source_cluster_members<C: 'a, Id: Clone + 'a>(
&self,
cluster: &Cluster<'a, C, Id>,
nondet_start: NonDet,
) -> KeyedStream<MemberId<C, Id>, MembershipEvent, Self::DropConsistency, Unbounded>
fn source_cluster_members<C: 'a, Id: Clone + 'a>( &self, cluster: &Cluster<'a, C, Id>, nondet_start: NonDet, ) -> KeyedStream<MemberId<C, Id>, MembershipEvent, Self::DropConsistency, Unbounded>
use .source_cluster_membership_stream(…) instead
Source§fn source_cluster_membership_stream<C: 'a, Id: Clone + 'a>(
&self,
cluster: &Cluster<'a, C, Id>,
_nondet_start: NonDet,
) -> KeyedStream<MemberId<C, Id>, MembershipEvent, Self::DropConsistency, Unbounded>
fn source_cluster_membership_stream<C: 'a, Id: Clone + 'a>( &self, cluster: &Cluster<'a, C, Id>, _nondet_start: NonDet, ) -> KeyedStream<MemberId<C, Id>, MembershipEvent, Self::DropConsistency, Unbounded>
Source§fn source_external_bytes<L>(
&self,
from: &External<'_, L>,
) -> (ExternalBytesPort, Stream<BytesMut, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>)
fn source_external_bytes<L>( &self, from: &External<'_, L>, ) -> (ExternalBytesPort, Stream<BytesMut, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>)
tokio only.Source§fn source_external_bincode<L, T, O: Ordering, R: Retries>(
&self,
from: &External<'_, L>,
) -> (ExternalBincodeSink<T, NotMany, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
fn source_external_bincode<L, T, O: Ordering, R: Retries>( &self, from: &External<'_, L>, ) -> (ExternalBincodeSink<T, NotMany, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
tokio only.Source§fn sim_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimSender<T, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
fn sim_input<T, O: Ordering, R: Retries>( &self, ) -> (SimSender<T, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
sim only.Source§fn sim_input_with<C: SimCodec<T>, T, O: Ordering, R: Retries>(
&self,
) -> (SimSender<T, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
fn sim_input_with<C: SimCodec<T>, T, O: Ordering, R: Retries>( &self, ) -> (SimSender<T, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
sim only.C. Read moreSource§fn embedded_input<T, O: Ordering, R: Retries>(
&self,
name: impl Into<String>,
) -> Stream<T, Self::DropConsistency, Unbounded, O, R>
fn embedded_input<T, O: Ordering, R: Retries>( &self, name: impl Into<String>, ) -> Stream<T, Self::DropConsistency, Unbounded, O, R>
Source§fn embedded_singleton_input<T>(
&self,
name: impl Into<String>,
) -> Singleton<T, Self::DropConsistency, Bounded>
fn embedded_singleton_input<T>( &self, name: impl Into<String>, ) -> Singleton<T, Self::DropConsistency, Bounded>
Source§fn bind_single_client<L, T, Codec: Encoder<T> + Decoder>(
&self,
from: &External<'_, L>,
port_hint: NetworkHint,
) -> (ExternalBytesPort<NotMany>, Stream<<Codec as Decoder>::Item, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<T, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>>)
fn bind_single_client<L, T, Codec: Encoder<T> + Decoder>( &self, from: &External<'_, L>, port_hint: NetworkHint, ) -> (ExternalBytesPort<NotMany>, Stream<<Codec as Decoder>::Item, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<T, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>>)
tokio only.External handle. Returns a port handle for the external
process to connect to, a stream of incoming messages, and a handle to send outgoing
messages. Read moreSource§fn bind_single_client_bincode<L, InT: DeserializeOwned, OutT: Serialize>(
&self,
from: &External<'_, L>,
) -> (ExternalBincodeBidi<InT, OutT, NotMany>, Stream<InT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>>)
fn bind_single_client_bincode<L, InT: DeserializeOwned, OutT: Serialize>( &self, from: &External<'_, L>, ) -> (ExternalBincodeBidi<InT, OutT, NotMany>, Stream<InT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>>)
tokio only.Source§fn bidi_external_many_bytes<L, T, Codec: Encoder<T> + Decoder>(
&self,
from: &External<'_, L>,
port_hint: NetworkHint,
) -> (ExternalBytesPort<Many>, KeyedStream<u64, <Codec as Decoder>::Item, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, T, Self::DropConsistency, Unbounded, NoOrder, ExactlyOnce>>)
fn bidi_external_many_bytes<L, T, Codec: Encoder<T> + Decoder>( &self, from: &External<'_, L>, port_hint: NetworkHint, ) -> (ExternalBytesPort<Many>, KeyedStream<u64, <Codec as Decoder>::Item, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, T, Self::DropConsistency, Unbounded, NoOrder, ExactlyOnce>>)
tokio only.Source§fn bidi_external_many_bincode<L, InT: DeserializeOwned, OutT: Serialize>(
&self,
from: &External<'_, L>,
) -> (ExternalBincodeBidi<InT, OutT, Many>, KeyedStream<u64, InT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, OutT, Self::DropConsistency, Unbounded, NoOrder, ExactlyOnce>>)
fn bidi_external_many_bincode<L, InT: DeserializeOwned, OutT: Serialize>( &self, from: &External<'_, L>, ) -> (ExternalBincodeBidi<InT, OutT, Many>, KeyedStream<u64, InT, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, OutT, Self::DropConsistency, Unbounded, NoOrder, ExactlyOnce>>)
tokio only.Source§fn sidecar_bidi<InT: 'static, OutT: 'static, F>(
&self,
sidecar: impl QuotedWithContext<'a, F, Self>,
) -> (Stream<InT, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self, Unbounded, NoOrder, ExactlyOnce>>)
fn sidecar_bidi<InT: 'static, OutT: 'static, F>( &self, sidecar: impl QuotedWithContext<'a, F, Self>, ) -> (Stream<InT, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self, Unbounded, NoOrder, ExactlyOnce>>)
Source§fn singleton<T>(
&self,
e: impl QuotedWithContext<'a, T, Self>,
) -> Singleton<T, Self::DropConsistency, Bounded>where
Self: Sized,
fn singleton<T>(
&self,
e: impl QuotedWithContext<'a, T, Self>,
) -> Singleton<T, Self::DropConsistency, Bounded>where
Self: Sized,
Source§fn singleton_future<F>(
&self,
e: impl QuotedWithContext<'a, F, Self>,
) -> Singleton<F::Output, Self::DropConsistency, Bounded>
fn singleton_future<F>( &self, e: impl QuotedWithContext<'a, F, Self>, ) -> Singleton<F::Output, Self::DropConsistency, Bounded>
Source§fn source_interval(
&self,
interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
) -> Stream<(), Self, Unbounded, TotalOrder, AtLeastOnce>
fn source_interval( &self, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, ) -> Stream<(), Self, Unbounded, TotalOrder, AtLeastOnce>
tokio only.() at a fixed interval. Read moreSource§fn source_interval_delayed(
&self,
delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
) -> Stream<(), Self, Unbounded, TotalOrder, AtLeastOnce>
fn source_interval_delayed( &self, delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, ) -> Stream<(), Self, Unbounded, TotalOrder, AtLeastOnce>
tokio only.() at a fixed interval, after an
initial delay. Read moreSource§fn forward_ref<S>(&self) -> (ForwardHandle<'a, S>, S)where
S: CycleCollection<'a, ForwardRef, Location = Self>,
fn forward_ref<S>(&self) -> (ForwardHandle<'a, S>, S)where
S: CycleCollection<'a, ForwardRef, Location = Self>,
Source§impl<C, Con: Consistency, Id> PartialEq for Cluster<'_, C, Id, Con>
impl<C, Con: Consistency, Id> PartialEq for Cluster<'_, C, Id, Con>
impl<'a, C, Con: Consistency, Id> TopLevel<'a> for Cluster<'a, C, Id, Con>
Auto Trait Implementations§
impl<'a, ClusterTag, Id = u32, Con = NoConsistency> !RefUnwindSafe for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id = u32, Con = NoConsistency> !Send for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id = u32, Con = NoConsistency> !Sync for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id = u32, Con = NoConsistency> !UnwindSafe for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id, Con> Forget for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id, Con> Freeze for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id, Con> Move for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id, Con> Unpin for Cluster<'a, ClusterTag, Id, Con>
impl<'a, ClusterTag, Id, Con> UnsafeUnpin for Cluster<'a, ClusterTag, Id, Con>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, L> ContextWithLocation<'a> for Lwhere
L: Location<'a>,
impl<'a, L> ContextWithLocation<'a> for Lwhere
L: Location<'a>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more