pub struct CasSubstrate { /* private fields */ }Expand description
The L1 unified content-addressed store.
A thin, domain-partitioning facade over cas_serve::CasStore. Construct once
(from_env) and route every ingest/read through a DedupDomain.
Implementations§
Source§impl CasSubstrate
impl CasSubstrate
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Open a substrate using the standard XET storage-path resolution
(CAS_STORAGE / XET_CACHE_DIR / ~/.cache/xet), matching the legacy
CasStore::from_env() root exactly so the default domain is layout-compatible.
Sourcepub async fn put(
&self,
domain: &DedupDomain,
data: &[u8],
hint_label: Option<SecurityLabel>,
) -> Result<BlobManifest, CasError>
pub async fn put( &self, domain: &DedupDomain, data: &[u8], hint_label: Option<SecurityLabel>, ) -> Result<BlobManifest, CasError>
Ingest bytes into a dedup domain.
Chunking (gearhash CDC), xorb aggregation, content-addressed dedup, and the
server-computed merkle all happen inside the underlying CasStore — byte
boundaries stay identical to xet-core. The substrate adds the canonical
manifest CID and derives a required, trusted content-bound
security_label from the domain (#1270).
The hint_label parameter is a D1 hint trusted only from our own staging
path (the CasMount::seal_slot joined LUB). The effective seal label is
join(domain_label(domain), hint) — restrict-only, never permissive. A
None hint yields just the domain-derived label. Callers must not pass
untrusted/caller-asserted labels — the interface policy in CLAUDE.md
forbids caller-supplied labels as authoritative PDP inputs.
Only BLAKE3-256 ingest is implemented today: the merkle the store
computes is the 32-byte BLAKE3 reconstruction hash, so the domain must
declare (Blake3, digest_length = 32). Any other (algorithm, length)
pair is rejected rather than mislabeled with a CID that claims the wrong
algorithm/width. The domain vocabulary still keys every algorithm and
width (see DedupDomain) so future non-BLAKE3 / wider ingest (e.g. the
BLAKE3-512 at9p capsule path, #881) never dedups against BLAKE3-256 content
— it lands as a distinct, length-partitioned storage root.
Sourcepub async fn get(
&self,
domain: &DedupDomain,
address: &str,
) -> Result<Vec<u8>, CasError>
pub async fn get( &self, domain: &DedupDomain, address: &str, ) -> Result<Vec<u8>, CasError>
Reconstruct a blob’s bytes by content address within a domain.
address may be a canonical CID or a legacy hex merkle (see
merkle_from_address).
Sourcepub fn manifest(
&self,
domain: &DedupDomain,
cid: &str,
) -> Result<BlobManifest, CasError>
pub fn manifest( &self, domain: &DedupDomain, cid: &str, ) -> Result<BlobManifest, CasError>
Load and verify the sealed manifest named by a manifest CID.
Sourcepub async fn read_xorb(
&self,
domain: &DedupDomain,
xorb_hash_hex: &str,
) -> Result<Vec<u8>, CasError>
pub async fn read_xorb( &self, domain: &DedupDomain, xorb_hash_hex: &str, ) -> Result<Vec<u8>, CasError>
Read the raw bytes of a single stored xorb, keyed by its hex xorb hash,
within a domain. Backs the HuggingFace-XET GET /get_xorb/{hash}/ route.
Sourcepub fn exists(&self, domain: &DedupDomain, address: &str) -> bool
pub fn exists(&self, domain: &DedupDomain, address: &str) -> bool
True if the substrate can serve this content address within the domain.
Trait Implementations§
Source§impl Clone for CasSubstrate
impl Clone for CasSubstrate
Source§fn clone(&self) -> CasSubstrate
fn clone(&self) -> CasSubstrate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CasSubstrate
impl RefUnwindSafe for CasSubstrate
impl Send for CasSubstrate
impl Sync for CasSubstrate
impl Unpin for CasSubstrate
impl UnsafeUnpin for CasSubstrate
impl UnwindSafe for CasSubstrate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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