Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
at055612 wants to merge25 commits intolmdbjava:masterfromat055612:mdb_cmp

Conversation

@at055612
Copy link
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 methodsgetSignedComparator() andgetUnsignedComparator() have been made public so users of this library can access them.

There are now essentially three ways of configuring comparatorswhen creating a Dbi.**null comparator**LMDB will use its own comparator & CursorIterable will call downto mdb_cmp for comparisons between the current cursor key and therange start/stop key.**provided comparator**LMDB will use its own comparator & CursorIterable will use theprovided comparator for comparisons between the current cursorkey 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 forcomparisons between the current cursor key and the rangestart/stop key.The methods `getSignedComparator()` and `getUnsignedComparator()`have been made public so users of this library can access them.
@codecov
Copy link

codecovbot commentedMar 6, 2025
edited
Loading

Codecov Report

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

Files with missing linesPatch %Lines
src/main/java/org/lmdbjava/AbstractFlagSet.java72.61%13 Missing and 10 partials⚠️
src/main/java/org/lmdbjava/Env.java63.79%17 Missing and 4 partials⚠️
src/main/java/org/lmdbjava/DbiBuilder.java77.01%13 Missing and 7 partials⚠️
src/main/java/org/lmdbjava/Cursor.java57.57%8 Missing and 6 partials⚠️
src/main/java/org/lmdbjava/FlagSet.java63.33%6 Missing and 5 partials⚠️
src/main/java/org/lmdbjava/ByteBufProxy.java62.96%6 Missing and 4 partials⚠️
src/main/java/org/lmdbjava/Dbi.java72.22%8 Missing and 2 partials⚠️
src/main/java/org/lmdbjava/CopyFlagSet.java50.00%9 Missing⚠️
src/main/java/org/lmdbjava/TxnFlagSet.java62.50%6 Missing⚠️
src/main/java/org/lmdbjava/Key.java73.68%4 Missing and 1 partial⚠️
... and13 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.

cnt++;
}
}
finalDurationduration =Duration.between(start,Instant.now());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'KeyVal kv' is never read.
bb1.get(array1);
bb2.get(array2);
bb1.reset();
bb2.reset();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Env.openDbi
Loading
should be avoided because it has been deprecated.
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 nowEnv#txn(Txn)Env#txn(Txn, TxnFlags)Env#txn(Txn, TxnFlagSet)
Also improve javadoc and refactor some tests to use DbiBuilder.Some tests are failing.
if (txn !=null) {
returnopen(txn,dbiBuilder);
}else {
try (finalTxn<T>txn =getTxn(dbiBuilder)) {

Check notice

Code scanning / CodeQL

Possible confusion of local and field Note

Confusing name: method
open
Loading
also refers to field
txn
Loading
(without qualifying it with 'this').
@at055612at055612 self-assigned thisOct 28, 2025
/**
* @return The {@link Iterator} (in no particular order) for the flags in this {@link FlagSet}.
*/
defaultIterator<T>iterator() {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
Iterable.iterator
Loading
; it is advisable to add an Override annotation.
try (Txn<ByteBuffer>txn =env.txnWrite();
finalCursor<ByteBuffer>cursor =db.openCursor(txn)) {
while (cursor.next()) {
cursor.delete();

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Cursor.delete
Loading
should be avoided because it has been deprecated.
finallong[]values =random.longs(5_000_000).toArray();

Instanttime =Instant.now();
intx =0;

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int x' is never read.
bb2.reset();
returnguava.compare(array1,array2);
};
finalDbi<ByteBuffer>guavaDbi =env.openDbi(DB_1,comparator,MDB_CREATE);

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note test

Invoking
Env.openDbi
Loading
should be avoided because it has been deprecated.
Comment on lines +127 to +131
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

Invoking
Builder.open
Loading
should be avoided because it has been deprecated.
try (Txn<ByteBuffer>txn =env.txnRead()) {
try (CursorIterable<ByteBuffer>iterable =db.iterate(txn)) {
for (KeyVal<ByteBuffer>keyVal :iterable) {
finalStringval =getString(keyVal.val());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'String val' is never read.
try (CursorIterable<ByteBuffer>iterable =db.iterate(txn)) {
for (KeyVal<ByteBuffer>keyVal :iterable) {
finalStringval =getString(keyVal.val());
finallongkey =getNativeLong(keyVal.key());

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'long key' is never read.
for (KeyVal<ByteBuffer>keyVal :iterable) {
finalStringval =getString(keyVal.val());
finallongkey =getNativeLong(keyVal.key());
finalintremaining =keyVal.key().remaining();

Check notice

Code scanning / CodeQL

Unread local variable Note test

Variable 'int remaining' is never read.
Comment on lines +59 to +63
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

Invoking
Builder.open
Loading
should be avoided because it has been deprecated.
@at055612
Copy link
CollaboratorAuthor

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

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@at055612at055612

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

The newMDB_UNSIGNEDKEY DbiFlag should probably be the default behaviour

1 participant

@at055612

[8]ページ先頭

©2009-2025 Movatter.jp