Skip to main content

FastWorkerConfig

Struct FastWorkerConfig 

Source
pub struct FastWorkerConfig {
    pub stream: String,
    pub group: String,
    pub consumer: String,
    pub kind: String,
    pub concurrency: usize,
    pub read_block: Duration,
    pub reply_ttl: Duration,
    pub limits: Limits,
}
Expand description

The settings of a FastWorker.

use std::time::Duration;
use legit_streams::FastWorkerConfig;

let config = FastWorkerConfig {
    concurrency: 4,
    ..FastWorkerConfig::new("hash_tasks:fast", "hash_workers", "hash-worker-host1-fast_4123", "hash")
};
assert_eq!(config.reply_ttl, Duration::from_secs(60));

Fields§

§stream: String

The fast task stream, such as hash_tasks:fast. It can’t begin with results: or dead:.

§group: String

The consumer group the worker reads it with, created when missing.

§consumer: String

This worker’s consumer name, unique within the group, and the worker_id of its results; see fast_consumer_name.

§kind: String

The lane’s kind, the {kind} of the reply keys it answers, such as hash; see is_valid_kind. A task whose reply key names another kind is deleted unanswered.

§concurrency: usize

How many tasks run at once, each on a thread of its own; also the most one read takes. 1 by default.

§read_block: Duration

How long one read waits for a task; also the longest a stop waits for a read in progress. 1 s by default.

§reply_ttl: Duration

How long a reply key lives after each reply is added to it, so a reply whose caller gave up doesn’t stay. Whole seconds, at least 1; 60 s by default, the contract’s reference value.

§limits: Limits

The bounds on a task the worker reads and a result it writes.

Implementations§

Source§

impl FastWorkerConfig

Source

pub fn new( stream: impl Into<String>, group: impl Into<String>, consumer: impl Into<String>, kind: impl Into<String>, ) -> Self

The default settings for reading stream with group as consumer, answering reply keys of kind. The kind has no default: it’s checked when the worker is made.

use legit_streams::FastWorkerConfig;

let config = FastWorkerConfig::new("hash_tasks:fast", "hash_workers", "host1-fast_1", "hash");
assert_eq!(config.concurrency, 1);

Trait Implementations§

Source§

impl Clone for FastWorkerConfig

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 Debug for FastWorkerConfig

Source§

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

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

impl Eq for FastWorkerConfig

Source§

impl PartialEq for FastWorkerConfig

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 StructuralPartialEq for FastWorkerConfig

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

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

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