Crate zksync_concurrency

Source
Expand description

Concurrency primitives.

Modules§

ctx
Implementation of the golang Context (https://pkg.go.dev/context). You can think of context as a runtime equivalent of the rust lifetime: As soon as its context is canceled the function should return ASAP, without doing any further blocking calls.
error
Generalization of anyhow::Context to more structured errors.
io
Context-aware async read/write operations.
limiter
Rate limiter which supports delayed permit consumption.
metrics
Prometheus metrics utilities.
net
Context-aware network utilities. Built on top of tokio::net.
oneshot
Context-aware wrapper around tokio::sync::oneshot channel.
scope
Implementation of Structured Concurrency (both sync and async) with cancellation, based on Golang errgroup (https://pkg.go.dev/golang.org/x/sync/errgroup). Instead of “errgroup” we use name “scope” to be consistent with std::thread::scope.
signal
Simple signal reporting primitive. A building block for Scope and Ctx. Can also be used outside of the crate, but only together with Ctx.
sync
Context-aware wrappers for tokio synchronization primitives.
testonly
Testonly utilities for concurrent tests.
time
Well-defined alternatives to types in std::time. Provides a signed Duration and UTC timestamps with nanoseconds precision.

Macros§

run
Runs an async scope.
run_blocking
Runs a blocking scope.