Crate zksync_concurrency
source ·Expand description
Concurrency primitives.
Modules§
- 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.
- Generalization of anyhow::Context to more structured errors.
- Context-aware async read/write operations.
- Rate limiter which supports delayed permit consumption.
- Prometheus metrics utilities.
- Context-aware network utilities. Built on top of
tokio::net
. - Context-aware wrapper around tokio::sync::oneshot channel.
- 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
. - Simple signal reporting primitive. A building block for
Scope
andCtx
. Can also be used outside of the crate, but only together withCtx
. - Context-aware wrappers for tokio synchronization primitives.
- Testonly utilities for concurrent tests.
- Well-defined alternatives to types in std::time. Provides a signed Duration and UTC timestamps with nanoseconds precision.
Macros§
- Runs an async scope.
- Runs a blocking scope.