Skip to main content

ResolvedCache

Struct ResolvedCache 

Source
pub struct ResolvedCache {
Show 33 fields pub cache_dir: PathBuf, pub cache_size_mb: u64, pub disk_headroom_mb: u64, pub max_blob_size_mb: u64, pub max_rate_per_mb: u64, pub origins: Vec<ResolvedOrigin>, pub pinned_hashes: PinnedHashes, pub origin_retry: RetryPolicy, pub circuit_breaker: CircuitBreakerPolicy, pub user_agent: String, pub gc_interval_sec: u64, pub fs_rescan_interval_sec: u64, pub origin_probe_ttl_sec: u64, pub origin_probe_negative_ttl_sec: u64, pub origin_probe_fault_ttl_sec: u64, pub origin_probe_timeout_ms: u64, pub origin_probe_memo_capacity: u64, pub eviction_high_water_pct: u64, pub eviction_target_pct: u64, pub eviction_per_sweep_budget: u64, pub eviction_tick_secs: u64, pub max_probe_holds: usize, pub stake_lane_reserved_holds: usize, pub node_to_node_pull_through_enabled: bool, pub relay_foreign_namespaces: bool, pub node_pull_probe_fanout: usize, pub node_pull_timeout_sec: u64, pub node_pull_stall_window_sec: u64, pub node_pull_min_throughput_bps: u64, pub eviction_policy: String, pub admission_policy: String, pub tinylfu: ResolvedTinyLfu, pub serve_economics: ResolvedServeEconomics,
}
Expand description

Resolved cache fields.

Fields§

§cache_dir: PathBuf

Blob cache directory.

§cache_size_mb: u64

Upper bound on the cache ceiling in megabytes. The eviction driver clamps it down each tick so the cache never grows into the last Self::disk_headroom_mb of free space on the cache_dir volume (#1930).

§disk_headroom_mb: u64

Free disk in megabytes the eviction driver keeps unused on the cache_dir volume, defended against any process (#1930). Default crate::config::DEFAULT_DISK_HEADROOM_MB; 0 opts out of the disk clamp so only Self::cache_size_mb binds.

§max_blob_size_mb: u64

Maximum single blob size in megabytes.

§max_rate_per_mb: u64

Buyer-side ABSOLUTE per-MB rate ceiling for paid pulls (#1375), in the same per-MB units as the wire StreamResponse.rate_per_mb; 0 = unlimited (the default). A buyer-side ceiling: it bounds what this node, acting as a BUYER on a cache-miss pull, will accept a provider to quote. The node also always applies a probe-relative bound (a quote may not exceed the rate the chosen candidate advertised at probe), so this is the additional absolute backstop. The node never bounds its own sell rate.

§origins: Vec<ResolvedOrigin>

Resolved ordered list of origin backends (#437, #284). Empty vec => no pull-through; cache misses return NoOrigin. A single-element vec is the single-origin case and is also the form produced from a [cache.origin] (singular) TOML table — both wire forms (singular and plural [[cache.origins]]) collapse here so downstream wiring sees one canonical representation. Per-variant validation (URL parse, S3 bucket/region/prefix shape) has already run at resolution time — the wiring layer can construct the concrete Origin impl without re-validating. Order is significant: the engine tries entries in this order on a cache miss and falls back to the next on NotFound, permanent error, or transient retry exhaustion.

§pinned_hashes: PinnedHashes

Operator-pinned blob hashes (#276). Hashes here are excluded from LRU eviction candidates by the cache engine. Resolved from the hex-encoded TOML form at load time, so any wrong-length or non-hex entry fails config loading rather than turning into a silent “this hash will be ignored” surprise.

Held as decdn_config_types::PinnedHashes (a typed wrapper around Arc<HashSet<Hash>>) so the engine, runtime, and resolver share one nominal type — a future “blocklist” or similar HashSet<Hash>-shaped feature can’t be silently swapped into the pinning slot.

§origin_retry: RetryPolicy

Origin pull-through retry policy (#285). Set once at startup; changes require a process restart.

§circuit_breaker: CircuitBreakerPolicy

Per-origin circuit-breaker policy (#963). Fronts each origin’s pull-through retry loop so a sustained outage fast-fails the origin’s misses (no retry/backoff incurred) and the cache sheds load, then probes for recovery. Set once at startup; changes require a process restart.

§user_agent: String

User-Agent header sent on every HTTP origin pull-through (#435). Defaults to decdn_config_types::DEFAULT_USER_AGENT (which embeds the decdn-config-types crate’s CARGO_PKG_VERSION; the decdn-node/ prefix — not the version — is the stable contract, #578); operators can override via cache.user_agent to attribute CDN traffic in origin access logs or to drive origin-side rate limits and routing policy.

§gc_interval_sec: u64

Interval between iroh-blobs GC sweeps in seconds (#518). 0 disables the periodic sweep; any positive value is forwarded to iroh-blobs’ built-in GC loop. Default crate::config::DEFAULT_GC_INTERVAL_SEC when the TOML section omits the field.

§fs_rescan_interval_sec: u64

Interval between origin-held-index rescans in seconds (#1130). 0 disables the periodic rescan (startup + decdn node reload still run one). Default crate::config::DEFAULT_FS_RESCAN_INTERVAL_SEC when the TOML section omits the field.

§origin_probe_ttl_sec: u64

TTL in seconds for a memoised positive live-origin probe answer (#1130 pt3). Default crate::config::DEFAULT_ORIGIN_PROBE_TTL_SEC. Backs the per-probe HEAD/HeadObject fallback that discovers non-pinned http/s3 objects the enumeration index cannot see.

§origin_probe_negative_ttl_sec: u64

Default crate::config::DEFAULT_ORIGIN_PROBE_NEGATIVE_TTL_SEC. The negative-answer TTL for the origin-probe memo — the bound on how long a stale Absent can hide newly-available own content.

§origin_probe_fault_ttl_sec: u64

Memo TTL in seconds for a Fault answer (#1130 pt3). Default crate::config::DEFAULT_ORIGIN_PROBE_FAULT_TTL_SEC. Bounds how long a hash that faulted is not re-probed, and is capped by origin_probe_ttl_sec so a recovered origin is noticed soon.

§origin_probe_timeout_ms: u64

Per-probe live-HEAD ceiling in milliseconds (#1130 pt3). Default crate::config::DEFAULT_ORIGIN_PROBE_TIMEOUT_MS. Keeps a slow origin off the probe hot path.

§origin_probe_memo_capacity: u64

Maximum distinct hashes in the live-origin probe memo (#1130 pt3). Default crate::config::DEFAULT_ORIGIN_PROBE_MEMO_CAPACITY. Bounds memo memory under a random-hash probe flood.

§eviction_high_water_pct: u64

LRU eviction driver high-water percent of Self::cache_size_mb (#1173). Above this fraction the driver actively evicts. Validated to [60, 95]. Default crate::config::DEFAULT_EVICTION_HIGH_WATER_PCT.

§eviction_target_pct: u64

LRU eviction driver target percent of Self::cache_size_mb (#1173). The driver evicts down to this fraction before idling. Validated to [40, 90] and <= eviction_high_water_pct - 5 (structural hysteresis gap). Default crate::config::DEFAULT_EVICTION_TARGET_PCT.

§eviction_per_sweep_budget: u64

LRU eviction driver max candidates removed per tick (#1173). Validated to [1, 256]. Default crate::config::DEFAULT_EVICTION_PER_SWEEP_BUDGET.

§eviction_tick_secs: u64

LRU eviction driver wakeup cadence in seconds (#1173). Validated to [1, 60]. Default crate::config::DEFAULT_EVICTION_TICK_SECS.

§max_probe_holds: usize

Maximum number of concurrently held (eviction-exempt) blobs for the probe-triggered hold (ADR 005 §Hold budget, #318). Default crate::config::DEFAULT_MAX_PROBE_HOLDS; 0 disables has_blob: true.

§stake_lane_reserved_holds: usize

Probe-hold slots reserved for the stake lane (registered node-to-node requesters) under hold-budget pressure (#757, ADR 003 §Admission and Priority). Default 0 disables the reservation (single-lane node). The runtime only builds a StakeLanePolicy when this is > 0, so the probe handler’s hot path is unchanged for the default.

§node_to_node_pull_through_enabled: bool

Enable node-to-node paid cache-miss pull-through (#831). Default false. When true and the buyer-channel service bootstrapped, the runtime provisions the NodeOrigin and the client handler triggers a pull on a miss (behind a valid client channel). cache.* is restart-required, so this is read once at bring-up.

§relay_foreign_namespaces: bool

When false, the node serves and seeds only content its own backend holds; a foreign hash is declined like a miss. The default is role-derived: false (origin-only) when an origin backend is configured — an origin is not a general proxy — and true (relay) when no origin is configured, since a pure edge node’s only function is relaying. Explicit config overrides either default. Node-local; cache.* is restart-required.

§node_pull_probe_fanout: usize

Providers probed before ranking on a node-to-node pull (#831). Default crate::config::DEFAULT_NODE_PULL_PROBE_FANOUT.

§node_pull_timeout_sec: u64

Per-pull wall-clock timeout in seconds for a node-to-node miss fill (#831). Default crate::config::DEFAULT_NODE_PULL_TIMEOUT_SEC.

Bounds the OPEN stage only; the streaming stage is bounded by Self::node_pull_stall_window_sec and Self::node_pull_min_throughput_bps (#1797).

§node_pull_stall_window_sec: u64

Throughput-floor window (seconds) on the streaming stage of an upstream pull; bytes are counted off the QUIC stream sub-frame, so it trips only when throughput falls below the floor, never on a large blob (#1797). Default crate::config::DEFAULT_NODE_PULL_STALL_WINDOW_SEC. Also the head start of each own-origin range-pull read’s time budget (ADR 037).

§node_pull_min_throughput_bps: u64

Minimum sustained upstream throughput (bytes/sec) over node_pull_stall_window_sec; 0 = idle detection only (#1797). Default crate::config::DEFAULT_NODE_PULL_MIN_THROUGHPUT_BPS. Also the average throughput each own-origin range-pull read must sustain after the head start; 0 leaves those reads unbounded (ADR 037).

§eviction_policy: String

Cache eviction policy selector (ADR 040). "lru" or "tinylfu". Default crate::config::DEFAULT_EVICTION_POLICY.

§admission_policy: String

Cache admission policy selector (ADR 040). "always" or "tinylfu". Default crate::config::DEFAULT_ADMISSION_POLICY.

§tinylfu: ResolvedTinyLfu

W-TinyLFU tuning knobs (ADR 040), resolved regardless of whether either policy selector above is "tinylfu" — cheap to resolve and keeps this struct free of Option.

§serve_economics: ResolvedServeEconomics

Refuse-to-serve economics tuning (ADR 041): the margin policy, its discount, and per-source speculative-warming allowance.

Trait Implementations§

Source§

impl Debug for ResolvedCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more