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.
env & | operator= (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.
env & | open (const char *const path, const unsigned int flags=default_flags, const mode mode=default_mode)
| Opens this environment.
env & | set_flags (const unsigned int flags, const bool onoff=true)
env & | set_mapsize (const std::size_t size)
env & | set_max_readers (const unsigned int count)
env & | set_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 | ) |

inline noexcept

Constructor.

Parameters

  handle | a valid `MDB_env*` handle

## env() [2/2]

lmdb::env::env | ( | env && | other | ) |

inline noexcept

Move constructor.

## ~env()

lmdb::env::~env | ( |  | ) |

inline noexcept

Destructor.

## Member Function Documentation

## close()

void lmdb::env::close | ( |  | ) |

inline noexcept

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` | ) |

inline static

Creates a new LMDB environment.

Parameters

  flags |

Exceptions

  lmdb::error | on failure

## handle()

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

inline noexcept

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::error | on failure

## operator MDB_env *()

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

inline noexcept

Returns the underlying `MDB_env*` handle.

## operator=()

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

inline noexcept

Move assignment operator.

## set_flags()

env & lmdb::env::set_flags | ( | const unsigned int | flags,
|  | const bool | onoff = `true`
| ) |  |

inline

Parameters

  flags |
  onoff |

Exceptions

  lmdb::error | on failure

## set_mapsize()

env & lmdb::env::set_mapsize | ( | const std::size_t | size | ) |

inline

Parameters

  size |

Exceptions

  lmdb::error | on failure

## set_max_dbs()

env & lmdb::env::set_max_dbs | ( | const MDB_dbi | count | ) |

inline

Parameters

  count |

Exceptions

  lmdb::error | on failure

## set_max_readers()

env & lmdb::env::set_max_readers | ( | const unsigned int | count | ) |

inline

Parameters

  count |

Exceptions

  lmdb::error | on failure

## sync()

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

inline

Flushes data buffers to disk.

Parameters

  force |

Exceptions

  lmdb::error | on failure

## Member Data Documentation

## _handle

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

protected

## default_flags

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

static constexpr

## default_mode

constexpr mode lmdb::env::default_mode = 0644

static constexpr

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

- lmdb++.h