Struct locutus_runtime::prelude::ComponentStore
source · pub struct ComponentStore { /* private fields */ }Implementations§
source§impl ComponentStore
impl ComponentStore
sourcepub fn new(components_dir: PathBuf, max_size: i64) -> RuntimeResult<Self>
pub fn new(components_dir: PathBuf, max_size: i64) -> RuntimeResult<Self>
Arguments
- max_size: max size in bytes of the components being cached
sourcepub fn fetch_component(&self, key: &ComponentKey) -> Option<Component<'static>>
pub fn fetch_component(&self, key: &ComponentKey) -> Option<Component<'static>>
Examples found in repository?
src/runtime.rs (line 157)
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
pub(crate) fn prepare_component_call(
&mut self,
key: &ComponentKey,
req_bytes: usize,
) -> RuntimeResult<Instance> {
let module = if let Some(module) = self.component_modules.get(key) {
module
} else {
let contract = self
.component_store
.fetch_component(key)
.ok_or_else(|| RuntimeInnerError::ComponentNotFound(key.clone()))?;
let module = Module::new(&self.wasm_store, contract.as_ref())?;
self.component_modules.insert(key.clone(), module);
self.component_modules.get(key).unwrap()
}
.clone();
let instance = self.prepare_instance(&module)?;
self.set_instance_mem(req_bytes, &instance)?;
Ok(instance)
}sourcepub fn store_component(&mut self, component: Component<'_>) -> RuntimeResult<()>
pub fn store_component(&mut self, component: Component<'_>) -> RuntimeResult<()>
sourcepub fn remove_component(&mut self, key: &ComponentKey) -> RuntimeResult<()>
pub fn remove_component(&mut self, key: &ComponentKey) -> RuntimeResult<()>
pub fn get_component_path(
&mut self,
key: &ComponentKey
) -> RuntimeResult<PathBuf>
pub fn code_hash_from_key(&self, key: &ComponentKey) -> Option<[u8; 32]>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ComponentStore
impl Send for ComponentStore
impl Sync for ComponentStore
impl Unpin for ComponentStore
impl !UnwindSafe for ComponentStore
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.
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
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> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref