pub struct SerializedModuleCache {
pub plru: MicroCache,
pub key_map: PlruKeyMap,
pub cache: BTreeMap<CacheKey, Arc<SerializedModule>>,
pub make_engine: fn() -> Engine,
pub runtime_engine: Engine,
pub maybe_fs_dir: Option<PathBuf>,
}
Expand description
Cache for serialized modules. These are fully compiled wasm modules that are then serialized by wasmer and can be cached. A serialized wasm module must still be deserialized before it can be used to build instances. The deserialization process is far faster than compiling and much slower than instance building.
Fields§
§plru: MicroCache
§key_map: PlruKeyMap
§cache: BTreeMap<CacheKey, Arc<SerializedModule>>
§make_engine: fn() -> Engine
§runtime_engine: Engine
§maybe_fs_dir: Option<PathBuf>
Implementations§
source§impl SerializedModuleCache
impl SerializedModuleCache
Trait Implementations§
source§impl Debug for SerializedModuleCache
impl Debug for SerializedModuleCache
source§impl PlruCache for SerializedModuleCache
impl PlruCache for SerializedModuleCache
source§fn plru_mut(&mut self) -> &mut MicroCache
fn plru_mut(&mut self) -> &mut MicroCache
Accessor for mutable reference to internal plru cache.
source§fn key_map_mut(&mut self) -> &mut PlruKeyMap
fn key_map_mut(&mut self) -> &mut PlruKeyMap
Mutable accessor to mapping between plru cache bits and cache keys.
source§fn key_map(&self) -> &PlruKeyMap
fn key_map(&self) -> &PlruKeyMap
Accessor to mapping between plru cache bits and cache keys.
source§fn cache(&self) -> &BTreeMap<CacheKey, Arc<Self::Item>>
fn cache(&self) -> &BTreeMap<CacheKey, Arc<Self::Item>>
Accessor to the cache key addressable cache of items.
source§fn cache_mut(&mut self) -> &mut BTreeMap<CacheKey, Arc<Self::Item>>
fn cache_mut(&mut self) -> &mut BTreeMap<CacheKey, Arc<Self::Item>>
Mutable accessor to the cache key addressable cache of items.
source§fn put_item(&mut self, key: CacheKey, item: Arc<Self::Item>) -> Arc<Self::Item>
fn put_item(&mut self, key: CacheKey, item: Arc<Self::Item>) -> Arc<Self::Item>
Put an item in both the plru cache and the item cache by its cache key.
If the cache is full, the roughly most stale plru will be evicted from the
item cache and reassigned to the new item.
source§fn plru_key(&self, key: &CacheKey) -> usize
fn plru_key(&self, key: &CacheKey) -> usize
Get the plru key for a given cache key. Will panic if the mapping does not
exist so the caller MUST NOT request the plru on a cache miss AND that the
cache is never set such as to cause a hit without also setting the plru.
source§fn touch(&mut self, key: &CacheKey)
fn touch(&mut self, key: &CacheKey)
Touches the plru such that the given CacheKey becomes the most recently
used item.
source§fn trash(&mut self, key: &CacheKey)
fn trash(&mut self, key: &CacheKey)
Delete the plru for a given cache key. Care must be taken to ensure this
is not called before a subsequent call to
plru_key
or it will panic.Auto Trait Implementations§
impl !Freeze for SerializedModuleCache
impl !RefUnwindSafe for SerializedModuleCache
impl Send for SerializedModuleCache
impl Sync for SerializedModuleCache
impl Unpin for SerializedModuleCache
impl !UnwindSafe for SerializedModuleCache
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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>
Converts
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>
Converts
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> LayoutRaw for T
impl<T> LayoutRaw for T
source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> Upcastable for T
impl<T> Upcastable for T
source§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
source§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref