lmdb++
Loading...
Searching...
No Matches
lmdb::env Class Reference

Resource class for MDB_env* handles. More...

#include <lmdb++.h>

Public Member Functions

 env (MDB_env *const handle) noexcept
 Constructor.
 
 env (env &&other) noexcept
 Move constructor.
 
envoperator= (env &&other) noexcept
 Move assignment operator.
 
 ~env () noexcept
 Destructor.
 
 operator MDB_env * () const noexcept
 Returns the underlying MDB_env* handle.
 
MDB_env * handle () const noexcept
 Returns the underlying MDB_env* handle.
 
void sync (const bool force=true)
 Flushes data buffers to disk.
 
void close () noexcept
 Closes this environment, releasing the memory map.
 
int reader_check ()
 
envopen (const char *const path, const unsigned int flags=default_flags, const mode mode=default_mode)
 Opens this environment.
 
envset_flags (const unsigned int flags, const bool onoff=true)
 
envset_mapsize (const std::size_t size)
 
envset_max_readers (const unsigned int count)
 
envset_max_dbs (const MDB_dbi count)
 

Static Public Member Functions

static env create (const unsigned int flags=default_flags)
 Creates a new LMDB environment.
 

Static Public Attributes

static constexpr unsigned int default_flags = 0
 
static constexpr mode default_mode = 0644
 

Protected Attributes

MDB_env * _handle {nullptr}
 

Detailed Description

Resource class for MDB_env* handles.

Note
Instances of this class are movable, but not copyable.
See also
http://symas.com/mdb/doc/group__internal.html#structMDB__env

Constructor & Destructor Documentation

◆ env() [1/2]

lmdb::env::env ( MDB_env *const handle)
inlinenoexcept

Constructor.

Parameters
handlea valid MDB_env* handle

◆ env() [2/2]

lmdb::env::env ( env && other)
inlinenoexcept

Move constructor.

◆ ~env()

lmdb::env::~env ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ close()

void lmdb::env::close ( )
inlinenoexcept

Closes this environment, releasing the memory map.

Note
this method is idempotent
Postcondition
handle() == nullptr

◆ create()

static env lmdb::env::create ( const unsigned int flags = default_flags)
inlinestatic

Creates a new LMDB environment.

Parameters
flags
Exceptions
lmdb::erroron failure

◆ handle()

MDB_env * lmdb::env::handle ( ) const
inlinenoexcept

Returns the underlying MDB_env* handle.

◆ open()

env & lmdb::env::open ( const char *const path,
const unsigned int flags = default_flags,
const mode mode = default_mode )
inline

Opens this environment.

Parameters
path
flags
mode
Exceptions
lmdb::erroron failure

◆ operator MDB_env *()

lmdb::env::operator MDB_env * ( ) const
inlinenoexcept

Returns the underlying MDB_env* handle.

◆ operator=()

env & lmdb::env::operator= ( env && other)
inlinenoexcept

Move assignment operator.

◆ reader_check()

int lmdb::env::reader_check ( )
inline

◆ set_flags()

env & lmdb::env::set_flags ( const unsigned int flags,
const bool onoff = true )
inline
Parameters
flags
onoff
Exceptions
lmdb::erroron failure

◆ set_mapsize()

env & lmdb::env::set_mapsize ( const std::size_t size)
inline
Parameters
size
Exceptions
lmdb::erroron failure

◆ set_max_dbs()

env & lmdb::env::set_max_dbs ( const MDB_dbi count)
inline
Parameters
count
Exceptions
lmdb::erroron failure

◆ set_max_readers()

env & lmdb::env::set_max_readers ( const unsigned int count)
inline
Parameters
count
Exceptions
lmdb::erroron failure

◆ sync()

void lmdb::env::sync ( const bool force = true)
inline

Flushes data buffers to disk.

Parameters
force
Exceptions
lmdb::erroron failure

Member Data Documentation

◆ _handle

MDB_env* lmdb::env::_handle {nullptr}
protected

◆ default_flags

unsigned int lmdb::env::default_flags = 0
staticconstexpr

◆ default_mode

mode lmdb::env::default_mode = 0644
staticconstexpr

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