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: StringThe fast task stream, such as hash_tasks:fast. It can’t begin with results: or dead:.
group: StringThe consumer group the worker reads it with, created when missing.
consumer: StringThis worker’s consumer name, unique within the group, and the worker_id of its results;
see fast_consumer_name.
kind: StringThe 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: usizeHow many tasks run at once, each on a thread of its own; also the most one read takes. 1 by default.
read_block: DurationHow long one read waits for a task; also the longest a stop waits for a read in progress. 1 s by default.
reply_ttl: DurationHow 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: LimitsThe bounds on a task the worker reads and a result it writes.
Implementations§
Source§impl FastWorkerConfig
impl FastWorkerConfig
Sourcepub fn new(
stream: impl Into<String>,
group: impl Into<String>,
consumer: impl Into<String>,
kind: impl Into<String>,
) -> Self
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);