gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp#250
gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp#250at055612 wants to merge 25 commits intolmdbjava:masterfrom
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.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #250 +/- ##
============================================
- Coverage 89.06% 85.06% -4.01%
- Complexity 413 507 +94
============================================
Files 32 41 +9
Lines 1482 1962 +480
Branches 125 180 +55
============================================
+ Hits 1320 1669 +349
- Misses 92 177 +85
- Partials 70 116 +46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5e03aec to
e598e21
Compare
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.
| /** | ||
| * @return The {@link Iterator} (in no particular order) for the flags in this {@link FlagSet}. | ||
| */ | ||
| default Iterator<T> iterator() { |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
| try (Txn<ByteBuffer> txn = env.txnWrite(); | ||
| final Cursor<ByteBuffer> cursor = db.openCursor(txn)) { | ||
| while (cursor.next()) { | ||
| cursor.delete(); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
| final long[] values = random.longs(5_000_000).toArray(); | ||
|
|
||
| Instant time = Instant.now(); | ||
| int x = 0; |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| bb2.reset(); | ||
| return guava.compare(array1, array2); | ||
| }; | ||
| final Dbi<ByteBuffer> guavaDbi = env.openDbi(DB_1, comparator, MDB_CREATE); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
| create(bufferProxy) | ||
| .setMapSize(KIBIBYTES.toBytes(256)) | ||
| .setMaxReaders(1) | ||
| .setMaxDbs(3) | ||
| .open(file.toFile(), POSIX_MODE, MDB_NOSUBDIR); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
| try (Txn<ByteBuffer> txn = env.txnRead()) { | ||
| try (CursorIterable<ByteBuffer> iterable = db.iterate(txn)) { | ||
| for (KeyVal<ByteBuffer> keyVal : iterable) { | ||
| final String val = getString(keyVal.val()); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| try (CursorIterable<ByteBuffer> iterable = db.iterate(txn)) { | ||
| for (KeyVal<ByteBuffer> keyVal : iterable) { | ||
| final String val = getString(keyVal.val()); | ||
| final long key = getNativeLong(keyVal.key()); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| for (KeyVal<ByteBuffer> keyVal : iterable) { | ||
| final String val = getString(keyVal.val()); | ||
| final long key = getNativeLong(keyVal.key()); | ||
| final int remaining = keyVal.key().remaining(); |
Check notice
Code scanning / CodeQL
Unread local variable Note test
| create(bufferProxy) | ||
| .setMapSize(GIBIBYTES.toBytes(1)) | ||
| .setMaxReaders(1) | ||
| .setMaxDbs(3) | ||
| .open(file.toFile(), POSIX_MODE, MDB_NOSUBDIR); |
Check notice
Code scanning / CodeQL
Deprecated method or constructor invocation Note test
|
Closing this as the changes have been moved to PR #276 |
Fixes #249
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()andgetUnsignedComparator()have been made public so users of this library can access them.