Skip to content

Commit

Permalink
Remove get by nano::root overload
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Nov 3, 2024
1 parent efa0652 commit a9d90ee
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 27 deletions.
4 changes: 2 additions & 2 deletions nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5482,8 +5482,8 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
ASSERT_FALSE (rocksdb_store.confirmation_height.get (rocksdb_transaction, nano::dev::genesis_key.pub, confirmation_height_info));
ASSERT_EQ (confirmation_height_info.height, 2);
ASSERT_EQ (confirmation_height_info.frontier, send->hash ());
ASSERT_EQ (rocksdb_store.final_vote.get (rocksdb_transaction, nano::root (send->previous ())).size (), 1);
ASSERT_EQ (rocksdb_store.final_vote.get (rocksdb_transaction, nano::root (send->previous ()))[0], nano::block_hash (2));
ASSERT_TRUE (rocksdb_store.final_vote.get (rocksdb_transaction, send->qualified_root ()).has_value ());
ASSERT_EQ (rocksdb_store.final_vote.get (rocksdb_transaction, send->qualified_root ()).value (), nano::block_hash (2));

// Retry migration while rocksdb folder is still present
auto error_on_retry = ledger.migrate_lmdb_to_rocksdb (path);
Expand Down
1 change: 0 additions & 1 deletion nano/store/final_vote.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class final_vote

public:
virtual bool put (store::write_transaction const & transaction_a, nano::qualified_root const & root_a, nano::block_hash const & hash_a) = 0;
virtual std::vector<nano::block_hash> get (store::transaction const & transaction_a, nano::root const & root_a) = 0;
virtual std::optional<nano::block_hash> get (store::transaction const & transaction_a, nano::qualified_root const & qualified_root_a) = 0;
virtual void del (store::write_transaction const & transaction_a, nano::root const & root_a) = 0;
virtual size_t count (store::transaction const & transaction_a) const = 0;
Expand Down
11 changes: 0 additions & 11 deletions nano/store/lmdb/final_vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@ bool nano::store::lmdb::final_vote::put (store::write_transaction const & transa
return result;
}

std::vector<nano::block_hash> nano::store::lmdb::final_vote::get (store::transaction const & transaction, nano::root const & root_a)
{
std::vector<nano::block_hash> result;
nano::qualified_root key_start{ root_a.raw, 0 };
for (auto i = begin (transaction, key_start), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
{
result.push_back (i->second);
}
return result;
}

std::optional<nano::block_hash> nano::store::lmdb::final_vote::get (store::transaction const & transaction, nano::qualified_root const & qualified_root_a)
{
nano::store::lmdb::db_val result;
Expand Down
1 change: 0 additions & 1 deletion nano/store/lmdb/final_vote.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class final_vote : public nano::store::final_vote
public:
explicit final_vote (nano::store::lmdb::component & store);
bool put (store::write_transaction const & transaction_a, nano::qualified_root const & root_a, nano::block_hash const & hash_a) override;
std::vector<nano::block_hash> get (store::transaction const & transaction_a, nano::root const & root_a) override;
std::optional<nano::block_hash> get (store::transaction const & transaction_a, nano::qualified_root const & qualified_root_a) override;
void del (store::write_transaction const & transaction_a, nano::root const & root_a) override;
size_t count (store::transaction const & transaction_a) const override;
Expand Down
11 changes: 0 additions & 11 deletions nano/store/rocksdb/final_vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ bool nano::store::rocksdb::final_vote::put (store::write_transaction const & tra
return result;
}

std::vector<nano::block_hash> nano::store::rocksdb::final_vote::get (store::transaction const & transaction, nano::root const & root_a)
{
std::vector<nano::block_hash> result;
nano::qualified_root key_start{ root_a.raw, 0 };
for (auto i = begin (transaction, key_start), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
{
result.push_back (i->second);
}
return result;
}

std::optional<nano::block_hash> nano::store::rocksdb::final_vote::get (store::transaction const & transaction, nano::qualified_root const & qualified_root_a)
{
nano::store::rocksdb::db_val result;
Expand Down
1 change: 0 additions & 1 deletion nano/store/rocksdb/final_vote.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class final_vote : public nano::store::final_vote
public:
explicit final_vote (nano::store::rocksdb::component & store);
bool put (store::write_transaction const & transaction_a, nano::qualified_root const & root_a, nano::block_hash const & hash_a) override;
std::vector<nano::block_hash> get (store::transaction const & transaction_a, nano::root const & root_a) override;
std::optional<nano::block_hash> get (store::transaction const & transaction_a, nano::qualified_root const & qualified_root_a) override;
void del (store::write_transaction const & transaction_a, nano::root const & root_a) override;
size_t count (store::transaction const & transaction_a) const override;
Expand Down

0 comments on commit a9d90ee

Please sign in to comment.