Crate async_bulkhead

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

  1. rt-tokio (default)
  2. rt-async-std
  3. rt-smol

Structs§

Bulkhead
A semaphore-based bulkhead for limiting the number of concurrent calls to a resource.
BulkheadBuilder
A builder type for a Bulkhead
BulkheadRegistry
A structure for tracking multiple bulkheads for different resources.

Enums§

BulkheadError
The error type for operations with Bulkhead.