lmdb++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
lmdb::env Class Reference

Resource class for MDB_env* handles. More...

#include <lmdb++.h>

Public Member Functions

 env (MDB_env *const handle) noexcept
 Constructor. More...
 
 env (env &&other) noexcept
 Move constructor. More...
 
envoperator= (env &&other) noexcept
 Move assignment operator. More...
 
 ~env () noexcept
 Destructor. More...
 
 operator MDB_env * () const noexcept
 Returns the underlying MDB_env* handle. More...
 
MDB_env * handle () const noexcept
 Returns the underlying MDB_env* handle. More...
 
void sync (const bool force=true)
 Flushes data buffers to disk. More...
 
void close () noexcept
 Closes this environment, releasing the memory map. More...
 
envopen (const char *const path, const unsigned int flags=default_flags, const mode mode=default_mode)
 Opens this environment. More...
 
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. More...
 

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

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

Constructor.

Parameters
handlea valid MDB_env* handle
lmdb::env::env ( env &&  other)
inlinenoexcept

Move constructor.

lmdb::env::~env ( )
inlinenoexcept

Destructor.

Member Function Documentation

void lmdb::env::close ( )
inlinenoexcept

Closes this environment, releasing the memory map.

Note
this method is idempotent
Postcondition
handle() == nullptr
static env lmdb::env::create ( const unsigned int  flags = default_flags)
inlinestatic

Creates a new LMDB environment.

Parameters
flags
Exceptions
lmdb::erroron failure
MDB_env* lmdb::env::handle ( ) const
inlinenoexcept

Returns the underlying MDB_env* handle.

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
lmdb::env::operator MDB_env * ( ) const
inlinenoexcept

Returns the underlying MDB_env* handle.

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

Move assignment operator.

env& lmdb::env::set_flags ( const unsigned int  flags,
const bool  onoff = true 
)
inline
Parameters
flags
onoff
Exceptions
lmdb::erroron failure
env& lmdb::env::set_mapsize ( const std::size_t  size)
inline
Parameters
size
Exceptions
lmdb::erroron failure
env& lmdb::env::set_max_dbs ( const MDB_dbi  count)
inline
Parameters
count
Exceptions
lmdb::erroron failure
env& lmdb::env::set_max_readers ( const unsigned int  count)
inline
Parameters
count
Exceptions
lmdb::erroron failure
void lmdb::env::sync ( const bool  force = true)
inline

Flushes data buffers to disk.

Parameters
force
Exceptions
lmdb::erroron failure

Member Data Documentation

MDB_env* lmdb::env::_handle {nullptr}
protected
constexpr unsigned int lmdb::env::default_flags = 0
static
constexpr mode lmdb::env::default_mode = 0644
static

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