[][src]Struct cosmwasm_vm::CosmCache

pub struct CosmCache<S: Storage + 'static, A: Api + 'static, Q: Querier + 'static> { /* fields omitted */ }

Implementations

impl<S, A, Q> CosmCache<S, A, Q> where
    S: Storage + 'static,
    A: Api + 'static,
    Q: Querier + 'static, 
[src]

pub unsafe fn new<P: Into<PathBuf>>(
    base_dir: P,
    supported_features: HashSet<String>,
    _cache_size: usize
) -> VmResult<Self>
[src]

new stores the data for cache under base_dir

Instance caching is disabled since 0.8.1 and any cache size value will be treated as 0.

Safety

This function is marked unsafe due to FileSystemCache::new, which implicitly assumes the disk contents are correct, and there's no way to ensure the artifacts

pub fn save_wasm(&mut self, wasm: &[u8]) -> VmResult<Checksum>[src]

pub fn load_wasm(&self, checksum: &Checksum) -> VmResult<Vec<u8>>[src]

Retrieves a Wasm blob that was previously stored via save_wasm. When the cache is instantiated with the same base dir, this finds Wasm files on disc across multiple cache instances (i.e. node restarts). This function is public to allow a checksum to Wasm lookup in the blockchain.

If the given ID is not found or the content does not match the hash (=ID), an error is returned.

pub fn get_instance(
    &mut self,
    checksum: &Checksum,
    deps: Extern<S, A, Q>,
    gas_limit: u64
) -> VmResult<Instance<S, A, Q>>
[src]

Returns an Instance tied to a previously saved Wasm. Depending on availability, this is either generated from a cached instance, a cached module or Wasm code.

Auto Trait Implementations

impl<S, A, Q> RefUnwindSafe for CosmCache<S, A, Q> where
    A: RefUnwindSafe,
    Q: RefUnwindSafe,
    S: RefUnwindSafe

impl<S, A, Q> Send for CosmCache<S, A, Q> where
    Q: Send,
    S: Send

impl<S, A, Q> Sync for CosmCache<S, A, Q> where
    A: Sync,
    Q: Sync,
    S: Sync

impl<S, A, Q> Unpin for CosmCache<S, A, Q> where
    A: Unpin,
    Q: Unpin,
    S: Unpin

impl<S, A, Q> UnwindSafe for CosmCache<S, A, Q> where
    A: UnwindSafe,
    Q: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.