Kagome
Polkadot Runtime Engine in C++17
module_cache.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_WAVM_MODULE_CACHE_HPP
7 #define KAGOME_CORE_RUNTIME_WAVM_MODULE_CACHE_HPP
8 
10 
11 #include <WAVM/Runtime/Runtime.h>
13 #include "log/logger.hpp"
14 
15 namespace kagome::crypto {
16  class Hasher;
17 }
18 
19 namespace kagome::runtime::wavm {
20  namespace fs = kagome::filesystem;
21 
27  struct ModuleCache : public WAVM::Runtime::ObjectCacheInterface {
28  public:
29  ModuleCache(std::shared_ptr<crypto::Hasher> hasher, fs::path cache_dir);
30 
31  std::vector<WAVM::U8> getCachedObject(
32  const WAVM::U8 *wasmBytes,
33  WAVM::Uptr numWASMBytes,
34  std::function<std::vector<WAVM::U8>()> &&compileThunk) override;
35 
36  private:
37  fs::path cache_dir_;
38  std::shared_ptr<crypto::Hasher> hasher_;
40  };
41 
42 } // namespace kagome::runtime::wavm
43 
44 #endif // KAGOME_CORE_RUNTIME_WAVM_MODULE_CACHE_HPP
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
std::shared_ptr< crypto::Hasher > hasher_