pub struct GuestCacheReader { /* private fields */ }Expand description
Read-only view of the guest’s heap-resident cap directory.
Implementations§
Source§impl GuestCacheReader
impl GuestCacheReader
Sourcepub unsafe fn new(boot_info: &BootInfo) -> Result<Self, GuestCacheReaderError>
pub unsafe fn new(boot_info: &BootInfo) -> Result<Self, GuestCacheReaderError>
Construct a reader from a BootInfo block.
§Safety
boot_info.magicmust equal [BootInfo::MAGIC].boot_info.directory_vamust point at aGuestDirectoryvalue living in the same address space (= the host’s process), allocated through the sameFixedStateseed as the guest’sDIRECTORY_HASHER_SEED.- The reader must not outlive the sandbox that owns the directory.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of blob entries in the guest’s directory.
§Safety
Implicit: see the type’s safety section. We declare this
pub (not unsafe) on the strength of the new contract
— once you have a GuestCacheReader, every read assumes
the directory is quiescent.
Sourcepub fn get(&self, hash: &CapHash) -> Option<Arc<Cap>>
pub fn get(&self, hash: &CapHash) -> Option<Arc<Cap>>
Look up a cap by content hash. Returns an Arc::clone of the
guest’s Arc<Cap> if the blob is published; None otherwise.
The returned Arc keeps the guest’s Cap data alive across the
lookup boundary — even if the guest later overwrites or removes
the entry, the caller’s Arc stays valid (the data is freed only
when the last Arc clone drops).
Trait Implementations§
impl Send for GuestCacheReader
impl Sync for GuestCacheReader
Auto Trait Implementations§
impl Freeze for GuestCacheReader
impl !RefUnwindSafe for GuestCacheReader
impl Unpin for GuestCacheReader
impl UnsafeUnpin for GuestCacheReader
impl !UnwindSafe for GuestCacheReader
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
§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>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.