pub struct InMemoryRegistry { /* private fields */ }Expand description
In-memory implementation for v0.3.7. Holds manifests + PTX text in a
Mutex<HashMap> keyed by "{name}@{version}".
The HMAC-SHA256 signing key is held in a zeroize::Zeroizing so the
scrub-on-drop guarantees from the snapshot signing path apply here too:
the secret material does not linger in the heap arena after the
registry is dropped.
Implementations§
Source§impl InMemoryRegistry
impl InMemoryRegistry
Sourcepub fn new(hmac_key: [u8; 32]) -> Self
pub fn new(hmac_key: [u8; 32]) -> Self
Construct an empty registry that accepts manifests signed under
hmac_key.
Sourcepub fn publish(
&self,
manifest: KernelManifest,
ptx_text: String,
) -> Result<(), RegistryError>
pub fn publish( &self, manifest: KernelManifest, ptx_text: String, ) -> Result<(), RegistryError>
Verify, then insert, a signed manifest plus its PTX text.
Returns RegistryError::DigestMismatch if BLAKE3 of ptx_text
does not match manifest.digest, RegistryError::BadSignature
if the HMAC does not verify under the configured key, and
RegistryError::AlreadyRegistered if name@version is already
present. The check order (digest → signature → uniqueness) is
deliberate: a digest mismatch is the cheapest tell that the
PTX/manifest pair was corrupted in transit, so we surface that
before doing the constant-time HMAC compare.
Trait Implementations§
Source§impl KernelRegistry for InMemoryRegistry
impl KernelRegistry for InMemoryRegistry
Source§fn get(
&self,
name: &str,
version: &str,
) -> Result<Arc<(KernelManifest, String)>, RegistryError>
fn get( &self, name: &str, version: &str, ) -> Result<Arc<(KernelManifest, String)>, RegistryError>
(name, version) to the verified manifest + PTX text.Source§fn publish(
&self,
manifest: KernelManifest,
ptx_text: String,
) -> Result<(), RegistryError>
fn publish( &self, manifest: KernelManifest, ptx_text: String, ) -> Result<(), RegistryError>
Source§fn list(&self) -> Vec<KernelManifest>
fn list(&self) -> Vec<KernelManifest>
Source§fn list_paginated(&self, offset: usize, limit: usize) -> Vec<KernelManifest>
fn list_paginated(&self, offset: usize, limit: usize) -> Vec<KernelManifest>
Self::list — backends with native pagination support (see
DiskRegistry::list_paginated) override this to avoid
materialising the full set when only a page is asked for. Read moreAuto Trait Implementations§
impl !Freeze for InMemoryRegistry
impl !RefUnwindSafe for InMemoryRegistry
impl Send for InMemoryRegistry
impl Sync for InMemoryRegistry
impl Unpin for InMemoryRegistry
impl UnsafeUnpin for InMemoryRegistry
impl UnwindSafe for InMemoryRegistry
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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