pub enum OriginConfig {
Http {
url: String,
decompress: Option<DecompressMode>,
},
Fs {
path: PathBuf,
},
S3(S3OriginConfig),
}Expand description
Origin backend selection (#437). Tagged on the inner kind field.
deny_unknown_fields is set on the enum and on each variant’s
payload so that an operator typo (decompres = "auto" on the Http
variant, for instance) fails at config load instead of silently
no-opping.
[cache.origin]
kind = "http"
url = "https://origin.example/"
decompress = "auto" # optional; defaults to "auto"
# — or —
[cache.origin]
kind = "fs"
path = "/var/lib/decdn/origin"
# — or —
[cache.origin]
kind = "s3"
bucket = "decdn-blobs"
region = "us-east-1"
# endpoint_url = "https://<accountid>.r2.cloudflarestorage.com" # for R2/B2/MinIO
# path_style = true # for MinIO
# prefix = "blobs/"
# [cache.origin.credentials] source = "static" / "default-chain"For multi-origin fallback (#284) use the plural [[cache.origins]]
array-of-tables form (mutually exclusive with [cache.origin]):
[[cache.origins]]
kind = "http"
url = "https://primary.example/"
[[cache.origins]]
kind = "s3"
bucket = "mirror-blobs"
region = "us-east-1"
[[cache.origins]]
kind = "fs"
path = "/var/lib/decdn/archive"Variants§
Http
HTTP(S) origin served at {url}/{blake3_hex}.
Fields
url: StringBase URL; must be http/https and is path-normalized to
end with / so {base}.join(&hex) produces {base}/{hex}.
decompress: Option<DecompressMode>How to handle Content-Encoding on the HTTP response
(#312). "auto" (default) decompresses gzip/zstd
transparently; "strict" refuses any non-identity
encoding. The BLAKE3 content-address is computed over the
canonical (decompressed) form, so "strict" is only safe
for origins guaranteed to serve already-canonical bytes.
Fs
Local filesystem origin rooted at path; blobs live at
{path}/{hex[0..2]}/{hex}.
S3(S3OriginConfig)
S3-compatible object storage (#437): AWS S3, Cloudflare R2,
Backblaze B2, MinIO, etc. Object key layout is
{prefix?}{hex[0..2]}/{hex} — sharded the same way as the
filesystem backend so operators can copy blobs between
backends without rewriting tooling.
Trait Implementations§
Source§impl Debug for OriginConfig
impl Debug for OriginConfig
Source§impl<'de> Deserialize<'de> for OriginConfig
impl<'de> Deserialize<'de> for OriginConfig
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>,
Auto Trait Implementations§
impl Freeze for OriginConfig
impl RefUnwindSafe for OriginConfig
impl Send for OriginConfig
impl Sync for OriginConfig
impl Unpin for OriginConfig
impl UnsafeUnpin for OriginConfig
impl UnwindSafe for OriginConfig
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more