3#include <boost/lockfree/spsc_queue.hpp>
7#include <boost/multi_index_container.hpp>
8#include <boost/multi_index/hashed_index.hpp>
9#include <boost/multi_index/sequenced_index.hpp>
10#include <boost/multi_index/composite_key.hpp>
11#include <boost/multi_index/key_extractors.hpp>
13#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
14#include <boost/asio/local/datagram_protocol.hpp>
20 template<>
struct hash<
sysio::chain::eosvmoc::code_tuple> {
22 return ct.code_id._hash[0];
27namespace sysio {
namespace chain {
namespace eosvmoc {
29using namespace boost::multi_index;
35using allocator_t = bip::rbtree_best_fit<bip::null_mutex_family, bip::offset_ptr<void>,
alignof(std::max_align_t)>;
51 typedef boost::multi_index_container<
55 hashed_unique<tag<by_hash>,
57 member<code_descriptor, digest_type, &code_descriptor::code_hash>,
58 member<code_descriptor, uint8_t, &code_descriptor::vm_version>
100 std::thread _monitor_reply_thread;
101 boost::lockfree::spsc_queue<wasm_compilation_result_message> _result_queue;
102 void wait_on_compile_monitor_message();
103 std::tuple<size_t, size_t> consume_compile_thread_queue();
104 std::unordered_set<code_tuple> _blacklist;
code_cache_async(const bfs::path data_dir, const eosvmoc::config &eosvmoc_config, const chainbase::database &db)
const code_descriptor *const get_descriptor_for_code(const digest_type &code_id, const uint8_t &vm_version)
void serialize_cache_index(fc::datastream< T > &ds)
local::datagram_protocol::socket _compile_monitor_write_socket
void check_eviction_threshold(size_t free_bytes)
boost::multi_index_container< code_descriptor, indexed_by< sequenced<>, hashed_unique< tag< by_hash >, composite_key< code_descriptor, member< code_descriptor, digest_type, &code_descriptor::code_hash >, member< code_descriptor, uint8_t, &code_descriptor::vm_version > > > > > code_cache_index
local::datagram_protocol::socket _compile_monitor_read_socket
std::unordered_set< code_tuple > _queued_compiles
void run_eviction_round()
std::unordered_map< code_tuple, bool > _outstanding_compiles_and_poison
void free_code(const digest_type &code_id, const uint8_t &vm_version)
void set_on_disk_region_dirty(bool)
size_t _free_bytes_eviction_threshold
code_cache_base(const bfs::path data_dir, const eosvmoc::config &eosvmoc_config, const chainbase::database &db)
bfs::path _cache_file_path
const chainbase::database & _db
code_cache_index _cache_index
const code_descriptor *const get_descriptor_for_code_sync(const digest_type &code_id, const uint8_t &vm_version)
bip::rbtree_best_fit< bip::null_mutex_family, bip::offset_ptr< void >, alignof(std::max_align_t)> allocator_t
size_t operator()(const sysio::chain::eosvmoc::code_tuple &ct) const noexcept