lmdb-cpp: A simple OOP-style wrapper around lmdb
This library is designed to be as simple as possible to use; however, we do not guarantee full coverage of the entire LMDB API. If you're in need of something, please feel free to submit an issue or open a pull request to add the functionality you need. Otherwise, WYSIWYG.
The following features have been baked in:
- Builds with CMake making it easy to add to other projects
- GibHub Actions verifies that it builds on Ubuntu, Windows, and MacOS using various compilers
- The option to compress values stored in the database using snappy compression at a small performance cost.
- Use of shared pointers and singleton patterns to attempt thread-safety while maintaining LMDB sanity.
- Underlying LMDB instances are closed up as required as the shared pointers are destructed (ie. when the last instance of the shared pointer leaves scope).
- Transactions are automatically aborted unless you explicitly commit them.
C++ API documentation can be found in the headers (.h)
#include <lmdb_cpp.hpp>
#include <iostream>
int main () {
auto env = LMDB::Environment::instance("sample.db");
auto db = env->database();
const auto key = std::string("akey");
const auto value = std::vector<bool>(10, true);
db->put(key.data(), key.size(), value.data(), value.size());
const auto [error, temp_value] = db->get(key.data(), key.size());
}This repository uses submodules, make sure you pull those before doing anything if you are cloning the project.
git clone --recursive https://github.com/gibme-c/lmdb-cppgit submodule add https://github.com/gibme-c/lmdb-cpp external/lmdb
git submodule update --init --recursiveThis wrapper is provided under the BSD-3-Clause license found in LICENSE.
- LMDB is licensed under The OpenLDAP Public License v2.8
- cppfs is licensed under the MIT License
- snappy is licensed under the BSD-3-Clause license