Expand description
An async semaphore-based bulkhead implementation.
The Bulkhead
struct provides a limit
method for wrapping
futures with the bulkhead client-side resiliency pattern.
§Example
use async_bulkhead::Bulkhead;
use async_bulkhead::BulkheadError;
use std::time::Duration;
let bulkhead = Bulkhead::builder()
.max_concurrent_calls(10)
.max_wait_duration(Duration::from_millis(100))
.build()
.expect("max concurrent calls not > 0");
async {
let value = bulkhead.limit(async { 10 }).await?;
println!("{value}");
Ok::<_, BulkheadError>(())
};
§Features
Note that the runtime features of this crate are mutually exclusive. You should only use one of the following:
rt-tokio
(default)rt-async-std
rt-smol
Structs§
- Bulkhead
- A semaphore-based bulkhead for limiting the number of concurrent calls to a resource.
- Bulkhead
Builder - A builder type for a
Bulkhead
- Bulkhead
Registry - A structure for tracking multiple bulkheads for different resources.
Enums§
- Bulkhead
Error - The error type for operations with
Bulkhead
.