Moved the online_weight LMDB table handlers to their store class

This commit is contained in:
Thiago Silva 2022-04-11 16:54:30 -03:00
commit 5edbfc8434
3 changed files with 10 additions and 8 deletions

View file

@ -212,7 +212,7 @@ void nano::lmdb::store::open_databases (bool & error_a, nano::transaction const
{
error_a |= mdb_dbi_open (env.tx (transaction_a), "frontiers", flags, &frontier_store.frontiers_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "unchecked", flags, &unchecked_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "online_weight", flags, &online_weight_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "online_weight", flags, &online_weight_store.online_weight_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "meta", flags, &meta_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "peers", flags, &peers_handle) != 0;
error_a |= mdb_dbi_open (env.tx (transaction_a), "pruned", flags, &pruned_handle) != 0;
@ -871,7 +871,7 @@ MDB_dbi nano::lmdb::store::table_to_dbi (tables table_a) const
case tables::unchecked:
return unchecked_handle;
case tables::online_weight:
return online_weight_handle;
return online_weight_store.online_weight_handle;
case tables::meta:
return meta_handle;
case tables::peers:

View file

@ -142,12 +142,6 @@ namespace lmdb
*/
MDB_dbi unchecked_handle{ 0 };
/**
* Samples of online vote weight
* uint64_t -> nano::amount
*/
MDB_dbi online_weight_handle{ 0 };
/**
* Meta information about block store, such as versions.
* nano::uint256_union (arbitrary key) -> blob

View file

@ -2,6 +2,8 @@
#include <nano/secure/store.hpp>
#include <lmdb/libraries/liblmdb/lmdb.h>
namespace nano
{
namespace lmdb
@ -20,6 +22,12 @@ namespace lmdb
nano::store_iterator<uint64_t, nano::amount> end () const override;
size_t count (nano::transaction const & transaction_a) const override;
void clear (nano::write_transaction const & transaction_a) override;
/**
* Samples of online vote weight
* uint64_t -> nano::amount
*/
MDB_dbi online_weight_handle{ 0 };
};
}
}