Remove unnecessary FQNs
This commit is contained in:
parent
0b6a5cc118
commit
d78f53927d
3 changed files with 42 additions and 42 deletions
|
@ -11,14 +11,14 @@ template <typename T, typename U>
|
|||
class iterator_impl
|
||||
{
|
||||
public:
|
||||
explicit iterator_impl (nano::store::transaction const & transaction_a) :
|
||||
transaction{ transaction_a },
|
||||
explicit iterator_impl (transaction const & transaction_a) :
|
||||
txn{ transaction_a },
|
||||
transaction_epoch{ transaction_a.epoch () }
|
||||
{
|
||||
}
|
||||
virtual ~iterator_impl ()
|
||||
{
|
||||
debug_assert (transaction_epoch == transaction.epoch (), "invalid iterator-transaction lifetime detected");
|
||||
debug_assert (transaction_epoch == txn.epoch (), "invalid iterator-transaction lifetime detected");
|
||||
}
|
||||
|
||||
virtual iterator_impl<T, U> & operator++ () = 0;
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
nano::store::transaction const & transaction;
|
||||
nano::store::transaction::epoch_t const transaction_epoch;
|
||||
transaction const & txn;
|
||||
transaction::epoch_t const transaction_epoch;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ template <typename T, typename U>
|
|||
class iterator : public iterator_impl<T, U>
|
||||
{
|
||||
public:
|
||||
iterator (store::transaction const & transaction_a, env const & env_a, MDB_dbi db_a, MDB_val const & val_a = MDB_val{}, bool const direction_asc = true) :
|
||||
nano::store::iterator_impl<T, U> (transaction_a)
|
||||
iterator (transaction const & transaction_a, env const & env_a, MDB_dbi db_a, MDB_val const & val_a = MDB_val{}, bool const direction_asc = true) :
|
||||
iterator_impl<T, U> (transaction_a)
|
||||
{
|
||||
auto status (mdb_cursor_open (env_a.tx (transaction_a), db_a, &cursor));
|
||||
release_assert (status == 0);
|
||||
|
@ -47,14 +47,14 @@ public:
|
|||
|
||||
iterator () = default;
|
||||
|
||||
iterator (nano::store::lmdb::iterator<T, U> && other_a)
|
||||
iterator (iterator<T, U> && other_a)
|
||||
{
|
||||
cursor = other_a.cursor;
|
||||
other_a.cursor = nullptr;
|
||||
current = other_a.current;
|
||||
}
|
||||
|
||||
iterator (nano::store::lmdb::iterator<T, U> const &) = delete;
|
||||
iterator (iterator<T, U> const &) = delete;
|
||||
|
||||
~iterator ()
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
store::iterator_impl<T, U> & operator++ () override
|
||||
iterator_impl<T, U> & operator++ () override
|
||||
{
|
||||
debug_assert (cursor != nullptr);
|
||||
auto status (mdb_cursor_get (cursor, ¤t.first.value, ¤t.second.value, MDB_NEXT));
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
store::iterator_impl<T, U> & operator-- () override
|
||||
iterator_impl<T, U> & operator-- () override
|
||||
{
|
||||
debug_assert (cursor != nullptr);
|
||||
auto status (mdb_cursor_get (cursor, ¤t.first.value, ¤t.second.value, MDB_PREV));
|
||||
|
@ -101,9 +101,9 @@ public:
|
|||
return ¤t;
|
||||
}
|
||||
|
||||
bool operator== (nano::store::lmdb::iterator<T, U> const & base_a) const
|
||||
bool operator== (iterator<T, U> const & base_a) const
|
||||
{
|
||||
auto const other_a (boost::polymorphic_downcast<nano::store::lmdb::iterator<T, U> const *> (&base_a));
|
||||
auto const other_a (boost::polymorphic_downcast<iterator<T, U> const *> (&base_a));
|
||||
auto result (current.first.data () == other_a->current.first.data ());
|
||||
debug_assert (!result || (current.first.size () == other_a->current.first.size ()));
|
||||
debug_assert (!result || (current.second.data () == other_a->current.second.data ()));
|
||||
|
@ -111,9 +111,9 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
bool operator== (store::iterator_impl<T, U> const & base_a) const override
|
||||
bool operator== (iterator_impl<T, U> const & base_a) const override
|
||||
{
|
||||
auto const other_a (boost::polymorphic_downcast<nano::store::lmdb::iterator<T, U> const *> (&base_a));
|
||||
auto const other_a (boost::polymorphic_downcast<iterator<T, U> const *> (&base_a));
|
||||
auto result (current.first.data () == other_a->current.first.data ());
|
||||
debug_assert (!result || (current.first.size () == other_a->current.first.size ()));
|
||||
debug_assert (!result || (current.second.data () == other_a->current.second.data ()));
|
||||
|
@ -151,7 +151,7 @@ public:
|
|||
debug_assert (is_end_sentinal ());
|
||||
}
|
||||
|
||||
nano::store::lmdb::iterator<T, U> & operator= (nano::store::lmdb::iterator<T, U> && other_a)
|
||||
iterator<T, U> & operator= (iterator<T, U> && other_a)
|
||||
{
|
||||
if (cursor != nullptr)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
store::iterator_impl<T, U> & operator= (store::iterator_impl<T, U> const &) = delete;
|
||||
iterator_impl<T, U> & operator= (iterator_impl<T, U> const &) = delete;
|
||||
MDB_cursor * cursor{ nullptr };
|
||||
std::pair<store::db_val<MDB_val>, store::db_val<MDB_val>> current;
|
||||
};
|
||||
|
@ -176,21 +176,21 @@ template <typename T, typename U>
|
|||
class merge_iterator : public iterator_impl<T, U>
|
||||
{
|
||||
public:
|
||||
merge_iterator (store::transaction const & transaction_a, MDB_dbi db1_a, MDB_dbi db2_a) :
|
||||
impl1 (std::make_unique<nano::store::lmdb::iterator<T, U>> (transaction_a, db1_a)),
|
||||
impl2 (std::make_unique<nano::store::lmdb::iterator<T, U>> (transaction_a, db2_a))
|
||||
merge_iterator (transaction const & transaction_a, MDB_dbi db1_a, MDB_dbi db2_a) :
|
||||
impl1 (std::make_unique<iterator<T, U>> (transaction_a, db1_a)),
|
||||
impl2 (std::make_unique<iterator<T, U>> (transaction_a, db2_a))
|
||||
{
|
||||
}
|
||||
|
||||
merge_iterator () :
|
||||
impl1 (std::make_unique<nano::store::lmdb::iterator<T, U>> ()),
|
||||
impl2 (std::make_unique<nano::store::lmdb::iterator<T, U>> ())
|
||||
impl1 (std::make_unique<iterator<T, U>> ()),
|
||||
impl2 (std::make_unique<iterator<T, U>> ())
|
||||
{
|
||||
}
|
||||
|
||||
merge_iterator (store::transaction const & transaction_a, MDB_dbi db1_a, MDB_dbi db2_a, MDB_val const & val_a) :
|
||||
impl1 (std::make_unique<nano::store::lmdb::iterator<T, U>> (transaction_a, db1_a, val_a)),
|
||||
impl2 (std::make_unique<nano::store::lmdb::iterator<T, U>> (transaction_a, db2_a, val_a))
|
||||
merge_iterator (transaction const & transaction_a, MDB_dbi db1_a, MDB_dbi db2_a, MDB_val const & val_a) :
|
||||
impl1 (std::make_unique<iterator<T, U>> (transaction_a, db1_a, val_a)),
|
||||
impl2 (std::make_unique<iterator<T, U>> (transaction_a, db2_a, val_a))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -202,13 +202,13 @@ public:
|
|||
|
||||
merge_iterator (merge_iterator<T, U> const &) = delete;
|
||||
|
||||
store::iterator_impl<T, U> & operator++ () override
|
||||
iterator_impl<T, U> & operator++ () override
|
||||
{
|
||||
++least_iterator ();
|
||||
return *this;
|
||||
}
|
||||
|
||||
store::iterator_impl<T, U> & operator-- () override
|
||||
iterator_impl<T, U> & operator-- () override
|
||||
{
|
||||
--least_iterator ();
|
||||
return *this;
|
||||
|
@ -229,7 +229,7 @@ public:
|
|||
return !(*this == base_a);
|
||||
}
|
||||
|
||||
bool operator== (store::iterator_impl<T, U> const & base_a) const override
|
||||
bool operator== (iterator_impl<T, U> const & base_a) const override
|
||||
{
|
||||
debug_assert ((dynamic_cast<merge_iterator<T, U> const *> (&base_a) != nullptr) && "Incompatible iterator comparison");
|
||||
auto & other (static_cast<merge_iterator<T, U> const &> (base_a));
|
||||
|
@ -267,9 +267,9 @@ public:
|
|||
mutable bool from_first_database{ false };
|
||||
|
||||
private:
|
||||
nano::store::lmdb::iterator<T, U> & least_iterator () const
|
||||
iterator<T, U> & least_iterator () const
|
||||
{
|
||||
nano::store::lmdb::iterator<T, U> * result;
|
||||
iterator<T, U> * result;
|
||||
if (impl1->is_end_sentinal ())
|
||||
{
|
||||
result = impl2.get ();
|
||||
|
@ -304,7 +304,7 @@ private:
|
|||
return *result;
|
||||
}
|
||||
|
||||
std::unique_ptr<nano::store::lmdb::iterator<T, U>> impl1;
|
||||
std::unique_ptr<nano::store::lmdb::iterator<T, U>> impl2;
|
||||
std::unique_ptr<iterator<T, U>> impl1;
|
||||
std::unique_ptr<iterator<T, U>> impl2;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ class iterator : public iterator_impl<T, U>
|
|||
public:
|
||||
iterator () = default;
|
||||
|
||||
iterator (::rocksdb::DB * db, store::transaction const & transaction_a, ::rocksdb::ColumnFamilyHandle * handle_a, db_val const * val_a, bool const direction_asc) :
|
||||
nano::store::iterator_impl<T, U> (transaction_a)
|
||||
iterator (::rocksdb::DB * db, transaction const & transaction_a, ::rocksdb::ColumnFamilyHandle * handle_a, db_val const * val_a, bool const direction_asc) :
|
||||
iterator_impl<T, U> (transaction_a)
|
||||
{
|
||||
// Don't fill the block cache for any blocks read as a result of an iterator
|
||||
if (is_read (transaction_a))
|
||||
|
@ -79,16 +79,16 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
iterator (nano::store::rocksdb::iterator<T, U> && other_a)
|
||||
iterator (iterator<T, U> && other_a)
|
||||
{
|
||||
cursor = other_a.cursor;
|
||||
other_a.cursor = nullptr;
|
||||
current = other_a.current;
|
||||
}
|
||||
|
||||
iterator (nano::store::rocksdb::iterator<T, U> const &) = delete;
|
||||
iterator (iterator<T, U> const &) = delete;
|
||||
|
||||
store::iterator_impl<T, U> & operator++ () override
|
||||
iterator_impl<T, U> & operator++ () override
|
||||
{
|
||||
cursor->Next ();
|
||||
if (cursor->Valid ())
|
||||
|
@ -109,7 +109,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
store::iterator_impl<T, U> & operator-- () override
|
||||
iterator_impl<T, U> & operator-- () override
|
||||
{
|
||||
cursor->Prev ();
|
||||
if (cursor->Valid ())
|
||||
|
@ -135,9 +135,9 @@ public:
|
|||
return ¤t;
|
||||
}
|
||||
|
||||
bool operator== (store::iterator_impl<T, U> const & base_a) const override
|
||||
bool operator== (iterator_impl<T, U> const & base_a) const override
|
||||
{
|
||||
auto const other_a (boost::polymorphic_downcast<nano::store::rocksdb::iterator<T, U> const *> (&base_a));
|
||||
auto const other_a (boost::polymorphic_downcast<iterator<T, U> const *> (&base_a));
|
||||
|
||||
if (!current.first.data () && !other_a->current.first.data ())
|
||||
{
|
||||
|
@ -187,13 +187,13 @@ public:
|
|||
current.second = nano::store::rocksdb::db_val{};
|
||||
debug_assert (is_end_sentinal ());
|
||||
}
|
||||
nano::store::rocksdb::iterator<T, U> & operator= (nano::store::rocksdb::iterator<T, U> && other_a)
|
||||
iterator<T, U> & operator= (iterator<T, U> && other_a)
|
||||
{
|
||||
cursor = std::move (other_a.cursor);
|
||||
current = other_a.current;
|
||||
return *this;
|
||||
}
|
||||
store::iterator_impl<T, U> & operator= (store::iterator_impl<T, U> const &) = delete;
|
||||
iterator_impl<T, U> & operator= (iterator_impl<T, U> const &) = delete;
|
||||
|
||||
std::unique_ptr<::rocksdb::Iterator> cursor;
|
||||
std::pair<nano::store::rocksdb::db_val, nano::store::rocksdb::db_val> current;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue