Iterating through duplicate keys for unchecked blocks.
This commit is contained in:
parent
5f196ee751
commit
9d39546390
2 changed files with 12 additions and 1 deletions
|
@ -1477,6 +1477,16 @@ rai::store_iterator & rai::store_iterator::operator ++ ()
|
|||
return *this;
|
||||
}
|
||||
|
||||
void rai::store_iterator::next_dup ()
|
||||
{
|
||||
assert (cursor != nullptr);
|
||||
auto status (mdb_cursor_get (cursor, ¤t.first, ¤t.second, MDB_NEXT_DUP));
|
||||
if (status == MDB_NOTFOUND)
|
||||
{
|
||||
current.clear ();
|
||||
}
|
||||
}
|
||||
|
||||
rai::store_iterator & rai::store_iterator::operator = (rai::store_iterator && other_a)
|
||||
{
|
||||
if (cursor != nullptr)
|
||||
|
@ -2346,7 +2356,7 @@ void rai::block_store::unchecked_put (MDB_txn * transaction_a, rai::block_hash c
|
|||
std::vector <std::unique_ptr <rai::block>> rai::block_store::unchecked_get (MDB_txn * transaction_a, rai::block_hash const & hash_a)
|
||||
{
|
||||
std::vector <std::unique_ptr <rai::block>> result;
|
||||
for (auto i (unchecked_begin (transaction_a, hash_a)), n (unchecked_begin (transaction_a, hash_a.number () + 1)); i != n && rai::block_hash (i->first) == hash_a; ++i)
|
||||
for (auto i (unchecked_begin (transaction_a, hash_a)), n (unchecked_end ()); i != n && rai::block_hash (i->first) == hash_a; i.next_dup ())
|
||||
{
|
||||
rai::bufferstream stream (reinterpret_cast <uint8_t const *> (i->second.mv_data), i->second.mv_size);
|
||||
result.push_back (rai::deserialize_block (stream));
|
||||
|
|
|
@ -273,6 +273,7 @@ public:
|
|||
store_iterator (rai::store_iterator const &) = delete;
|
||||
~store_iterator ();
|
||||
rai::store_iterator & operator ++ ();
|
||||
void next_dup();
|
||||
rai::store_iterator & operator = (rai::store_iterator &&);
|
||||
rai::store_iterator & operator = (rai::store_iterator const &) = delete;
|
||||
rai::store_entry & operator -> ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue