Commit Graph

109 Commits

Author SHA1 Message Date
Martchus bb985870f0 Avoid overflow when running out of IDs
* Throw an exception instead
* Add function that allows re-using lower IDs instead
* Move functions to query IDs to read-only operations
2022-04-15 19:18:35 +02:00
Martchus 7689f0ebd6 Add stalebot config 2022-04-12 01:07:00 +02:00
Martchus 95ff695381 Add helper to rebuild typed database 2022-03-07 23:31:47 +01:00
Martchus 62fe316637 Pass `func` as `const &` in `modify` function 2022-03-07 23:31:40 +01:00
Martchus 4580d7242a Fix typos 2022-03-01 00:42:50 +01:00
Martchus f6fd78155b Add `rbegin()` and `lower_bound()` for main DB 2022-02-25 00:29:17 +01:00
Martchus bf6dbf0e42 Improve comments 2022-02-21 23:46:32 +01:00
Martchus 6c21fe7cb1 Use type alias for ID type 2022-02-21 22:57:15 +01:00
Martchus b87dd49bba Allow iterating over index
The use-case is checking the index-value first (e.g. just a simple string)
to decide whether the object is actually instead of deserializing the
whole object (e.g. a huge object which is quite costly to deserialize)
directly.
2022-02-19 00:10:17 +01:00
Martchus 64ba75ac48 Add serialization shortcuts for std::string and std::uintX_t types 2022-02-19 00:06:13 +01:00
Martchus b302cdfabe Allow using smart pointers in iterator 2022-02-18 19:20:14 +01:00
Martchus 1517bdce29 Fix case of having no index at all 2022-02-10 22:37:32 +01:00
Martchus fbcdc05e9c Export use of lmdb library as we include and use it in public headers 2022-02-05 21:50:00 +01:00
Martchus 28a3aa7345 Add default c'tor and move assignment to transactions 2022-02-01 22:02:25 +01:00
Martchus 5eae3f2c98 Remove unused includes 2022-02-01 20:26:46 +01:00
Martchus 213dfb823d Use `std::`-prefix for a few more occurrences in standard types for consistency 2022-02-01 20:26:46 +01:00
Martchus 1748fe674c Use `std::`-prefix for all std-types used in headers 2022-02-01 20:26:46 +01:00
Martchus 011bfa9ab9 Use `std::size_t` consistently for index (of index) 2022-02-01 20:26:46 +01:00
Martchus 65d8653c77 Get rid of macros and boilerplate code for handling indexes
and by the way support more than 4 indexes at the same time
2022-02-01 20:26:46 +01:00
Martchus b75ff2602b Ensure all tests/examples pass without args and don't interfere with each other 2022-01-30 22:27:05 +01:00
Martchus bc5df35b67 Fix include for reflective-rapidjson 2022-01-30 22:09:34 +01:00
Martchus ec4a44e4de Format tests and examples as well 2022-01-30 21:32:08 +01:00
Martchus 1e393bf3fe Remove config for Travis CI
It is outdated and using an unsupported Ubuntu distribution.
2022-01-30 21:28:21 +01:00
Martchus ff340d0793 Remove "lmdb-various.cc"
Is it is not clear what it is about and contains lots of disabled code.
2022-01-30 21:26:26 +01:00
Martchus d27b737234 Move remaining examples from top-level to example folder and build-system 2022-01-30 21:25:05 +01:00
Martchus 2e7d278c9b Apply uniform formatting via clang-format 2022-01-30 21:14:43 +01:00
Martchus ff1fc3ebd4 Remove Makefile in favor of CMake build script 2022-01-30 01:27:54 +01:00
Martchus c7190f9d04 Ensure examples return with zero exit code (so they can be treated as tests) 2022-01-30 01:21:31 +01:00
Martchus b499a201c2 Add CMake build system replacing Makefile
* Allow building a shared library with proper exports
* Remove bundled catch2 library in favor of searching for system-provided
  version
* Adapt/fix tests and examples to latest changes
* Fix several warnings
2022-01-30 01:14:42 +01:00
Martchus adcb9338e8 Speed-up cleaning DB/indexes via `mdb_drop` instead of manual deletions 2022-01-26 00:43:21 +01:00
Martchus 31a45912dc Add `keyConv` function for `string_view` 2022-01-25 23:39:06 +01:00
Martchus f2042c59a5 Avoid instantiating an std::string when calling serializer 2022-01-25 23:39:06 +01:00
Martchus c8a865528e Pass string_view in serFromString() by value as it is just two pointers 2022-01-25 23:38:30 +01:00
Martchus 74d7bbd93b Throw errors in all cursor put/del functions 2022-01-22 19:18:56 +01:00
Martchus f35efb5a7c Expose raw return code in LMDBError 2022-01-22 19:17:14 +01:00
Martchus 4cec520c83 Avoid useless use of `const_cast` 2022-01-22 19:09:44 +01:00
Martchus 3bafada5cc Use distinct exception class and unify format of error messages
* Avoid manual code for making error message
* Use `const` for the return code variable where possible
* Unify formatting of error messages
2022-01-22 18:59:54 +01:00
Martchus a002cdecdf Improve some comments converting them to Doxygen-recognized comments 2022-01-22 18:18:15 +01:00
Martchus 156e01f15d Fix typos in README 2022-01-18 22:38:12 +01:00
Martchus 826637167c Update README for Reflective RapidJSON 2022-01-18 22:35:23 +01:00
Martchus d53687bdee Allow users to plug their own (de)serialization implementation
* Move serialization-specific code into its own header
* Keep reflective-rapidjson-based implementation as example
2022-01-18 22:24:31 +01:00
Martchus b833bfef3b Move everything under a namespace 2022-01-18 22:09:12 +01:00
Martchus c96b87c60a Remove obsolete comments 2022-01-18 22:09:12 +01:00
Martchus 64bde44fa2 Rearange includes to group them more systematically preferring C++ headers 2022-01-18 22:09:08 +01:00
Martchus 462e5e4b51 Fix example for iterating range
One must use `equal_range` here, otherwise the iteration will not stop
after the last matching key.
2022-01-18 21:53:51 +01:00
Rosen Penev bd72fce0a7 Use std::string_view whenever possible
std::string_view is available with libcxx, even in C++11 mode. Use the proper macro to check it.
2022-01-18 20:38:55 +01:00
Jonas Schäfer 91920e7c3b Allow reader and writer transactions in the same thread
This is supported by LMDB if the MDB_NOTLS flag is set on the
environment, which it always is with lmdb-safe.

Fixes #9.
2022-01-18 20:36:24 +01:00
Martchus 551339ff8f Avoid instantiating new `std::string` when converting key 2022-01-18 20:35:43 +01:00
Martchus 6a2a752203 Allow configuring maximum number of DBs 2022-01-18 20:35:43 +01:00
Martchus 97fab01b15 Improve error handling when calling `mdb_env_set_mapsize`/`mdb_env_set_maxdbs`
* Handle all errors
* Include error string in exception
2022-01-18 20:35:43 +01:00