Module storage
Available on crate features
http and std only.Expand description
Replay storage for the HTTP retry layer.
A store can be shared by many requests. Each request gets a writer, and only a writer that has seen the complete upload can publish a replay source. Each attempt clones a cursor pointing at the start of that source.
Choose a store when configuring the managed policy. Store instances can carry their own limits and resources, such as a disk budget shared across all requests served by the same client.
use rama_http::layer::retry::{ManagedPolicy, storage::{MemoryReplay, FsReplayStore}};
use rama_utils::octets::kib_u64;
use std::{path::Path, time::Duration};
let memory = MemoryReplay::new(kib_u64(128)).with_timeout(Duration::from_secs(5));
let policy = ManagedPolicy::default().with_replay_store(memory);
let disk = FsReplayStore::in_dir(parent).await?;
let policy = ManagedPolicy::default().with_replay_store(disk);Structs§
- FsReplay
Store - Capture small uploads in memory and spill larger uploads into temporary files.
- Memory
Replay - Bounded, per-request memory storage. The default retains up to 64 KiB of data per upload and allows up to 30 seconds to finish capture.
Constants§
- DEFAULT_
MAX_ BYTES - Default maximum payload retained per request by the in-memory store.
- DEFAULT_
TIMEOUT - Default time allowed to capture an upload, including any post-attempt drain.
Traits§
- Replay
Source - A body cursor that can independently replay its remaining data and trailers.
- Replay
Store - Creates independent writers for uploads selected by a retry policy.
- Replay
Writer - Receives data frames in order for one upload.