-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathDbiFlags.java
More file actions
101 lines (94 loc) · 3.28 KB
/
DbiFlags.java
File metadata and controls
101 lines (94 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* Copyright © 2016-2025 The LmdbJava Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lmdbjava;
/** Flags for use when opening a {@link Dbi}. */
public enum DbiFlags implements MaskedFlag {
/**
* Use reverse string keys.
*
* <p>Keys are strings to be compared in reverse order, from the end of the strings to the
* beginning. By default, keys are treated as strings and compared from beginning to end.
*/
MDB_REVERSEKEY(0x02),
/**
* Use sorted duplicates.
*
* <p>Duplicate keys may be used in the database. Or, from another perspective, keys may have
* multiple data items, stored in sorted order. By default keys must be unique and may have only a
* single data item.
*/
MDB_DUPSORT(0x04),
/**
* Numeric keys in native byte order: either unsigned int or size_t. The keys must all be of the
* same size.
*/
MDB_INTEGERKEY(0x08),
/**
* With {@link #MDB_DUPSORT}, sorted dup items have fixed size.
*
* <p>This flag may only be used in combination with {@link #MDB_DUPSORT}. This option tells the
* library that the data items for this database are all the same size, which allows further
* optimizations in storage and retrieval. When all data items are the same size, the {@link
* SeekOp#MDB_GET_MULTIPLE} and {@link SeekOp#MDB_NEXT_MULTIPLE} cursor operations may be used to
* retrieve multiple items at once.
*/
MDB_DUPFIXED(0x10),
/**
* With {@link #MDB_DUPSORT}, dups are {@link #MDB_INTEGERKEY}-style integers.
*
* <p>This option specifies that duplicate data items are binary integers, similar to {@link
* #MDB_INTEGERKEY} keys.
*/
MDB_INTEGERDUP(0x20),
/**
* Compare the <b>numeric</b> keys in native byte order and as unsigned.
*
* <p>This option is applied only to {@link java.nio.ByteBuffer}, {@link org.agrona.DirectBuffer}
* and byte array keys. {@link io.netty.buffer.ByteBuf} keys are always compared in native byte
* order and as unsigned.
*/
MDB_UNSIGNEDKEY(0x30, false),
/**
* With {@link #MDB_DUPSORT}, use reverse string dups.
*
* <p>This option specifies that duplicate data items should be compared as strings in reverse
* order.
*/
MDB_REVERSEDUP(0x40),
/**
* Create the named database if it doesn't exist.
*
* <p>This option is not allowed in a read-only transaction or a read-only environment.
*/
MDB_CREATE(0x4_0000);
private final int mask;
private final boolean propagatedToLmdb;
DbiFlags(final int mask, final boolean propagatedToLmdb) {
this.mask = mask;
this.propagatedToLmdb = propagatedToLmdb;
}
DbiFlags(final int mask) {
this(mask, true);
}
@Override
public int getMask() {
return mask;
}
@Override
public boolean isPropagatedToLmdb() {
return propagatedToLmdb;
}
}