Moving nano::store to nano::store::component.
This commit is contained in:
parent
29cd166fe5
commit
cec9adf98a
31 changed files with 129 additions and 97 deletions
|
|
@ -5558,7 +5558,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
|
|||
.build_shared ();
|
||||
|
||||
nano::endpoint_key endpoint_key (address.to_bytes (), port);
|
||||
auto version = nano::store::version_current;
|
||||
auto version = nano::store::component::version_current;
|
||||
|
||||
{
|
||||
auto transaction = store.tx_begin_write ();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class transaction;
|
||||
|
||||
class rep_weights
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/store/component.hpp>
|
||||
|
||||
nano::backlog_population::backlog_population (const config & config_a, nano::store & store_a, nano::stats & stats_a) :
|
||||
nano::backlog_population::backlog_population (const config & config_a, nano::store::component & store_a, nano::stats & stats_a) :
|
||||
config_m{ config_a },
|
||||
store{ store_a },
|
||||
stats{ stats_a }
|
||||
|
|
|
|||
|
|
@ -12,7 +12,10 @@
|
|||
namespace nano
|
||||
{
|
||||
class stats;
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class election_scheduler;
|
||||
|
||||
class backlog_population final
|
||||
|
|
@ -30,7 +33,7 @@ public:
|
|||
unsigned frequency;
|
||||
};
|
||||
|
||||
backlog_population (const config &, nano::store &, nano::stats &);
|
||||
backlog_population (const config &, nano::store::component &, nano::stats &);
|
||||
~backlog_population ();
|
||||
|
||||
void start ();
|
||||
|
|
@ -50,7 +53,7 @@ public:
|
|||
callback_t activate_callback;
|
||||
|
||||
private: // Dependencies
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::stats & stats;
|
||||
|
||||
config config_m;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <nano/store/component.hpp>
|
||||
|
||||
// TODO: Make threads configurable
|
||||
nano::bootstrap_server::bootstrap_server (nano::store & store_a, nano::ledger & ledger_a, nano::network_constants const & network_constants_a, nano::stats & stats_a) :
|
||||
nano::bootstrap_server::bootstrap_server (nano::store::component & store_a, nano::ledger & ledger_a, nano::network_constants const & network_constants_a, nano::stats & stats_a) :
|
||||
store{ store_a },
|
||||
ledger{ ledger_a },
|
||||
network_constants{ network_constants_a },
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public:
|
|||
using request_t = std::pair<nano::asc_pull_req, std::shared_ptr<nano::transport::channel>>; // <request, response channel>
|
||||
|
||||
public:
|
||||
bootstrap_server (nano::store &, nano::ledger &, nano::network_constants const &, nano::stats &);
|
||||
bootstrap_server (nano::store::component &, nano::ledger &, nano::network_constants const &, nano::stats &);
|
||||
~bootstrap_server ();
|
||||
|
||||
void start ();
|
||||
|
|
@ -71,7 +71,7 @@ private:
|
|||
bool verify_request_type (nano::asc_pull_type) const;
|
||||
|
||||
private: // Dependencies
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::ledger & ledger;
|
||||
nano::network_constants const & network_constants;
|
||||
nano::stats & stats;
|
||||
|
|
@ -83,4 +83,4 @@ public: // Config
|
|||
/** Maximum number of blocks to send in a single response, cannot be higher than capacity of a single `asc_pull_ack` message */
|
||||
constexpr static std::size_t max_blocks = nano::asc_pull_ack::blocks_payload::max_blocks;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* database_iterator
|
||||
*/
|
||||
|
||||
nano::bootstrap_ascending::database_iterator::database_iterator (nano::store & store_a, table_type table_a) :
|
||||
nano::bootstrap_ascending::database_iterator::database_iterator (nano::store::component & store_a, table_type table_a) :
|
||||
store{ store_a },
|
||||
table{ table_a }
|
||||
{
|
||||
|
|
@ -57,7 +57,7 @@ void nano::bootstrap_ascending::database_iterator::next (nano::transaction & tx)
|
|||
* buffered_iterator
|
||||
*/
|
||||
|
||||
nano::bootstrap_ascending::buffered_iterator::buffered_iterator (nano::store & store_a) :
|
||||
nano::bootstrap_ascending::buffered_iterator::buffered_iterator (nano::store::component & store_a) :
|
||||
store{ store_a },
|
||||
accounts_iterator{ store, database_iterator::table_type::account },
|
||||
pending_iterator{ store, database_iterator::table_type::pending }
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class transaction;
|
||||
|
||||
namespace bootstrap_ascending
|
||||
|
|
@ -20,12 +23,12 @@ namespace bootstrap_ascending
|
|||
pending
|
||||
};
|
||||
|
||||
explicit database_iterator (nano::store & store, table_type);
|
||||
explicit database_iterator (nano::store::component & store, table_type);
|
||||
nano::account operator* () const;
|
||||
void next (nano::transaction & tx);
|
||||
|
||||
private:
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::account current{ 0 };
|
||||
const table_type table;
|
||||
};
|
||||
|
|
@ -33,7 +36,7 @@ namespace bootstrap_ascending
|
|||
class buffered_iterator
|
||||
{
|
||||
public:
|
||||
explicit buffered_iterator (nano::store & store);
|
||||
explicit buffered_iterator (nano::store::component & store);
|
||||
nano::account operator* () const;
|
||||
nano::account next ();
|
||||
// Indicates if a full ledger iteration has taken place e.g. warmed up
|
||||
|
|
@ -43,7 +46,7 @@ namespace bootstrap_ascending
|
|||
void fill ();
|
||||
|
||||
private:
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
std::deque<nano::account> buffer;
|
||||
bool warmup_m{ true };
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
void reset_confirmation_heights (nano::write_transaction const & transaction, nano::ledger_constants & constants, nano::store & store);
|
||||
void reset_confirmation_heights (nano::write_transaction const & transaction, nano::ledger_constants & constants, nano::store::component & store);
|
||||
bool is_using_rocksdb (boost::filesystem::path const & data_path, boost::program_options::variables_map const & vm, std::error_code & ec);
|
||||
}
|
||||
|
||||
|
|
@ -1316,7 +1316,7 @@ std::unique_ptr<nano::inactive_node> nano::default_inactive_node (boost::filesys
|
|||
|
||||
namespace
|
||||
{
|
||||
void reset_confirmation_heights (nano::write_transaction const & transaction, nano::ledger_constants & constants, nano::store & store)
|
||||
void reset_confirmation_heights (nano::write_transaction const & transaction, nano::ledger_constants & constants, nano::store::component & store)
|
||||
{
|
||||
// First do a clean sweep
|
||||
store.confirmation_height.clear (transaction);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <nano/node/epoch_upgrader.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
|
||||
nano::epoch_upgrader::epoch_upgrader (nano::node & node_a, nano::ledger & ledger_a, nano::store & store_a, nano::network_params & network_params_a, nano::logger_mt & logger_a) :
|
||||
nano::epoch_upgrader::epoch_upgrader (nano::node & node_a, nano::ledger & ledger_a, nano::store::component & store_a, nano::network_params & network_params_a, nano::logger_mt & logger_a) :
|
||||
node{ node_a },
|
||||
ledger{ ledger_a },
|
||||
store{ store_a },
|
||||
|
|
|
|||
|
|
@ -10,14 +10,17 @@ namespace nano
|
|||
{
|
||||
class node;
|
||||
class ledger;
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class network_params;
|
||||
class logger_mt;
|
||||
|
||||
class epoch_upgrader final
|
||||
{
|
||||
public:
|
||||
epoch_upgrader (nano::node &, nano::ledger &, nano::store &, nano::network_params &, nano::logger_mt &);
|
||||
epoch_upgrader (nano::node &, nano::ledger &, nano::store::component &, nano::network_params &, nano::logger_mt &);
|
||||
|
||||
bool start (nano::raw_key const & prv, nano::epoch epoch, uint64_t count_limit, uint64_t threads);
|
||||
void stop ();
|
||||
|
|
@ -25,7 +28,7 @@ public:
|
|||
private: // Dependencies
|
||||
nano::node & node;
|
||||
nano::ledger & ledger;
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::network_params & network_params;
|
||||
nano::logger_mt & logger;
|
||||
|
||||
|
|
@ -35,4 +38,4 @@ private:
|
|||
std::atomic<bool> stopped{ false };
|
||||
nano::locked<std::future<void>> epoch_upgrading;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ void mdb_val::convert_buffer_to_value ()
|
|||
|
||||
nano::lmdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path const & path_a, nano::ledger_constants & constants, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade_a) :
|
||||
// clang-format off
|
||||
nano::store{
|
||||
nano::store::component{
|
||||
block_store,
|
||||
frontier_store,
|
||||
account_store,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace lmdb
|
|||
/**
|
||||
* mdb implementation of the block store
|
||||
*/
|
||||
class store : public nano::store
|
||||
class store : public nano::store::component
|
||||
{
|
||||
private:
|
||||
nano::lmdb::account_store account_store;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
std::unique_ptr<nano::store> nano::make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool read_only, bool add_db_postfix, nano::rocksdb_config const & rocksdb_config, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade)
|
||||
std::unique_ptr<nano::store::component> nano::make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool read_only, bool add_db_postfix, nano::rocksdb_config const & rocksdb_config, nano::txn_tracking_config const & txn_tracking_config_a, std::chrono::milliseconds block_processor_batch_max_time_a, nano::lmdb_config const & lmdb_config_a, bool backup_before_upgrade)
|
||||
{
|
||||
if (rocksdb_config.enable)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,11 +17,15 @@ namespace nano
|
|||
class ledger_constants;
|
||||
class lmdb_config;
|
||||
class rocksdb_config;
|
||||
class store;
|
||||
class txn_tracking_config;
|
||||
}
|
||||
|
||||
namespace nano::store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
std::unique_ptr<nano::store> make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = true, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false);
|
||||
std::unique_ptr<nano::store::component> make_store (nano::logger_mt & logger, boost::filesystem::path const & path, nano::ledger_constants & constants, bool open_read_only = false, bool add_db_postfix = true, nano::rocksdb_config const & rocksdb_config = nano::rocksdb_config{}, nano::txn_tracking_config const & txn_tracking_config_a = nano::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), nano::lmdb_config const & lmdb_config_a = nano::lmdb_config{}, bool backup_before_upgrade = false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/websocket.hpp>
|
||||
#include <nano/secure/buffer.hpp>
|
||||
#include <nano/store/component.hpp>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
|
|
|||
|
|
@ -152,8 +152,8 @@ public:
|
|||
nano::work_pool & work;
|
||||
nano::distributed_work_factory distributed_work;
|
||||
nano::logger_mt logger;
|
||||
std::unique_ptr<nano::store> store_impl;
|
||||
nano::store & store;
|
||||
std::unique_ptr<nano::store::component> store_impl;
|
||||
nano::store::component & store;
|
||||
nano::unchecked_map unchecked;
|
||||
std::unique_ptr<nano::wallets_store> wallets_store_impl;
|
||||
nano::wallets_store & wallets_store;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ void rocksdb_val::convert_buffer_to_value ()
|
|||
|
||||
nano::rocksdb::store::store (nano::logger_mt & logger_a, boost::filesystem::path const & path_a, nano::ledger_constants & constants, nano::rocksdb_config const & rocksdb_config_a, bool open_read_only_a) :
|
||||
// clang-format off
|
||||
nano::store{
|
||||
nano::store::component{
|
||||
block_store,
|
||||
frontier_store,
|
||||
account_store,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace rocksdb
|
|||
/**
|
||||
* rocksdb implementation of the block store
|
||||
*/
|
||||
class store : public nano::store
|
||||
class store : public nano::store::component
|
||||
{
|
||||
private:
|
||||
nano::rocksdb::account_store account_store;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ namespace nano
|
|||
{
|
||||
class signature_checker;
|
||||
class active_transactions;
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class node_observers;
|
||||
class stats;
|
||||
class node_config;
|
||||
|
|
|
|||
|
|
@ -1696,7 +1696,7 @@ void nano::wallets::ongoing_compute_reps ()
|
|||
});
|
||||
}
|
||||
|
||||
void nano::wallets::split_if_needed (nano::transaction & transaction_destination, nano::store & store_a)
|
||||
void nano::wallets::split_if_needed (nano::transaction & transaction_destination, nano::store::component & store_a)
|
||||
{
|
||||
auto store_l = dynamic_cast<nano::lmdb::store *> (&store_a);
|
||||
if (store_l != nullptr)
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ public:
|
|||
bool check_rep (nano::account const &, nano::uint128_t const &, bool const = true);
|
||||
void compute_reps ();
|
||||
void ongoing_compute_reps ();
|
||||
void split_if_needed (nano::transaction &, nano::store &);
|
||||
void split_if_needed (nano::transaction &, nano::store::component &);
|
||||
void move_table (std::string const &, MDB_txn *, MDB_txn *);
|
||||
std::unordered_map<nano::wallet_id, std::shared_ptr<nano::wallet>> get_wallets ();
|
||||
nano::network_params & network_params;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ std::shared_ptr<nano::node> nano::test::add_ipc_enabled_node (nano::test::system
|
|||
return add_ipc_enabled_node (system, node_config);
|
||||
}
|
||||
|
||||
void nano::test::reset_confirmation_height (nano::store & store, nano::account const & account)
|
||||
void nano::test::reset_confirmation_height (nano::store::component & store, nano::account const & account)
|
||||
{
|
||||
auto transaction = store.tx_begin_write ();
|
||||
nano::confirmation_height_info confirmation_height_info;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ class node_flags;
|
|||
class node_rpc_config;
|
||||
class public_key;
|
||||
class rpc;
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
|
||||
using account = public_key;
|
||||
namespace ipc
|
||||
|
|
@ -57,7 +60,7 @@ namespace test
|
|||
std::shared_ptr<nano::node> add_ipc_enabled_node (nano::test::system & system, nano::node_config & node_config, nano::node_flags const & node_flags);
|
||||
std::shared_ptr<nano::node> add_ipc_enabled_node (nano::test::system & system, nano::node_config & node_config);
|
||||
std::shared_ptr<nano::node> add_ipc_enabled_node (nano::test::system & system);
|
||||
void reset_confirmation_height (nano::store & store, nano::account const & account);
|
||||
void reset_confirmation_height (nano::store::component & store, nano::account const & account);
|
||||
void wait_response_impl (nano::test::system & system, rpc_context const & rpc_ctx, boost::property_tree::ptree & request, std::chrono::duration<double, std::nano> const & time, boost::property_tree::ptree & response_json);
|
||||
boost::property_tree::ptree wait_response (nano::test::system & system, rpc_context const & rpc_ctx, boost::property_tree::ptree & request, std::chrono::duration<double, std::nano> const & time = 5s);
|
||||
bool check_block_response_count (nano::test::system & system, rpc_context const & rpc_ctx, boost::property_tree::ptree & request, uint64_t size_count);
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ ledger_processor::ledger_processor (nano::ledger & ledger_a, nano::write_transac
|
|||
class representative_visitor final : public nano::block_visitor
|
||||
{
|
||||
public:
|
||||
representative_visitor (nano::transaction const & transaction_a, nano::store & store_a);
|
||||
representative_visitor (nano::transaction const & transaction_a, nano::store::component & store_a);
|
||||
~representative_visitor () = default;
|
||||
void compute (nano::block_hash const & hash_a);
|
||||
void send_block (nano::send_block const & block_a) override;
|
||||
|
|
@ -695,12 +695,12 @@ public:
|
|||
void change_block (nano::change_block const & block_a) override;
|
||||
void state_block (nano::state_block const & block_a) override;
|
||||
nano::transaction const & transaction;
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::block_hash current;
|
||||
nano::block_hash result;
|
||||
};
|
||||
|
||||
representative_visitor::representative_visitor (nano::transaction const & transaction_a, nano::store & store_a) :
|
||||
representative_visitor::representative_visitor (nano::transaction const & transaction_a, nano::store::component & store_a) :
|
||||
transaction (transaction_a),
|
||||
store (store_a),
|
||||
result (0)
|
||||
|
|
@ -744,7 +744,7 @@ void representative_visitor::state_block (nano::state_block const & block_a)
|
|||
}
|
||||
} // namespace
|
||||
|
||||
nano::ledger::ledger (nano::store & store_a, nano::stats & stat_a, nano::ledger_constants & constants, nano::generate_cache const & generate_cache_a) :
|
||||
nano::ledger::ledger (nano::store::component & store_a, nano::stats & stat_a, nano::ledger_constants & constants, nano::generate_cache const & generate_cache_a) :
|
||||
constants{ constants },
|
||||
store{ store_a },
|
||||
stats{ stat_a },
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
class stats;
|
||||
class write_transaction;
|
||||
|
||||
|
|
@ -27,7 +30,7 @@ public:
|
|||
class ledger final
|
||||
{
|
||||
public:
|
||||
ledger (nano::store &, nano::stats &, nano::ledger_constants & constants, nano::generate_cache const & = nano::generate_cache ());
|
||||
ledger (nano::store::component &, nano::stats &, nano::ledger_constants & constants, nano::generate_cache const & = nano::generate_cache ());
|
||||
/**
|
||||
* Return account containing hash, expects that block hash exists in ledger
|
||||
*/
|
||||
|
|
@ -92,7 +95,7 @@ public:
|
|||
uint64_t height (nano::transaction const & transaction, nano::block_hash const & hash) const;
|
||||
static nano::uint128_t const unit;
|
||||
nano::ledger_constants & constants;
|
||||
nano::store & store;
|
||||
nano::store::component & store;
|
||||
nano::ledger_cache cache;
|
||||
nano::stats & stats;
|
||||
std::unordered_map<nano::account, nano::uint128_t> bootstrap_weights;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ using namespace std::chrono_literals;
|
|||
* function to count the block in the pruned store one by one
|
||||
* we manually count the blocks one by one because the rocksdb count feature is not accurate
|
||||
*/
|
||||
size_t manually_count_pruned_blocks (nano::store & store)
|
||||
size_t manually_count_pruned_blocks (nano::store::component & store)
|
||||
{
|
||||
size_t count = 0;
|
||||
auto transaction = store.tx_begin_read ();
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ bool nano::write_transaction::contains (nano::tables table_a) const
|
|||
}
|
||||
|
||||
// clang-format off
|
||||
nano::store::store (
|
||||
nano::store::component::component (
|
||||
nano::block_store & block_store_a,
|
||||
nano::frontier_store & frontier_store_a,
|
||||
nano::account_store & account_store_a,
|
||||
|
|
@ -94,7 +94,7 @@ nano::store::store (
|
|||
* If using a different store version than the latest then you may need
|
||||
* to modify some of the objects in the store to be appropriate for the version before an upgrade.
|
||||
*/
|
||||
void nano::store::initialize (nano::write_transaction const & transaction_a, nano::ledger_cache & ledger_cache_a, nano::ledger_constants & constants)
|
||||
void nano::store::component::initialize (nano::write_transaction const & transaction_a, nano::ledger_cache & ledger_cache_a, nano::ledger_constants & constants)
|
||||
{
|
||||
debug_assert (constants.genesis->has_sideband ());
|
||||
debug_assert (account.begin (transaction_a) == account.end ());
|
||||
|
|
|
|||
|
|
@ -731,17 +731,19 @@ public:
|
|||
virtual void for_each_par (std::function<void (nano::read_transaction const &, nano::store_iterator<nano::block_hash, block_w_sideband>, nano::store_iterator<nano::block_hash, block_w_sideband>)> const & action_a) const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
namespace store
|
||||
{
|
||||
/**
|
||||
* Store manager
|
||||
*/
|
||||
class store
|
||||
{
|
||||
friend class rocksdb_block_store_tombstone_count_Test;
|
||||
friend class mdb_block_store_upgrade_v21_v22_Test;
|
||||
class component
|
||||
{
|
||||
friend class rocksdb_block_store_tombstone_count_Test;
|
||||
friend class mdb_block_store_upgrade_v21_v22_Test;
|
||||
|
||||
public:
|
||||
// clang-format off
|
||||
explicit store (
|
||||
public:
|
||||
// clang-format off
|
||||
explicit component (
|
||||
nano::block_store &,
|
||||
nano::frontier_store &,
|
||||
nano::account_store &,
|
||||
|
|
@ -753,51 +755,52 @@ public:
|
|||
nano::final_vote_store &,
|
||||
nano::version_store &
|
||||
);
|
||||
// clang-format on
|
||||
virtual ~store () = default;
|
||||
void initialize (nano::write_transaction const & transaction_a, nano::ledger_cache & ledger_cache_a, nano::ledger_constants & constants);
|
||||
virtual uint64_t count (nano::transaction const & transaction_a, tables table_a) const = 0;
|
||||
virtual int drop (nano::write_transaction const & transaction_a, tables table_a) = 0;
|
||||
virtual bool not_found (int status) const = 0;
|
||||
virtual bool success (int status) const = 0;
|
||||
virtual int status_code_not_found () const = 0;
|
||||
virtual std::string error_string (int status) const = 0;
|
||||
// clang-format on
|
||||
virtual ~component () = default;
|
||||
void initialize (nano::write_transaction const & transaction_a, nano::ledger_cache & ledger_cache_a, nano::ledger_constants & constants);
|
||||
virtual uint64_t count (nano::transaction const & transaction_a, tables table_a) const = 0;
|
||||
virtual int drop (nano::write_transaction const & transaction_a, tables table_a) = 0;
|
||||
virtual bool not_found (int status) const = 0;
|
||||
virtual bool success (int status) const = 0;
|
||||
virtual int status_code_not_found () const = 0;
|
||||
virtual std::string error_string (int status) const = 0;
|
||||
|
||||
block_store & block;
|
||||
frontier_store & frontier;
|
||||
account_store & account;
|
||||
pending_store & pending;
|
||||
static int constexpr version_minimum{ 14 };
|
||||
static int constexpr version_current{ 22 };
|
||||
block_store & block;
|
||||
frontier_store & frontier;
|
||||
account_store & account;
|
||||
pending_store & pending;
|
||||
static int constexpr version_minimum{ 14 };
|
||||
static int constexpr version_current{ 22 };
|
||||
|
||||
public:
|
||||
online_weight_store & online_weight;
|
||||
pruned_store & pruned;
|
||||
peer_store & peer;
|
||||
confirmation_height_store & confirmation_height;
|
||||
final_vote_store & final_vote;
|
||||
version_store & version;
|
||||
public:
|
||||
online_weight_store & online_weight;
|
||||
pruned_store & pruned;
|
||||
peer_store & peer;
|
||||
confirmation_height_store & confirmation_height;
|
||||
final_vote_store & final_vote;
|
||||
version_store & version;
|
||||
|
||||
virtual unsigned max_block_write_batch_num () const = 0;
|
||||
virtual unsigned max_block_write_batch_num () const = 0;
|
||||
|
||||
virtual bool copy_db (boost::filesystem::path const & destination) = 0;
|
||||
virtual void rebuild_db (nano::write_transaction const & transaction_a) = 0;
|
||||
virtual bool copy_db (boost::filesystem::path const & destination) = 0;
|
||||
virtual void rebuild_db (nano::write_transaction const & transaction_a) = 0;
|
||||
|
||||
/** Not applicable to all sub-classes */
|
||||
virtual void serialize_mdb_tracker (boost::property_tree::ptree &, std::chrono::milliseconds, std::chrono::milliseconds){};
|
||||
virtual void serialize_memory_stats (boost::property_tree::ptree &) = 0;
|
||||
/** Not applicable to all sub-classes */
|
||||
virtual void serialize_mdb_tracker (boost::property_tree::ptree &, std::chrono::milliseconds, std::chrono::milliseconds){};
|
||||
virtual void serialize_memory_stats (boost::property_tree::ptree &) = 0;
|
||||
|
||||
virtual bool init_error () const = 0;
|
||||
virtual bool init_error () const = 0;
|
||||
|
||||
/** Start read-write transaction */
|
||||
virtual nano::write_transaction tx_begin_write (std::vector<nano::tables> const & tables_to_lock = {}, std::vector<nano::tables> const & tables_no_lock = {}) = 0;
|
||||
/** Start read-write transaction */
|
||||
virtual nano::write_transaction tx_begin_write (std::vector<nano::tables> const & tables_to_lock = {}, std::vector<nano::tables> const & tables_no_lock = {}) = 0;
|
||||
|
||||
/** Start read-only transaction */
|
||||
virtual nano::read_transaction tx_begin_read () const = 0;
|
||||
/** Start read-only transaction */
|
||||
virtual nano::read_transaction tx_begin_read () const = 0;
|
||||
|
||||
virtual std::string vendor_get () const = 0;
|
||||
};
|
||||
}
|
||||
virtual std::string vendor_get () const = 0;
|
||||
};
|
||||
} // namespace store
|
||||
} // namespace nano
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ nano::ledger & nano::test::context::ledger_context::ledger ()
|
|||
return ledger_m;
|
||||
}
|
||||
|
||||
nano::store & nano::test::context::ledger_context::store ()
|
||||
nano::store::component & nano::test::context::ledger_context::store ()
|
||||
{
|
||||
return *store_m;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,10 @@
|
|||
|
||||
namespace nano
|
||||
{
|
||||
class store;
|
||||
namespace store
|
||||
{
|
||||
class component;
|
||||
}
|
||||
namespace test
|
||||
{
|
||||
namespace context
|
||||
|
|
@ -19,13 +22,13 @@ namespace test
|
|||
Blocks must all return process_result::progress when processed */
|
||||
ledger_context (std::deque<std::shared_ptr<nano::block>> && blocks = std::deque<std::shared_ptr<nano::block>>{});
|
||||
nano::ledger & ledger ();
|
||||
nano::store & store ();
|
||||
nano::store::component & store ();
|
||||
nano::stats & stats ();
|
||||
std::deque<std::shared_ptr<nano::block>> const & blocks () const;
|
||||
|
||||
private:
|
||||
nano::logger_mt logger;
|
||||
std::unique_ptr<nano::store> store_m;
|
||||
std::unique_ptr<nano::store::component> store_m;
|
||||
nano::stats stats_m;
|
||||
nano::ledger ledger_m;
|
||||
std::deque<std::shared_ptr<nano::block>> blocks_m;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue