pub struct Process<'a, ProcessTag = ()> { /* private fields */ }Expand description
A single-node location in a distributed Hydro program.
Process represents exactly one machine (or OS process) and is one of the
core location types that implements the Location trait. Live collections
placed on a Process are materialized entirely on that single node.
The type parameter ProcessTag is a compile-time marker that differentiates
distinct processes in the same dataflow graph (e.g. Process<'a, Leader> vs
Process<'a, Follower>). It defaults to () when only one process is
needed.
§Creating a Process
let mut flow = FlowBuilder::new();
let node = flow.process::<MyTag>();Implementations§
Source§impl<'a, P> Process<'a, P>
impl<'a, P> Process<'a, P>
Sourcepub fn sim_atomic_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimAtomicSender<T, O, R>, Stream<T, Atomic<Self>, Unbounded, O, R>)where
T: Serialize + DeserializeOwned,
Available on crate feature sim only.
pub fn sim_atomic_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimAtomicSender<T, O, R>, Stream<T, Atomic<Self>, Unbounded, O, R>)where
T: Serialize + DeserializeOwned,
sim only.Sets up a simulated atomic input port on this process for testing.
Returns a sender whose send method returns a future that resolves once
the atomic tick containing the sent item has completed, along with a stream
in an atomic context.
This is equivalent to manually calling sim_input, .atomic(), wrapping
in a shared cell, and wiring up an ack via .end_atomic().sim_output().
Trait Implementations§
Source§impl<'a, P> Location<'a> for Process<'a, P>
impl<'a, P> Location<'a> for Process<'a, P>
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, Unbounded, TotalOrder, ExactlyOnce>
fn source_stream<T, E>( &self, e: impl QuotedWithContext<'a, E, Self>, ) -> Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>
FuturesStream]. Read moreSource§fn source_iter<T, E>(
&self,
e: impl QuotedWithContext<'a, E, Self>,
) -> Stream<T, Self, 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, Bounded, TotalOrder, ExactlyOnce>where
E: IntoIterator<Item = T>,
Self: Sized,
Source§fn source_cluster_members<C: 'a>(
&self,
cluster: &Cluster<'a, C>,
) -> KeyedStream<MemberId<C>, MembershipEvent, Self, Unbounded>
fn source_cluster_members<C: 'a>( &self, cluster: &Cluster<'a, C>, ) -> KeyedStream<MemberId<C>, MembershipEvent, Self, Unbounded>
Source§fn source_external_bytes<L>(
&self,
from: &External<'_, L>,
) -> (ExternalBytesPort, Stream<BytesMut, Self, Unbounded, TotalOrder, ExactlyOnce>)
fn source_external_bytes<L>( &self, from: &External<'_, L>, ) -> (ExternalBytesPort, Stream<BytesMut, Self, Unbounded, TotalOrder, ExactlyOnce>)
Source§fn source_external_bincode<L, T, O: Ordering, R: Retries>(
&self,
from: &External<'_, L>,
) -> (ExternalBincodeSink<T, NotMany, O, R>, Stream<T, Self, 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, Unbounded, O, R>)
Source§fn sim_input<T, O: Ordering, R: Retries>(
&self,
) -> (SimSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)
fn sim_input<T, O: Ordering, R: Retries>( &self, ) -> (SimSender<T, O, R>, Stream<T, Self, Unbounded, O, R>)
sim only.Source§fn embedded_input<T>(
&self,
name: impl Into<String>,
) -> Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>
fn embedded_input<T>( &self, name: impl Into<String>, ) -> Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>
Source§fn embedded_singleton_input<T>(
&self,
name: impl Into<String>,
) -> Singleton<T, Self, Bounded>
fn embedded_singleton_input<T>( &self, name: impl Into<String>, ) -> Singleton<T, Self, 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, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<T, Self, 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, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>>)
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, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self, Unbounded, TotalOrder, ExactlyOnce>>)
fn bind_single_client_bincode<L, InT: DeserializeOwned, OutT: Serialize>( &self, from: &External<'_, L>, ) -> (ExternalBincodeBidi<InT, OutT, NotMany>, Stream<InT, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self, Unbounded, TotalOrder, ExactlyOnce>>)
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, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, T, Self, 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, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, T, Self, Unbounded, NoOrder, ExactlyOnce>>)
Source§fn bidi_external_many_bincode<L, InT: DeserializeOwned, OutT: Serialize>(
&self,
from: &External<'_, L>,
) -> (ExternalBincodeBidi<InT, OutT, Many>, KeyedStream<u64, InT, Self, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, OutT, Self, 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, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, OutT, Self, Unbounded, NoOrder, ExactlyOnce>>)
Source§fn singleton<T>(
&self,
e: impl QuotedWithContext<'a, T, Self>,
) -> Singleton<T, Self, Bounded>
fn singleton<T>( &self, e: impl QuotedWithContext<'a, T, Self>, ) -> Singleton<T, Self, Bounded>
Source§fn singleton_future<F>(
&self,
e: impl QuotedWithContext<'a, F, Self>,
) -> Singleton<F::Output, Self, Bounded>
fn singleton_future<F>( &self, e: impl QuotedWithContext<'a, F, Self>, ) -> Singleton<F::Output, Self, Bounded>
Source§fn source_interval(
&self,
interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
_nondet: NonDet,
) -> Stream<Instant, Self, Unbounded, TotalOrder, ExactlyOnce>
fn source_interval( &self, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, _nondet: NonDet, ) -> Stream<Instant, Self, Unbounded, TotalOrder, ExactlyOnce>
tokio::time::Instant]). Read moreSource§fn source_interval_delayed(
&self,
delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
_nondet: NonDet,
) -> Stream<Instant, Self, Unbounded, TotalOrder, ExactlyOnce>
fn source_interval_delayed( &self, delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, _nondet: NonDet, ) -> Stream<Instant, Self, Unbounded, TotalOrder, ExactlyOnce>
tokio::time::Instant]). 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>,
impl<P> Eq for Process<'_, P>
impl<T> NoAtomic for Process<'_, T>
impl<T> NoTick for Process<'_, T>
Auto Trait Implementations§
impl<'a, ProcessTag> Freeze for Process<'a, ProcessTag>
impl<'a, ProcessTag = ()> !RefUnwindSafe for Process<'a, ProcessTag>
impl<'a, ProcessTag = ()> !Send for Process<'a, ProcessTag>
impl<'a, ProcessTag = ()> !Sync for Process<'a, ProcessTag>
impl<'a, ProcessTag> Unpin for Process<'a, ProcessTag>where
ProcessTag: Unpin,
impl<'a, ProcessTag> UnsafeUnpin for Process<'a, ProcessTag>
impl<'a, ProcessTag = ()> !UnwindSafe for Process<'a, ProcessTag>
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,
§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> ⓘ
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§impl<T> ToSinkBuild for T
impl<T> ToSinkBuild for T
§fn iter_to_sink_build(self) -> SendIterBuild<Self>
fn iter_to_sink_build(self) -> SendIterBuild<Self>
§fn stream_to_sink_build(self) -> SendStreamBuild<Self>where
Self: Sized + Stream,
fn stream_to_sink_build(self) -> SendStreamBuild<Self>where
Self: Sized + Stream,
SinkBuild] adaptor chain to send all items from self as a [Stream].