Skip to main content

Process

Struct Process 

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

Source

pub fn sim_atomic_input<T, O: Ordering, R: Retries>( &self, ) -> (SimAtomicSender<T, O, R>, Stream<T, Atomic<Self>, Unbounded, O, R>)

Available on crate feature sim only.

Sets up a simulated atomic input port on this process for testing.

The source is placed directly inside the atomic tick, so sent values are immediately available in the next atomic slice without requiring a separate tick to batch them in. send_atomic is synchronous.

Trait Implementations§

Source§

impl<P> Clone for Process<'_, P>

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<P> Debug for Process<'_, P>

Source§

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

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

impl<'a, P> Location<'a> for Process<'a, P>

Source§

type Root = Process<'a, P>

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

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

Returns the root location for this location. Read more
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>
where Self: NoTick,

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

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

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, Unbounded, TotalOrder, ExactlyOnce>
where E: FuturesStream<Item = T> + Unpin, Self: Sized + NoTick,

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, 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>( &self, cluster: &Cluster<'a, C>, ) -> KeyedStream<MemberId<C>, MembershipEvent, Self, Unbounded>
where Self: Sized + NoTick,

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, Unbounded, TotalOrder, ExactlyOnce>)
where Self: Sized + NoTick,

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, Unbounded, O, R>)
where Self: Sized + NoTick, T: Serialize + DeserializeOwned,

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, Unbounded, O, R>)
where Self: Sized + NoTick, T: Serialize + DeserializeOwned,

Available on crate feature sim only.
Sets up a simulated input port on this location for testing. Read more
Source§

fn embedded_input<T>( &self, name: impl Into<String>, ) -> Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>
where Self: Sized + NoTick,

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, Bounded>
where Self: Sized + NoTick,

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, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<T, Self, Unbounded, TotalOrder, ExactlyOnce>>)
where Self: Sized + NoTick,

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, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, Stream<OutT, Self, Unbounded, TotalOrder, ExactlyOnce>>)
where Self: Sized + NoTick,

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, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, T, Self, Unbounded, NoOrder, ExactlyOnce>>)
where Self: Sized + NoTick,

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, Unbounded, TotalOrder, ExactlyOnce>, KeyedStream<u64, MembershipEvent, Self, Unbounded, TotalOrder, ExactlyOnce>, ForwardHandle<'a, KeyedStream<u64, OutT, Self, Unbounded, NoOrder, ExactlyOnce>>)
where Self: Sized + NoTick,

Establishes a server on this location to receive bidirectional connections from multiple external clients using bincode serialization. Read more
Source§

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

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, Bounded>
where F: Future, Self: Sized + NoTick,

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, _nondet: NonDet, ) -> Stream<Instant, Self, Unbounded, TotalOrder, ExactlyOnce>
where Self: Sized + NoTick,

Generates a stream with values emitted at a fixed interval, with each value being the current time (as an [tokio::time::Instant]). Read more
Source§

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>
where Self: Sized + NoTick,

Generates a stream with values emitted at a fixed interval (with an initial delay), with each value being the current time (as an [tokio::time::Instant]). 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<P> PartialEq for Process<'_, P>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P> Eq for Process<'_, P>

Source§

impl<T> NoAtomic for Process<'_, T>

Source§

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

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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