Skip to main content

Cluster

Struct Cluster 

Source
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>

Source

pub fn sim_input<T, O: Ordering, R: Retries>( &self, ) -> (SimClusterSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)

Available on crate feature 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.

Source

pub 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.

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C, Con: Consistency, Id> Debug for Cluster<'_, C, Id, Con>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C, Con: Consistency, Id> Eq for Cluster<'_, C, Id, Con>

Source§

impl<C, Id> IsCluster for Cluster<'_, C, Id>

Source§

type Tag = C

The phantom tag type that distinguishes this cluster from others.
Source§

type Id = Id

The type of the cluster’s member IDs.
Source§

impl<'a, C, Con: Consistency, Id> Location<'a> for Cluster<'a, C, Id, Con>

Source§

type Root = Cluster<'a, C, Id, Con>

The root location type for this location. Read more
Source§

type SimHookScope = OnCluster<C>

The scope of simulator hook handles (see 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>

Location type with consistency guarantees dropped for the live collection on it.
Source§

fn consistency() -> Option<ClusterConsistency>

Gets the runtime enum variant for the current consistency level, if this is a cluster.
Source§

fn root(&self) -> Self::Root

Returns the root location for this location. Read more
Source§

fn drop_consistency(&self) -> Self::DropConsistency

This location but with consistency guarantees dropped for the live collection
Source§

fn with_consistency_of<L2: Location<'a, DropConsistency = Self::DropConsistency>>( &self, ) -> L2

Updates the consistency guarantees to match that of the given location.
Source§

fn try_tick(&self) -> Option<Tick<Self>>

Attempts to create a new Tick clock domain at this location. Read more
Source§

fn id(&self) -> LocationId

Returns the unique identifier for this location.
Source§

fn tick(&self) -> Tick<Self>

Creates a new Tick clock domain at this location. Read more
Source§

fn spin(&self) -> Stream<(), Self, Unbounded, TotalOrder, ExactlyOnce>
where Self: TopLevel<'a> + Sized,

Creates an unbounded stream that continuously emits unit values (). Read more
Source§

fn source_stream<T, E>( &self, e: impl QuotedWithContext<'a, E, Self>, ) -> Stream<T, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>
where E: FuturesStream<Item = T> + Unpin, Self: TopLevel<'a> + Sized,

Creates a stream from an async [FuturesStream]. Read more
Source§

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,

Creates a bounded stream from an iterator. Read more
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>
where Self: TopLevel<'a> + Sized,

👎Deprecated:

use .source_cluster_membership_stream(…) instead

Creates a stream of membership events for a cluster. Read more
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>
where Self: TopLevel<'a> + Sized,

Creates a stream of membership events for a cluster. Read more
Source§

fn source_external_bytes<L>( &self, from: &External<'_, L>, ) -> (ExternalBytesPort, Stream<BytesMut, Self::DropConsistency, Unbounded, TotalOrder, ExactlyOnce>)
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Creates a one-way connection from an external process to receive raw bytes. Read more
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>)
where Self: TopLevel<'a> + Sized, T: Serialize + DeserializeOwned,

Available on crate feature tokio only.
Creates a one-way connection from an external process to receive bincode-serialized data. Read more
Source§

fn sim_input<T, O: Ordering, R: Retries>( &self, ) -> (SimSender<T, O, R>, Stream<T, Self::DropConsistency, Unbounded, O, R>)
where Self: TopLevel<'a> + Sized, T: Serialize + DeserializeOwned,

Available on crate feature sim only.
Sets up a MessagePack-encoded simulated input port on this location for testing. Read more
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>)
where Self: TopLevel<'a> + Sized,

Available on crate feature sim only.
Sets up a simulated input port using the codec C. Read more
Source§

fn embedded_input<T, O: Ordering, R: Retries>( &self, name: impl Into<String>, ) -> Stream<T, Self::DropConsistency, Unbounded, O, R>
where Self: TopLevel<'a> + Sized,

Creates an external input stream for embedded deployment mode. Read more
Source§

fn embedded_singleton_input<T>( &self, name: impl Into<String>, ) -> Singleton<T, Self::DropConsistency, Bounded>
where Self: TopLevel<'a> + Sized,

Creates an embedded singleton input for embedded deployment mode. Read more
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>>)
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Establishes a server on this location to receive a bidirectional connection from a single client, identified by the given 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 more
Source§

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>>)
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Establishes a bidirectional connection from a single external client using bincode serialization. Read more
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>>)
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Establishes a server on this location to receive bidirectional connections from multiple external clients using raw bytes. Read more
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>>)
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Establishes a server on this location to receive bidirectional connections from multiple external clients using bincode serialization. Read more
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>>)
where Self: Sized + TopLevel<'a>,

Bridges user-owned async code to the dataflow as a bidirectional sidecar. Read more
Source§

fn singleton<T>( &self, e: impl QuotedWithContext<'a, T, Self>, ) -> Singleton<T, Self::DropConsistency, Bounded>
where Self: Sized,

Constructs a Singleton materialized at this location with the given static value. Read more
Source§

fn singleton_future<F>( &self, e: impl QuotedWithContext<'a, F, Self>, ) -> Singleton<F::Output, Self::DropConsistency, Bounded>
where F: Future, Self: Sized,

Constructs a Singleton by resolving an async Future to completion. Read more
Source§

fn source_interval( &self, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, ) -> Stream<(), Self, Unbounded, TotalOrder, AtLeastOnce>
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Generates a stream that emits () at a fixed interval. Read more
Source§

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>
where Self: TopLevel<'a> + Sized,

Available on crate feature tokio only.
Generates a stream that emits () at a fixed interval, after an initial delay. Read more
Source§

fn forward_ref<S>(&self) -> (ForwardHandle<'a, S>, S)
where S: CycleCollection<'a, ForwardRef, Location = Self>,

Creates a forward reference, allowing a stream to be used before its source is defined. Read more
Source§

impl<C, Con: Consistency, Id> PartialEq for Cluster<'_, C, Id, Con>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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>
where PhantomData<(fn(&'a ()) -> &'a (), (ClusterTag, Con, Id))>: Unpin,

§

impl<'a, ClusterTag, Id, Con> UnsafeUnpin for Cluster<'a, ClusterTag, Id, Con>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'a, L> ContextWithLocation<'a> for L
where L: Location<'a>,

Source§

type Location = L

The location type of this context.
Source§

fn context_location(&self) -> &L

Extracts the location of the splice site from this context.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<'a, T, L> OrAt<'a, Atomic<L>> for T
where L: Location<'a>,

Source§

impl<'a, T, L> OrAt<'a, L> for T
where T: Clone + 'a, L: TopLevel<'a>,

Source§

fn or_unbounded( me: Optional<T, L, Unbounded>, other: Optional<T, L, Unbounded>, ) -> Optional<T, L, Unbounded>

Source§

impl<'a, T, L> OrAt<'a, Tick<L>> for T
where L: Location<'a>,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSinkBuild for T

Source§

fn iter_to_sink_build(self) -> SendIterBuild<Self>
where Self: Sized + Iterator,

Starts a SinkBuild adaptor chain to send all items from self as an Iterator.
Source§

fn stream_to_sink_build(self) -> SendStreamBuild<Self>
where Self: Sized + Stream,

Starts a SinkBuild adaptor chain to send all items from self as a [Stream].
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more