pub struct DedupDomain {
pub compartment: Option<Compartment>,
pub algorithm: HashAlgo,
pub digest_length: u16,
pub trust_boundary: TrustBoundary,
}Expand description
A dedup domain: content is only ever deduplicated against other content in the same domain. Keyed by:
compartment— tenant / need-to-know isolation, drawn from the existing MACCompartmentvocabulary (e.g."tenant:acme").None= untenanted. This field is READ-only vocabulary reuse; the substrate never authors, derives, or enforces MAC policy from it.algorithm— the multihash algorithm; SHA-1 content is never deduplicated against SHA-256 (the pair would lean on the weaker collision resistance).digest_length— the multihash digest length in bytes. Length is part of CID identity (the multihash carriesuvarint(len)), so it is part of the dedup key too: BLAKE3 is an XOF andBLAKE3-512(x)[0:32] == BLAKE3-256(x), so a 256-bit and a 512-bit domain over the same content would alias if the length were dropped from the key. Two widths get distinct storage roots (#812/#881 joint decision).trust_boundary— seeTrustBoundary.
The (algorithm, digest_length) pair is validated against
HashAlgo::validate_digest_len by DedupDomain::new; the fields stay
pub so struct-literal construction with ..DedupDomain::local_default()
remains ergonomic, but callers that vary the algorithm/length should go through
DedupDomain::new to keep the pair well-formed.
§On-disk mapping
The default domain (None, Blake3, 32, Local) maps to the substrate root
itself (no sub-directory), so the legacy cas_serve::CasStore layout and every
existing caller keep working byte-for-byte. Every other domain maps to a
deterministic, injective sub-path so distinct domains never collide.
Fields§
§compartment: Option<Compartment>Need-to-know compartment (tenant scope). None = untenanted.
algorithm: HashAlgoMultihash algorithm partition.
digest_length: u16Multihash digest length in bytes (part of the CID identity). Must be a
length the algorithm accepts (see HashAlgo::validate_digest_len).
trust_boundary: TrustBoundaryStorage layer / trust boundary partition.
Implementations§
Source§impl DedupDomain
impl DedupDomain
Sourcepub fn local_default() -> Self
pub fn local_default() -> Self
The default domain: untenanted, BLAKE3-256, node-local. This is the domain the current registry/XET call sites use, and it maps to the substrate root (legacy layout, byte-for-byte parity).
Sourcepub fn local_tenant(compartment: Compartment) -> Self
pub fn local_tenant(compartment: Compartment) -> Self
A node-local, BLAKE3-256 domain scoped to a single tenant compartment.
Sourcepub fn new(
algorithm: HashAlgo,
digest_length: u16,
compartment: Option<Compartment>,
trust_boundary: TrustBoundary,
) -> Result<Self, InvalidDedupDomain>
pub fn new( algorithm: HashAlgo, digest_length: u16, compartment: Option<Compartment>, trust_boundary: TrustBoundary, ) -> Result<Self, InvalidDedupDomain>
Construct a domain, validating that (algorithm, digest_length) is a
well-formed multihash pair (the length is one the algorithm accepts).
This is the constructor to use when varying the algorithm or width; the
compartment/trust-boundary default to untenanted/local. Prefer
local_default /
local_tenant for the common BLAKE3-256 cases.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
True for the default domain (root-mapped, legacy-compatible).
Sourcepub fn relative_path(&self) -> PathBuf
pub fn relative_path(&self) -> PathBuf
Relative sub-path (under the substrate root) isolating this domain’s blobs.
- Default domain → empty (the root itself), preserving the legacy layout.
- Otherwise →
domains/<boundary>/algo-<code>-len<N>/c-<hex(compartment)|none>/.
The algo-<code>-len<N> segment encodes both the algorithm code and
the digest length, so two widths of the same algorithm (BLAKE3-256 vs
BLAKE3-512) map to distinct sub-roots and cannot share xorbs. The
compartment name is hex-encoded so the mapping is injective and path-safe
regardless of the characters a compartment name contains (e.g. the : in
"tenant:acme"), and can never traverse out of the root.
Trait Implementations§
Source§impl Clone for DedupDomain
impl Clone for DedupDomain
Source§fn clone(&self) -> DedupDomain
fn clone(&self) -> DedupDomain
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 DedupDomain
impl Debug for DedupDomain
Source§impl Hash for DedupDomain
impl Hash for DedupDomain
Source§impl PartialEq for DedupDomain
impl PartialEq for DedupDomain
Source§fn eq(&self, other: &DedupDomain) -> bool
fn eq(&self, other: &DedupDomain) -> bool
self and other values to be equal, and is used by ==.impl Eq for DedupDomain
impl StructuralPartialEq for DedupDomain
Auto Trait Implementations§
impl Freeze for DedupDomain
impl RefUnwindSafe for DedupDomain
impl Send for DedupDomain
impl Sync for DedupDomain
impl Unpin for DedupDomain
impl UnsafeUnpin for DedupDomain
impl UnwindSafe for DedupDomain
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request