Skip to content

Commit 167cdad

Browse files
committed
Rename buildDbi to createDbi to be consistent with Env.create()
1 parent 7a6910b commit 167cdad

8 files changed

Lines changed: 40 additions & 40 deletions

File tree

src/main/java/org/lmdbjava/Env.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ public boolean isReadOnly() {
282282
*
283283
* @return A new builder instance for creating/opening a {@link Dbi}.
284284
*/
285-
public DbiBuilder<T> buildDbi() {
285+
public DbiBuilder<T> createDbi() {
286286
return new DbiBuilder<>(this, proxy, readOnly);
287287
}
288288

289289
/**
290290
* Convenience method that opens a {@link Dbi} with a UTF-8 database name and default
291291
* {@link Comparator} that is not invoked from native code.
292292
* <p>
293-
* For more options when opening a {@link Dbi} see {@link Env#buildDbi()}.
293+
* For more options when opening a {@link Dbi} see {@link Env#createDbi()}.
294294
* </p>
295295
* @param name name of the database (or null if no name is required)
296296
* @param dbiFlagSet Flags to open the database with
@@ -309,7 +309,7 @@ public Dbi<T> openDbi(final String name, final DbiFlagSet dbiFlagSet) {
309309
* Convenience method that opens a {@link Dbi} with a default
310310
* {@link Comparator} that is not invoked from native code.
311311
* <p>
312-
* For more options when opening a {@link Dbi} see {@link Env#buildDbi()}.
312+
* For more options when opening a {@link Dbi} see {@link Env#createDbi()}.
313313
* </p>
314314
* @param name name of the database (or null if no name is required)
315315
* @param dbiFlagSet Flags to open the database with
@@ -328,7 +328,7 @@ public Dbi<T> openDbi(final byte[] name,
328328
* @param name name of the database (or null if no name is required)
329329
* @param flags to open the database with
330330
* @return a database that is ready to use
331-
* @deprecated Instead use {@link Env#buildDbi()} or {@link Env#openDbi(String, DbiFlagSet)}
331+
* @deprecated Instead use {@link Env#createDbi()} or {@link Env#openDbi(String, DbiFlagSet)}
332332
* Convenience method that opens a {@link Dbi} with a UTF-8 database name and default {@link
333333
* Comparator} that is not invoked from native code.
334334
*/
@@ -344,7 +344,7 @@ public Dbi<T> openDbi(final String name, final DbiFlags... flags) {
344344
* comparator will be used.
345345
* @param flags to open the database with
346346
* @return a database that is ready to use
347-
* @deprecated Instead use {@link Env#buildDbi()}
347+
* @deprecated Instead use {@link Env#createDbi()}
348348
* Convenience method that opens a {@link Dbi} with a UTF-8 database name and associated {@link
349349
* Comparator} for use by {@link CursorIterable} when comparing start/stop keys.
350350
*
@@ -368,7 +368,7 @@ public Dbi<T> openDbi(final String name,
368368
* @param nativeCb whether LMDB native code calls back to the Java comparator
369369
* @param flags to open the database with
370370
* @return a database that is ready to use
371-
* @deprecated Instead use {@link Env#buildDbi()}
371+
* @deprecated Instead use {@link Env#createDbi()}
372372
* Convenience method that opens a {@link Dbi} with a UTF-8 database name and associated {@link
373373
* Comparator}. The comparator will be used by {@link CursorIterable} when comparing start/stop
374374
* keys as a minimum. If nativeCb is {@code true}, this comparator will also be called by LMDB to
@@ -388,15 +388,15 @@ public Dbi<T> openDbi(final String name,
388388
* @param name name of the database (or null if no name is required)
389389
* @param flags to open the database with
390390
* @return a database that is ready to use
391-
* @deprecated Instead use {@link Env#buildDbi()}
391+
* @deprecated Instead use {@link Env#createDbi()}
392392
* <hr>
393393
* Convenience method that opens a {@link Dbi} with a default {@link Comparator} that is not
394394
* invoked from native code.
395395
*/
396396
@Deprecated()
397397
public Dbi<T> openDbi(final byte[] name,
398398
final DbiFlags... flags) {
399-
return buildDbi()
399+
return createDbi()
400400
.setDbName(name)
401401
.withDefaultComparator()
402402
.setDbiFlags(flags)
@@ -408,7 +408,7 @@ public Dbi<T> openDbi(final byte[] name,
408408
* @param comparator custom comparator callback (or null to use LMDB default)
409409
* @param flags to open the database with
410410
* @return a database that is ready to use
411-
* @deprecated Instead use {@link Env#buildDbi()}
411+
* @deprecated Instead use {@link Env#createDbi()}
412412
* <hr>
413413
* Convenience method that opens a {@link Dbi} with an associated {@link Comparator} that is not
414414
* invoked from native code.
@@ -418,7 +418,7 @@ public Dbi<T> openDbi(final byte[] name,
418418
final Comparator<T> comparator,
419419
final DbiFlags... flags) {
420420
requireNonNull(comparator);
421-
return buildDbi()
421+
return createDbi()
422422
.setDbName(name)
423423
.withIteratorComparator(ignored -> comparator)
424424
.setDbiFlags(flags)
@@ -431,7 +431,7 @@ public Dbi<T> openDbi(final byte[] name,
431431
* @param nativeCb whether native code calls back to the Java comparator
432432
* @param flags to open the database with
433433
* @return a database that is ready to use
434-
* @deprecated Instead use {@link Env#buildDbi()}
434+
* @deprecated Instead use {@link Env#createDbi()}
435435
* <hr>
436436
* Convenience method that opens a {@link Dbi} with an associated {@link Comparator} that may be
437437
* invoked from native code if specified.
@@ -459,7 +459,7 @@ public Dbi<T> openDbi(
459459
* @param nativeCb whether native LMDB code should call back to the Java comparator
460460
* @param flags to open the database with
461461
* @return a database that is ready to use
462-
* @deprecated Instead use {@link Env#buildDbi()}
462+
* @deprecated Instead use {@link Env#createDbi()}
463463
* Open the {@link Dbi} using the passed {@link Txn}.
464464
*
465465
* <p>The caller must commit the transaction after this method returns in order to retain the

src/test/java/org/lmdbjava/ByteBufferProxyTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void buffersMustBeDirect() {
6767
try (Env<ByteBuffer> env = create()
6868
.setMaxReaders(1)
6969
.open(dir)) {
70-
final Dbi<ByteBuffer> db = env.buildDbi()
70+
final Dbi<ByteBuffer> db = env.createDbi()
7171
.setDbName(DB_1)
7272
.withDefaultComparator()
7373
.setDbiFlags(MDB_CREATE)

src/test/java/org/lmdbjava/CursorIterableIntegerDupTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public void openClosedBackwardTestWithGuava() {
337337
return guava.compare(array1, array2);
338338
};
339339

340-
final Dbi<ByteBuffer> guavaDbi = env.buildDbi()
340+
final Dbi<ByteBuffer> guavaDbi = env.createDbi()
341341
.setDbName(DB_1).withIteratorComparator(ignored -> comparator)
342342
.setDbiFlags(MDB_CREATE)
343343
.open();
@@ -529,25 +529,25 @@ static class MyArgumentProvider implements ArgumentsProvider {
529529
public Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters,
530530
ExtensionContext context) throws Exception {
531531
final DbiFactory defaultComparatorDb = new DbiFactory("defaultComparator", env ->
532-
env.buildDbi()
532+
env.createDbi()
533533
.setDbName(DB_1)
534534
.withDefaultComparator()
535535
.setDbiFlags(DBI_FLAGS)
536536
.open());
537537
final DbiFactory nativeComparatorDb = new DbiFactory("nativeComparator", env ->
538-
env.buildDbi()
538+
env.createDbi()
539539
.setDbName(DB_2)
540540
.withNativeComparator()
541541
.setDbiFlags(DBI_FLAGS)
542542
.open());
543543
final DbiFactory callbackComparatorDb = new DbiFactory("callbackComparator", env ->
544-
env.buildDbi()
544+
env.createDbi()
545545
.setDbName(DB_3)
546546
.withCallbackComparator(MyArgumentProvider::buildComparator)
547547
.setDbiFlags(DBI_FLAGS)
548548
.open());
549549
final DbiFactory iteratorComparatorDb = new DbiFactory("iteratorComparator", env ->
550-
env.buildDbi()
550+
env.createDbi()
551551
.setDbName(DB_4)
552552
.withIteratorComparator(MyArgumentProvider::buildComparator)
553553
.setDbiFlags(DBI_FLAGS)

src/test/java/org/lmdbjava/CursorIterableIntegerKeyTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public void openClosedBackwardTestWithGuava() {
432432
bb2.reset();
433433
return guava.compare(array1, array2);
434434
};
435-
final Dbi<ByteBuffer> guavaDbi = env.buildDbi()
435+
final Dbi<ByteBuffer> guavaDbi = env.createDbi()
436436
.setDbName(DB_1)
437437
.withIteratorComparator(ignored -> comparator)
438438
.setDbiFlags(MDB_CREATE)
@@ -602,25 +602,25 @@ static class MyArgumentProvider implements ArgumentsProvider {
602602
public Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters,
603603
ExtensionContext context) throws Exception {
604604
final DbiFactory defaultComparatorDb = new DbiFactory("defaultComparator", env ->
605-
env.buildDbi()
605+
env.createDbi()
606606
.setDbName(DB_1)
607607
.withDefaultComparator()
608608
.setDbiFlags(DBI_FLAGS)
609609
.open());
610610
final DbiFactory nativeComparatorDb = new DbiFactory("nativeComparator", env ->
611-
env.buildDbi()
611+
env.createDbi()
612612
.setDbName(DB_2)
613613
.withNativeComparator()
614614
.setDbiFlags(DBI_FLAGS)
615615
.open());
616616
final DbiFactory callbackComparatorDb = new DbiFactory("callbackComparator", env ->
617-
env.buildDbi()
617+
env.createDbi()
618618
.setDbName(DB_3)
619619
.withCallbackComparator(MyArgumentProvider::buildComparator)
620620
.setDbiFlags(DBI_FLAGS)
621621
.open());
622622
final DbiFactory iteratorComparatorDb = new DbiFactory("iteratorComparator", env ->
623-
env.buildDbi()
623+
env.createDbi()
624624
.setDbName(DB_4)
625625
.withIteratorComparator(MyArgumentProvider::buildComparator)
626626
.setDbiFlags(DBI_FLAGS)

src/test/java/org/lmdbjava/CursorIterablePerfTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ public void before() throws IOException {
5959

6060
final DbiFlagSet dbiFlagSet = MDB_CREATE;
6161
// Use a java comparator for start/stop keys only
62-
Dbi<ByteBuffer> dbJavaComparator = env.buildDbi()
62+
Dbi<ByteBuffer> dbJavaComparator = env.createDbi()
6363
.setDbName("JavaComparator")
6464
.withDefaultComparator()
6565
.setDbiFlags(dbiFlagSet)
6666
.open();
6767
// Use LMDB comparator for start/stop keys
68-
Dbi<ByteBuffer> dbLmdbComparator = env.buildDbi()
68+
Dbi<ByteBuffer> dbLmdbComparator = env.createDbi()
6969
.setDbName("LmdbComparator")
7070
.withNativeComparator()
7171
.setDbiFlags(dbiFlagSet)
7272
.open();
7373

7474
// Use a java comparator for start/stop keys and as a callback comparator
75-
Dbi<ByteBuffer> dbCallbackComparator = env.buildDbi()
75+
Dbi<ByteBuffer> dbCallbackComparator = env.createDbi()
7676
.setDbName("CallBackComparator")
7777
.withCallbackComparator(bufferProxy::getComparator)
7878
.setDbiFlags(dbiFlagSet)

src/test/java/org/lmdbjava/CursorIterableTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void openClosedBackwardTestWithGuava() {
308308
bb2.reset();
309309
return guava.compare(array1, array2);
310310
};
311-
final Dbi<ByteBuffer> guavaDbi = env.buildDbi()
311+
final Dbi<ByteBuffer> guavaDbi = env.createDbi()
312312
.setDbName(DB_1)
313313
.withDefaultComparator()
314314
.setDbiFlags(MDB_CREATE)
@@ -537,25 +537,25 @@ static class MyArgumentProvider implements ArgumentsProvider {
537537
public Stream<? extends Arguments> provideArguments(ParameterDeclarations parameters,
538538
ExtensionContext context) throws Exception {
539539
final DbiFactory defaultComparatorDb = new DbiFactory("defaultComparator", env ->
540-
env.buildDbi()
540+
env.createDbi()
541541
.setDbName(DB_1)
542542
.withDefaultComparator()
543543
.setDbiFlags(DBI_FLAGS)
544544
.open());
545545
final DbiFactory nativeComparatorDb = new DbiFactory("nativeComparator", env ->
546-
env.buildDbi()
546+
env.createDbi()
547547
.setDbName(DB_2)
548548
.withNativeComparator()
549549
.setDbiFlags(DBI_FLAGS)
550550
.open());
551551
final DbiFactory callbackComparatorDb = new DbiFactory("callbackComparator", env ->
552-
env.buildDbi()
552+
env.createDbi()
553553
.setDbName(DB_3)
554554
.withCallbackComparator(BUFFER_PROXY::getComparator)
555555
.setDbiFlags(DBI_FLAGS)
556556
.open());
557557
final DbiFactory iteratorComparatorDb = new DbiFactory("iteratorComparator", env ->
558-
env.buildDbi()
558+
env.createDbi()
559559
.setDbName(DB_4)
560560
.withIteratorComparator(BUFFER_PROXY::getComparator)
561561
.setDbiFlags(DBI_FLAGS)

src/test/java/org/lmdbjava/DbiBuilderTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void after() {
5757

5858
@Test
5959
public void unnamed() {
60-
final Dbi<ByteBuffer> dbi = env.buildDbi()
60+
final Dbi<ByteBuffer> dbi = env.createDbi()
6161
.withoutDbName()
6262
.withDefaultComparator()
6363
.setDbiFlags(DbiFlags.MDB_CREATE)
@@ -70,7 +70,7 @@ public void unnamed() {
7070

7171
@Test
7272
public void named() {
73-
final Dbi<ByteBuffer> dbi = env.buildDbi()
73+
final Dbi<ByteBuffer> dbi = env.createDbi()
7474
.setDbName("foo")
7575
.withDefaultComparator()
7676
.setDbiFlags(DbiFlags.MDB_CREATE)
@@ -89,7 +89,7 @@ public void named() {
8989

9090
@Test
9191
public void named2() {
92-
final Dbi<ByteBuffer> dbi = env.buildDbi()
92+
final Dbi<ByteBuffer> dbi = env.createDbi()
9393
.setDbName("foo".getBytes(StandardCharsets.US_ASCII))
9494
.withDefaultComparator()
9595
.setDbiFlags(DbiFlags.MDB_CREATE)
@@ -108,7 +108,7 @@ public void named2() {
108108

109109
@Test
110110
public void nativeComparator() {
111-
final Dbi<ByteBuffer> dbi = env.buildDbi()
111+
final Dbi<ByteBuffer> dbi = env.createDbi()
112112
.setDbName("foo")
113113
.withNativeComparator()
114114
.addDbiFlags(DbiFlags.MDB_CREATE)
@@ -131,7 +131,7 @@ public void callback() {
131131
}
132132
};
133133

134-
final Dbi<ByteBuffer> dbi = env.buildDbi()
134+
final Dbi<ByteBuffer> dbi = env.createDbi()
135135
.setDbName("foo")
136136
.withCallbackComparator(ignored -> comparator)
137137
.addDbiFlags(DbiFlags.MDB_CREATE)
@@ -163,7 +163,7 @@ public void callback() {
163163

164164
@Test
165165
public void flags() {
166-
final Dbi<ByteBuffer> dbi = env.buildDbi()
166+
final Dbi<ByteBuffer> dbi = env.createDbi()
167167
.setDbName("foo")
168168
.withDefaultComparator()
169169
.setDbiFlags(DbiFlags.MDB_DUPSORT, DbiFlags.MDB_DUPFIXED) // Will get overwritten

src/test/java/org/lmdbjava/DbiTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void afterEach() {
109109
void close() {
110110
assertThatThrownBy(
111111
() -> {
112-
final Dbi<ByteBuffer> db = env.buildDbi()
112+
final Dbi<ByteBuffer> db = env.createDbi()
113113
.setDbName(DB_1)
114114
.withDefaultComparator()
115115
.addDbiFlag(MDB_CREATE)
@@ -152,7 +152,7 @@ private <T> void doCustomComparator(
152152
Comparator<T> comparator,
153153
IntFunction<T> serializer,
154154
ToIntFunction<T> deserializer) {
155-
final Dbi<T> db = env.buildDbi()
155+
final Dbi<T> db = env.createDbi()
156156
.setDbName(DB_1)
157157
.withCallbackComparator(ignored -> comparator)
158158
.setDbiFlags(MDB_CREATE)
@@ -203,7 +203,7 @@ private <T> void doDbiWithComparatorThreadSafety(
203203
ToIntFunction<T> deserializer) {
204204
final DbiFlagSet flags = DbiFlagSet.of(MDB_CREATE, MDB_INTEGERKEY);
205205
final Comparator<T> comparator = comparatorSupplier.get();
206-
final Dbi<T> db = env.buildDbi()
206+
final Dbi<T> db = env.createDbi()
207207
.setDbName(DB_1)
208208
.withCallbackComparator(ignored -> comparator)
209209
.setDbiFlags(flags)

0 commit comments

Comments
 (0)