Skip to main content

Module storage

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§

FsReplayStore
Capture small uploads in memory and spill larger uploads into temporary files.
MemoryReplay
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§

ReplaySource
A body cursor that can independently replay its remaining data and trailers.
ReplayStore
Creates independent writers for uploads selected by a retry policy.
ReplayWriter
Receives data frames in order for one upload.