pub struct FilesystemContractRuntimeCache { /* private fields */ }
Expand description
A cache that stores precompiled contract executables in a directory of a filesystem.
This directory can optionally be a temporary directory. If created with Self::test
the
directory will be removed when the last instance of this cache is dropped.
Clones of this type share the same underlying state and information. The cache is thread safe and atomic.
This cache however does not implement any clean-up policies. While it is possible to truncate
a file that has been written to the cache before (put
an empty buffer), the file will remain
in place until an operator (or somebody else) removes files at their own discretion.
Implementations§
Source§impl FilesystemContractRuntimeCache
impl FilesystemContractRuntimeCache
pub fn new<SP: AsRef<Path> + ?Sized>( home_dir: &Path, store_path: Option<&SP>, ) -> Result<Self>
Sourcepub fn with_memory_cache<SP: AsRef<Path> + ?Sized>(
home_dir: &Path,
store_path: Option<&SP>,
memory_cache_size: usize,
) -> Result<Self>
pub fn with_memory_cache<SP: AsRef<Path> + ?Sized>( home_dir: &Path, store_path: Option<&SP>, memory_cache_size: usize, ) -> Result<Self>
When setting up a cache of compiled contracts, also set-up a size
element in-memory
cache.
This additional cache is usually used to store loaded artifacts, but data stored can really be anything and depends on the specific VM kind.
Note though, that this memory cache is not used to additionally cache files from the filesystem – OS page cache already does that for us transparently.
pub fn test() -> Result<Self>
Trait Implementations§
Source§impl Clone for FilesystemContractRuntimeCache
impl Clone for FilesystemContractRuntimeCache
Source§fn clone(&self) -> FilesystemContractRuntimeCache
fn clone(&self) -> FilesystemContractRuntimeCache
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl ContractRuntimeCache for FilesystemContractRuntimeCache
Cache for compiled contracts code in plain filesystem.
impl ContractRuntimeCache for FilesystemContractRuntimeCache
Cache for compiled contracts code in plain filesystem.