pub struct ImageCache { /* private fields */ }Expand description
Map from Image::content_hash to a parsed PvmProgram. The
PvmProgram is wrapped in Arc so the same predecoded body can be
referenced from multiple in-flight InstanceEntries (siblings) and
from concurrent threads (the kernel may eventually be
multi-threaded).
Implementations§
Source§impl ImageCache
impl ImageCache
pub fn new() -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn get(&self, content_hash: &CapHash) -> Option<Arc<PvmProgram>>
pub fn get(&self, content_hash: &CapHash) -> Option<Arc<PvmProgram>>
Look up by content hash. None if not yet cached.
Sourcepub fn insert(&mut self, content_hash: CapHash, program: Arc<PvmProgram>)
pub fn insert(&mut self, content_hash: CapHash, program: Arc<PvmProgram>)
Cache a precomputed program under the given content hash.
Sourcepub fn get_or_decode(
&mut self,
content_hash: CapHash,
code: Vec<u8>,
bitmask: Vec<u8>,
jump_table: Vec<u32>,
) -> Result<Arc<PvmProgram>, VmError>
pub fn get_or_decode( &mut self, content_hash: CapHash, code: Vec<u8>, bitmask: Vec<u8>, jump_table: Vec<u32>, ) -> Result<Arc<PvmProgram>, VmError>
Look up or compute: if the image’s content_hash is in the
cache, return the cached program; otherwise parse code,
bitmask, jump_table into a PvmProgram, cache it, and
return it.
Trait Implementations§
Source§impl Debug for ImageCache
impl Debug for ImageCache
Source§impl Default for ImageCache
impl Default for ImageCache
Source§fn default() -> ImageCache
fn default() -> ImageCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ImageCache
impl RefUnwindSafe for ImageCache
impl Send for ImageCache
impl Sync for ImageCache
impl Unpin for ImageCache
impl UnsafeUnpin for ImageCache
impl UnwindSafe for ImageCache
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> 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.