pub struct DenseAssetRegistry { /* private fields */ }Expand description
A bounded, generation-safe registry mapping content tokens to validated dense asset records.
Insertion is content-addressed and idempotent; resolution fails closed on unknown, tampered, or stale handles.
Implementations§
Source§impl DenseAssetRegistry
impl DenseAssetRegistry
Sourcepub fn insert(
&mut self,
section: SectionKind,
offset: u64,
length: u64,
digest_prefix: u64,
) -> Result<DenseAssetRef, QispError>
pub fn insert( &mut self, section: SectionKind, offset: u64, length: u64, digest_prefix: u64, ) -> Result<DenseAssetRef, QispError>
Insert (or return the existing handle for) a dense asset, minting a content-derived token and a fresh generation.
Returns QispError::BudgetExceeded if the registry is at MAX_ASSETS
capacity and no slot is free. Inserting content that already has a live slot
is idempotent and returns the existing handle.
Note: the plan sketches this as
-> DenseAssetRef; it is returned as aResulthere so the hard capacity bound can fail closed instead of panicking or allocating without bound (plan §6.2, §12 completeness bar).
Sourcepub fn resolve(&self, r: &DenseAssetRef) -> Result<&AssetRecord, QispError>
pub fn resolve(&self, r: &DenseAssetRef) -> Result<&AssetRecord, QispError>
Resolve a handle to its validated record. Fails closed:
QispError::UnknownAsset— the token is not present, or any of the handle’s section/offset/length/digest fields were tampered so they no longer match the stored record.QispError::StaleAsset— the token is present but the handle’s generation is older than the slot’s current generation (the slot was evicted and reused).
Never panics on a bad handle.
Sourcepub fn evict(&mut self, r: &DenseAssetRef) -> Result<(), QispError>
pub fn evict(&mut self, r: &DenseAssetRef) -> Result<(), QispError>
Evict a live asset, freeing its slot. The slot’s generation is retained so a later re-insert bumps past it, invalidating any outstanding handle.
Fails closed the same way as resolve: a forged or stale
handle cannot evict a live asset.
Trait Implementations§
Source§impl Debug for DenseAssetRegistry
impl Debug for DenseAssetRegistry
Source§impl Default for DenseAssetRegistry
impl Default for DenseAssetRegistry
Source§fn default() -> DenseAssetRegistry
fn default() -> DenseAssetRegistry
Auto Trait Implementations§
impl Freeze for DenseAssetRegistry
impl RefUnwindSafe for DenseAssetRegistry
impl Send for DenseAssetRegistry
impl Sync for DenseAssetRegistry
impl Unpin for DenseAssetRegistry
impl UnsafeUnpin for DenseAssetRegistry
impl UnwindSafe for DenseAssetRegistry
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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> 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 more