◐ Shell
reader mode source ↗
Skip to content

gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp#250

Closed
at055612 wants to merge 25 commits into
lmdbjava:masterfrom
at055612:mdb_cmp
Closed

gh-249 Remove MDB_UNSIGNEDKEY, let CursorIterable call mdb_cmp#250
at055612 wants to merge 25 commits into
lmdbjava:masterfrom
at055612:mdb_cmp

Conversation

@at055612

@at055612 at055612 commented Mar 6, 2025

Copy link
Copy Markdown
Collaborator

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() and getUnsignedComparator() have been made public so users of this library can access them.

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

codecov Bot commented Mar 6, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.06452% with 167 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.06%. Comparing base (65df2ee) to head (dea7975).

Files with missing lines Patch % Lines
src/main/java/org/lmdbjava/AbstractFlagSet.java 72.61% 13 Missing and 10 partials ⚠️
src/main/java/org/lmdbjava/Env.java 63.79% 17 Missing and 4 partials ⚠️
src/main/java/org/lmdbjava/DbiBuilder.java 77.01% 13 Missing and 7 partials ⚠️
src/main/java/org/lmdbjava/Cursor.java 57.57% 8 Missing and 6 partials ⚠️
src/main/java/org/lmdbjava/FlagSet.java 63.33% 6 Missing and 5 partials ⚠️
src/main/java/org/lmdbjava/ByteBufProxy.java 62.96% 6 Missing and 4 partials ⚠️
src/main/java/org/lmdbjava/Dbi.java 72.22% 8 Missing and 2 partials ⚠️
src/main/java/org/lmdbjava/CopyFlagSet.java 50.00% 9 Missing ⚠️
src/main/java/org/lmdbjava/TxnFlagSet.java 62.50% 6 Missing ⚠️
src/main/java/org/lmdbjava/Key.java 73.68% 4 Missing and 1 partial ⚠️
... and 13 more
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

1 hidden conversation Load more…
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.
@at055612 at055612 self-assigned this Oct 28, 2025
@at055612

at055612 commented Nov 5, 2025

Copy link
Copy Markdown
Collaborator Author

Closing this as the changes have been moved to PR #276

@at055612 at055612 closed this Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The new MDB_UNSIGNEDKEY DbiFlag should probably be the default behaviour

2 participants