Remove MDB_UNSIGNEDKEY, add a builder for Dbi, add MDB_INTEGERKEY comparators#276
Remove MDB_UNSIGNEDKEY, add a builder for Dbi, add MDB_INTEGERKEY comparators#276
Conversation
There are now essentially three ways of configuring comparators when creating a Dbi. **null comparator** LMDB will use its own comparator & CursorIterable will call down to mdb_cmp for comparisons between the current cursor key and the range start/stop key. **provided comparator** LMDB will use its own comparator & CursorIterable will use the provided comparator for comparisons between the current cursor key and the range start/stop key. **provided comparator with nativeCb==true** LMDB will call back to java for all comparator duties. CursorIterable will use the same provided comparator for comparisons between the current cursor key and the range start/stop key. The methods `getSignedComparator()` and `getUnsignedComparator()` have been made public so users of this library can access them.
Refactor DbiBuilder and Dbi ctor to use DbiFlagSet.
Replace Env#copy(File, CopyFlags...) with copy(File, CopyFlagSet). As there is only one flag this should not be a breaking change. Deprecate Env#txn(Txn, TxnFlags...) as there is now Env#txn(Txn) Env#txn(Txn, TxnFlags) Env#txn(Txn, TxnFlagSet)
Also improve javadoc and refactor some tests to use DbiBuilder. Some tests are failing.
… key using DUPSORT
… key using DUPSORT
… key using DUPSORT
We just use the Spotify
The builders are such a significant ergonomic improvement and given we are targeting 1.0.0 it might be a good opportunity to remove those methods to encourage visibility of the new golden path.
Excellent. |
|
@benalexau
Originally I had deprecated all of the env.createDbi()
.setDbName("foo")
.withDefaultComparator()
.setDbiFlags(DbiFlags.MDB_CREATE)
.open();vs env.open("foo", DbiFlags.MDB_CREATE) // where MDB_CREATE is treated as a DbiFlagSetThe I'm not too bothered either way so happy to go with whatever you decide. |
I prefer the builder approach:
|
|
@benalexau Works for me. Builder it is. 👍 |
Fixes #249
Fixes #267
Two fixes in one PR as both need each other.