lmdb::txn Class Reference

Resource class for `MDB_txn*` handles. More...

`#include <lmdb++.h>`

## Public Member Functions

| txn (MDB_txn *const handle) noexcept
| Constructor. More...
| txn (txn &&other) noexcept
| Move constructor. More...
txn & | operator= (txn &&other) noexcept
| Move assignment operator. More...
| ~txn () noexcept
| Destructor. More...
| operator MDB_txn * () const noexcept
| Returns the underlying `MDB_txn*` handle. More...
MDB_txn * | handle () const noexcept
| Returns the underlying `MDB_txn*` handle. More...
MDB_env * | env () const noexcept
| Returns the transaction's `MDB_env*` handle. More...
void | commit ()
| Commits this transaction. More...
void | abort () noexcept
| Aborts this transaction. More...
void | reset () noexcept
| Resets this read-only transaction. More...
void | renew ()
| Renews this read-only transaction. More...

## Static Public Member Functions

static txn | begin (MDB_env *const env, MDB_txn *const parent=nullptr, const unsigned int flags=default_flags)
| Creates a new LMDB transaction. More...

## Static Public Attributes

static constexpr unsigned int | default_flags = 0

## Protected Attributes

MDB_txn * | _handle {nullptr}

## Detailed Description

Resource class for `MDB_txn*` handles.

Note
  Instances of this class are movable, but not copyable.

See also
  http://symas.com/mdb/doc/group__internal.html#structMDB__txn

## Constructor & Destructor Documentation

## txn() [1/2]

lmdb::txn::txn | ( | MDB_txn *const | handle | ) |

inline noexcept

Constructor.

Parameters

  handle | a valid `MDB_txn*` handle

## txn() [2/2]

lmdb::txn::txn | ( | txn && | other | ) |

inline noexcept

Move constructor.

## ~txn()

lmdb::txn::~txn | ( |  | ) |

inline noexcept

Destructor.

## Member Function Documentation

## abort()

void lmdb::txn::abort | ( |  | ) |

inline noexcept

Aborts this transaction.

Postcondition
  `handle() == nullptr`

## begin()

static txn lmdb::txn::begin | ( | MDB_env *const | env,
|  | MDB_txn *const | parent = `nullptr`,
|  | const unsigned int | flags = `default_flags`
| ) |  |

inline static

Creates a new LMDB transaction.

Parameters

  env | the environment handle
  parent |
  flags |

Exceptions

  lmdb::error | on failure

## commit()

void lmdb::txn::commit | ( |  | ) |

inline

Commits this transaction.

Exceptions

  lmdb::error | on failure

Postcondition
  `handle() == nullptr`

## env()

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

inline noexcept

Returns the transaction's `MDB_env*` handle.

## handle()

MDB_txn* lmdb::txn::handle | ( |  | ) | const

inline noexcept

Returns the underlying `MDB_txn*` handle.

## operator MDB_txn *()

lmdb::txn::operator MDB_txn * | ( |  | ) | const

inline noexcept

Returns the underlying `MDB_txn*` handle.

## operator=()

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

inline noexcept

Move assignment operator.

## renew()

void lmdb::txn::renew | ( |  | ) |

inline

Renews this read-only transaction.

Exceptions

  lmdb::error | on failure

## reset()

void lmdb::txn::reset | ( |  | ) |

inline noexcept

Resets this read-only transaction.

## Member Data Documentation

## _handle

MDB_txn* lmdb::txn::_handle {nullptr}

protected

## default_flags

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

static

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

- lmdb++.h