pub struct CacheConfig {
pub listen: String,
pub backend: BackendConfig,
pub signing_key: Option<PathBuf>,
pub priority: u32,
pub want_mass_query: bool,
pub store_dir: String,
pub require_sigs: bool,
pub nar_codec: NarCodec,
}Expand description
Top-level cache configuration.
#[serde(default)] is what makes this an overlay rather than a
replacement: shikumi’s Custom tier deserializes the operator’s YAML into
this type whole, so without it a file that wants to change one field would
have to restate every other one — and a file that failed to would be
silently discarded (shikumi falls back to prescribed_default on a parse
error). Absent fields now come from Default, which is
TieredConfig::prescribed_default.
Fields§
§listen: StringNetwork address to listen on.
backend: BackendConfigStorage backend configuration.
signing_key: Option<PathBuf>Path to the ed25519 signing secret key file.
In production this path is a cofre/ESO-materialized Kubernetes Secret
mount, never a plaintext literal. When set, the daemon signs every
ingested narinfo (see serve).
priority: u32Cache priority (lower = preferred). Reported in nix-cache-info.
want_mass_query: boolWhether to want mass query (narinfo pipelining).
store_dir: StringThe Nix store directory (almost always /nix/store).
require_sigs: boolWhether this cache’s consumers should require a valid signature.
This is a serving-side advertisement of the fail-closed posture: a
signing cache SHOULD publish require_sigs = true so operators know
the served paths are signed and consumers must verify. It does not by
itself change what the daemon serves (signing is driven by
signing_key); it is the typed knob a consuming config reads to know
the cache is trustworthy fail-closed. Defaults to false to preserve
legacy behavior for caches that have not yet been given a key.
nar_codec: NarCodecHow a pushed NAR is packed — the codec and its level, as one
inseparable value (see NarCodec).
This is the deployment knob the benchmark in NarCodec’s docs argues
about. rio is a local origin serving a handful of fleet nodes over
tailscale: CPU-bound, bandwidth-cheap, so zstd -12 is right and is the
prescribed default. A bandwidth-bound origin — one paying egress, or
seeding cold clients over the public internet — legitimately wants
{ codec: xz, level: 6 } and now gets it from a config file instead of
a recompile.
A mixed cache needs no migration: every narinfo declares its own codec, so flipping this changes only what new pushes look like.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn resolve() -> Self
pub fn resolve() -> Self
Resolve this cache’s configuration the fleet-standard way — the one call site every entry point uses (★★ CONFIGURATION MANAGEMENT).
Precedence is shikumi’s: the CACHE_TIER_ENV environment variable
selects the tier, and when it names a path that YAML file is overlaid
on the prescribed default. Unset → the prescribed default, unchanged
from what this cache did before it had a config surface.
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§fn default() -> Self
fn default() -> Self
Delegates to TieredConfig::prescribed_default so the standard idiom
(CacheConfig::default()) and the tiered resolution can never describe
two different caches.
Source§impl<'de> Deserialize<'de> for CacheConfigwhere
CacheConfig: Default,
impl<'de> Deserialize<'de> for CacheConfigwhere
CacheConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CacheConfig
Source§impl PartialEq for CacheConfig
impl PartialEq for CacheConfig
Source§impl Serialize for CacheConfig
impl Serialize for CacheConfig
impl StructuralPartialEq for CacheConfig
Source§impl TieredConfig for CacheConfig
impl TieredConfig for CacheConfig
Source§fn bare() -> Self
fn bare() -> Self
Tier 0 — the honest floor: sui-cache exactly as it shipped before 2026-08-05. xz -6 packing, no signing key, no fail-closed advertisement, the on-disk backend.
This tier is not a worse default, it is the documented past: every
.nar.xz already in a fleet cache was written by it, and an origin that
wants the old ratio back asks for it by name (SUI_CACHE_TIER=bare)
rather than by editing a constant.
Source§fn prescribed_default() -> Self
fn prescribed_default() -> Self
Tier 2 — the prescribed posture: identical to bare
except that pushes pack with zstd, the measured fast path. The
whole point of the 2026-08-05 change is that you get it without asking.
Source§fn discovered() -> Self
fn discovered() -> Self
bare() overlaid with runtime auto-detect outputs.
Default: returns bare() unchanged. Consumers with detect
helpers override.Source§fn extend(self, _base: &Self) -> Self
fn extend(self, _base: &Self) -> Self
base. Default impl
returns self.clone() (full replacement). Consumers with
finer-grained per-field merge semantics override.Source§fn resolve_tier(tier: ConfigTier) -> Self
fn resolve_tier(tier: ConfigTier) -> Self
self from a tier selector — the operator-facing
entry point. Wraps the tier methods + env-var resolution +
optional YAML overlay into one call site every fleet app
uses identically. Read moreSource§fn resolve_from_env(env_var: &str) -> Self
fn resolve_from_env(env_var: &str) -> Self
<APP>_TIER) AND materialize the config in one call.
The fleet-wide canonical entry point at app startup.Source§fn diff_against(&self, baseline: &Self) -> ConfigDiff
fn diff_against(&self, baseline: &Self) -> ConfigDiff
self against baseline. Default: serialize both to
YAML and produce a line-oriented diff.Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);