Monero
Loading...
Searching...
No Matches
lmdb::basic_table< K, V > Struct Template Reference

Helper for grouping typical LMDB DBI options when key and value are fixed types. More...

#include <table.h>

Inheritance diagram for lmdb::basic_table< K, V >:
Collaboration diagram for lmdb::basic_table< K, V >:

Public Types

using key_type = K
using value_type = V

Public Member Functions

constexpr basic_table (const char *name, unsigned flags=0, MDB_cmp_func value_cmp=nullptr) noexcept
Public Member Functions inherited from lmdb::table
expect< MDB_dbiopen (MDB_txn &write_txn) const noexcept

Static Public Member Functions

static constexpr unsigned compute_flags (const unsigned flags) noexcept
template<typename U, typename F = U, std::size_t offset = 0>
static expect< Fget_value (MDB_val value) noexcept
template<typename D>
static expect< key_stream< K, V, D > > get_key_stream (std::unique_ptr< MDB_cursor, D > cur) noexcept
template<typename D>
static expect< value_stream< V, D > > get_value_stream (K const &key, std::unique_ptr< MDB_cursor, D > cur) noexcept

Additional Inherited Members

Public Attributes inherited from lmdb::table
char const *const name
const unsigned flags
MDB_cmp_func *const key_cmp
MDB_cmp_func *const value_cmp

Detailed Description

template<typename K, typename V>
struct lmdb::basic_table< K, V >

Helper for grouping typical LMDB DBI options when key and value are fixed types.

Member Typedef Documentation

◆ key_type

template<typename K, typename V>
using lmdb::basic_table< K, V >::key_type = K

◆ value_type

template<typename K, typename V>
using lmdb::basic_table< K, V >::value_type = V

Constructor & Destructor Documentation

◆ basic_table()

template<typename K, typename V>
lmdb::basic_table< K, V >::basic_table ( const char * name,
unsigned flags = 0,
MDB_cmp_func value_cmp = nullptr )
inlineexplicitconstexprnoexcept

Member Function Documentation

◆ compute_flags()

template<typename K, typename V>
constexpr unsigned lmdb::basic_table< K, V >::compute_flags ( const unsigned flags)
inlinestaticconstexprnoexcept
Returns
Additional LMDB flags based on flags value.

◆ get_key_stream()

template<typename K, typename V>
template<typename D>
expect< key_stream< K, V, D > > lmdb::basic_table< K, V >::get_key_stream ( std::unique_ptr< MDB_cursor, D > cur)
inlinestaticnoexcept
Precondition
cur != nullptr.
Parameters
curActive cursor on table. Returned in object on success, otherwise destroyed.
Returns
A handle to the first key/value in the table linked to cur or an empty key_stream.

◆ get_value()

template<typename K, typename V>
template<typename U, typename F = U, std::size_t offset = 0>
expect< F > lmdb::basic_table< K, V >::get_value ( MDB_val value)
inlinestaticnoexcept
Template Parameters
Umust be same as V; used for sanity checking.
Fis the type within U that is being extracted.
offsetto F within U.
Note
If using F and offset to retrieve a specific field, use MONERO_FIELD macro in src/lmdb/util.h which calculates the offset automatically.
Returns
Value of type F at offset within value which has type U.

◆ get_value_stream()

template<typename K, typename V>
template<typename D>
expect< value_stream< V, D > > lmdb::basic_table< K, V >::get_value_stream ( K const & key,
std::unique_ptr< MDB_cursor, D > cur )
inlinestaticnoexcept
Precondition
cur != nullptr.
Parameters
curActive cursor on table. Returned in object on success, otherwise destroyed.
Returns
A handle to the first value at key in the table linked to cur or an empty value_stream.

The documentation for this struct was generated from the following file: