lmdb++
Loading...
Searching...
No Matches
lmdb Namespace Reference

<lmdb++.h> - C++17 wrapper for LMDB. More...

Classes

class  bad_dbi_error
 Exception class for MDB_BAD_DBI errors. More...
 
class  corrupted_error
 Exception class for MDB_CORRUPTED errors. More...
 
class  cursor
 Resource class for MDB_cursor* handles. More...
 
class  dbi
 Resource class for MDB_dbi handles. More...
 
class  env
 Resource class for MDB_env* handles. More...
 
class  error
 Base class for LMDB exception conditions. More...
 
class  fatal_error
 Base class for fatal error conditions. More...
 
class  key_exist_error
 Exception class for MDB_KEYEXIST errors. More...
 
class  logic_error
 Base class for logic error conditions. More...
 
class  map_full_error
 Exception class for MDB_MAP_FULL errors. More...
 
class  not_found_error
 Exception class for MDB_NOTFOUND errors. More...
 
class  panic_error
 Exception class for MDB_PANIC errors. More...
 
class  runtime_error
 Base class for runtime error conditions. More...
 
class  txn
 Resource class for MDB_txn* handles. More...
 
class  version_mismatch_error
 Exception class for MDB_VERSION_MISMATCH errors. More...
 

Typedefs

using mode = mdb_mode_t
 

Functions

static void env_create (MDB_env **env)
 
static void env_open (MDB_env *env, const char *path, unsigned int flags, mode mode)
 
static void env_copy (MDB_env *env, const char *path, unsigned int flags)
 
static void env_copy_fd (MDB_env *env, mdb_filehandle_t fd, unsigned int flags)
 
static void env_stat (MDB_env *env, MDB_stat *stat)
 
static void env_info (MDB_env *env, MDB_envinfo *stat)
 
static void env_sync (MDB_env *env, bool force)
 
static void env_close (MDB_env *env) noexcept
 
static void env_set_flags (MDB_env *env, unsigned int flags, bool onoff)
 
static void env_get_flags (MDB_env *env, unsigned int *flags)
 
static void env_get_path (MDB_env *env, const char **path)
 
static void env_get_fd (MDB_env *env, mdb_filehandle_t *fd)
 
static void env_set_mapsize (MDB_env *env, std::size_t size)
 
static void env_set_max_readers (MDB_env *env, unsigned int count)
 
static void env_get_max_readers (MDB_env *env, unsigned int *count)
 
static void env_set_max_dbs (MDB_env *env, MDB_dbi count)
 
static unsigned int env_get_max_keysize (MDB_env *env)
 
static void env_set_userctx (MDB_env *env, void *ctx)
 
static void * env_get_userctx (MDB_env *env)
 
static void reader_check (MDB_env *env, int *dead)
 
static void txn_begin (MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn)
 
static MDB_env * txn_env (MDB_txn *txn) noexcept
 
static void txn_commit (MDB_txn *txn)
 
static void txn_abort (MDB_txn *txn) noexcept
 
static void txn_reset (MDB_txn *txn) noexcept
 
static void txn_renew (MDB_txn *txn)
 
static void dbi_open (MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)
 
static void dbi_stat (MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat)
 
static void dbi_flags (MDB_txn *txn, MDB_dbi dbi, unsigned int *flags)
 
static void dbi_close (MDB_env *env, MDB_dbi dbi) noexcept
 
static void dbi_drop (MDB_txn *txn, MDB_dbi dbi, bool del)
 
static void dbi_set_compare (MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
 
static void dbi_set_dupsort (MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp)
 
static void dbi_set_relfunc (MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel)
 
static void dbi_set_relctx (MDB_txn *txn, MDB_dbi dbi, void *ctx)
 
static bool dbi_get (MDB_txn *txn, MDB_dbi dbi, const MDB_val *key, MDB_val *data)
 
static bool dbi_put (MDB_txn *txn, MDB_dbi dbi, const MDB_val *key, MDB_val *data, unsigned int flags)
 
static bool dbi_del (MDB_txn *txn, MDB_dbi dbi, const MDB_val *key, const MDB_val *data)
 
static void cursor_open (MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor)
 
static void cursor_close (MDB_cursor *cursor) noexcept
 
static void cursor_renew (MDB_txn *txn, MDB_cursor *cursor)
 
static MDB_txn * cursor_txn (MDB_cursor *cursor) noexcept
 
static MDB_dbi cursor_dbi (MDB_cursor *cursor) noexcept
 
static bool cursor_get (MDB_cursor *cursor, MDB_val *key, MDB_val *data, MDB_cursor_op op)
 
static bool cursor_put (MDB_cursor *cursor, MDB_val *key, MDB_val *data, unsigned int flags)
 
static void cursor_del (MDB_cursor *cursor, unsigned int flags)
 
static void cursor_count (MDB_cursor *cursor, std::size_t &count)
 
template<typename T >
static std::string_view ptr_to_sv (T *v)
 Creates a std::string_view that points to the memory pointed to by v.
 
template<typename T >
static std::string_view to_sv (const T &v)
 Creates a std::string_view that points to the memory occupied by v.
 
template<typename T >
static T * ptr_from_sv (std::string_view v)
 Takes a std::string_view and casts its pointer as a pointer to the parameterized type.
 
template<typename T >
static T from_sv (std::string_view v)
 Takes a std::string_view and dereferences it, returning a value of the parameterized type.
 

Detailed Description

<lmdb++.h> - C++17 wrapper for LMDB.

Author
Arto Bendiken arto@.nosp@m.bend.nosp@m.iken..nosp@m.net @maintainer Doug Hoyte doug@.nosp@m.hoyt.nosp@m.ech.c.nosp@m.om
See also
https://github.com/hoytech/lmdbxx

Typedef Documentation

◆ mode

using lmdb::mode = mdb_mode_t

Function Documentation

◆ cursor_close()

static void lmdb::cursor_close ( MDB_cursor * cursor)
inlinestaticnoexcept

◆ cursor_count()

static void lmdb::cursor_count ( MDB_cursor * cursor,
std::size_t & count )
inlinestatic

◆ cursor_dbi()

static MDB_dbi lmdb::cursor_dbi ( MDB_cursor * cursor)
inlinestaticnoexcept

◆ cursor_del()

static void lmdb::cursor_del ( MDB_cursor * cursor,
unsigned int flags = 0 )
inlinestatic

◆ cursor_get()

static bool lmdb::cursor_get ( MDB_cursor * cursor,
MDB_val * key,
MDB_val * data,
MDB_cursor_op op )
inlinestatic

◆ cursor_open()

static void lmdb::cursor_open ( MDB_txn * txn,
MDB_dbi dbi,
MDB_cursor ** cursor )
inlinestatic

◆ cursor_put()

static bool lmdb::cursor_put ( MDB_cursor * cursor,
MDB_val * key,
MDB_val * data,
unsigned int flags = 0 )
inlinestatic

◆ cursor_renew()

static void lmdb::cursor_renew ( MDB_txn * txn,
MDB_cursor * cursor )
inlinestatic

◆ cursor_txn()

static MDB_txn * lmdb::cursor_txn ( MDB_cursor * cursor)
inlinestaticnoexcept

◆ dbi_close()

static void lmdb::dbi_close ( MDB_env * env,
MDB_dbi dbi )
inlinestaticnoexcept

◆ dbi_del()

static bool lmdb::dbi_del ( MDB_txn * txn,
MDB_dbi dbi,
const MDB_val * key,
const MDB_val * data = nullptr )
inlinestatic
Return values
trueif the key/value pair was removed
falseif the key wasn't found
See also
http://symas.com/mdb/doc/group__mdb.html#gab8182f9360ea69ac0afd4a4eaab1ddb0

◆ dbi_drop()

static void lmdb::dbi_drop ( MDB_txn * txn,
MDB_dbi dbi,
bool del = false )
inlinestatic

◆ dbi_flags()

static void lmdb::dbi_flags ( MDB_txn * txn,
MDB_dbi dbi,
unsigned int * flags )
inlinestatic

◆ dbi_get()

static bool lmdb::dbi_get ( MDB_txn * txn,
MDB_dbi dbi,
const MDB_val * key,
MDB_val * data )
inlinestatic
Return values
trueif the key/value pair was retrieved
falseif the key wasn't found
See also
http://symas.com/mdb/doc/group__mdb.html#ga8bf10cd91d3f3a83a34d04ce6b07992d

◆ dbi_open()

static void lmdb::dbi_open ( MDB_txn * txn,
const char * name,
unsigned int flags,
MDB_dbi * dbi )
inlinestatic

◆ dbi_put()

static bool lmdb::dbi_put ( MDB_txn * txn,
MDB_dbi dbi,
const MDB_val * key,
MDB_val * data,
unsigned int flags = 0 )
inlinestatic
Return values
trueif the key/value pair was inserted
falseif the key already existed
See also
http://symas.com/mdb/doc/group__mdb.html#ga4fa8573d9236d54687c61827ebf8cac0

◆ dbi_set_compare()

static void lmdb::dbi_set_compare ( MDB_txn * txn,
MDB_dbi dbi,
MDB_cmp_func * cmp = nullptr )
inlinestatic

◆ dbi_set_dupsort()

static void lmdb::dbi_set_dupsort ( MDB_txn * txn,
MDB_dbi dbi,
MDB_cmp_func * cmp = nullptr )
inlinestatic

◆ dbi_set_relctx()

static void lmdb::dbi_set_relctx ( MDB_txn * txn,
MDB_dbi dbi,
void * ctx )
inlinestatic

◆ dbi_set_relfunc()

static void lmdb::dbi_set_relfunc ( MDB_txn * txn,
MDB_dbi dbi,
MDB_rel_func * rel )
inlinestatic

◆ dbi_stat()

static void lmdb::dbi_stat ( MDB_txn * txn,
MDB_dbi dbi,
MDB_stat * stat )
inlinestatic

◆ env_close()

static void lmdb::env_close ( MDB_env * env)
inlinestaticnoexcept

◆ env_copy()

static void lmdb::env_copy ( MDB_env * env,
const char * path,
unsigned int flags = 0 )
inlinestatic

◆ env_copy_fd()

static void lmdb::env_copy_fd ( MDB_env * env,
mdb_filehandle_t fd,
unsigned int flags = 0 )
inlinestatic

◆ env_create()

static void lmdb::env_create ( MDB_env ** env)
inlinestatic

◆ env_get_fd()

static void lmdb::env_get_fd ( MDB_env * env,
mdb_filehandle_t * fd )
inlinestatic

◆ env_get_flags()

static void lmdb::env_get_flags ( MDB_env * env,
unsigned int * flags )
inlinestatic

◆ env_get_max_keysize()

static unsigned int lmdb::env_get_max_keysize ( MDB_env * env)
inlinestatic

◆ env_get_max_readers()

static void lmdb::env_get_max_readers ( MDB_env * env,
unsigned int * count )
inlinestatic

◆ env_get_path()

static void lmdb::env_get_path ( MDB_env * env,
const char ** path )
inlinestatic

◆ env_get_userctx()

static void * lmdb::env_get_userctx ( MDB_env * env)
inlinestatic

◆ env_info()

static void lmdb::env_info ( MDB_env * env,
MDB_envinfo * stat )
inlinestatic

◆ env_open()

static void lmdb::env_open ( MDB_env * env,
const char * path,
unsigned int flags,
mode mode )
inlinestatic

◆ env_set_flags()

static void lmdb::env_set_flags ( MDB_env * env,
unsigned int flags,
bool onoff = true )
inlinestatic

◆ env_set_mapsize()

static void lmdb::env_set_mapsize ( MDB_env * env,
std::size_t size )
inlinestatic

◆ env_set_max_dbs()

static void lmdb::env_set_max_dbs ( MDB_env * env,
MDB_dbi count )
inlinestatic

◆ env_set_max_readers()

static void lmdb::env_set_max_readers ( MDB_env * env,
unsigned int count )
inlinestatic

◆ env_set_userctx()

static void lmdb::env_set_userctx ( MDB_env * env,
void * ctx )
inlinestatic

◆ env_stat()

static void lmdb::env_stat ( MDB_env * env,
MDB_stat * stat )
inlinestatic

◆ env_sync()

static void lmdb::env_sync ( MDB_env * env,
bool force = true )
inlinestatic

◆ from_sv()

template<typename T >
static T lmdb::from_sv ( std::string_view v)
inlinestatic

Takes a std::string_view and dereferences it, returning a value of the parameterized type.

Parameters
v

◆ ptr_from_sv()

template<typename T >
static T * lmdb::ptr_from_sv ( std::string_view v)
inlinestatic

Takes a std::string_view and casts its pointer as a pointer to the parameterized type.

Parameters
v

◆ ptr_to_sv()

template<typename T >
static std::string_view lmdb::ptr_to_sv ( T * v)
inlinestatic

Creates a std::string_view that points to the memory pointed to by v.

Parameters
v

◆ reader_check()

static void lmdb::reader_check ( MDB_env * env,
int * dead )
inlinestatic

◆ to_sv()

template<typename T >
static std::string_view lmdb::to_sv ( const T & v)
inlinestatic

Creates a std::string_view that points to the memory occupied by v.

Parameters
v

◆ txn_abort()

static void lmdb::txn_abort ( MDB_txn * txn)
inlinestaticnoexcept

◆ txn_begin()

static void lmdb::txn_begin ( MDB_env * env,
MDB_txn * parent,
unsigned int flags,
MDB_txn ** txn )
inlinestatic

◆ txn_commit()

static void lmdb::txn_commit ( MDB_txn * txn)
inlinestatic

◆ txn_env()

static MDB_env * lmdb::txn_env ( MDB_txn * txn)
inlinestaticnoexcept

◆ txn_renew()

static void lmdb::txn_renew ( MDB_txn * txn)
inlinestatic

◆ txn_reset()

static void lmdb::txn_reset ( MDB_txn * txn)
inlinestaticnoexcept