K - V - public class DbBuilder<K,V>
extends java.lang.Object
| Constructor and Description |
|---|
DbBuilder()
Build a database with unlimited variable-size key and value and no Map interface.
|
DbBuilder(int keySize,
int valueSize,
boolean... hybrid)
Build a database with fixed- or hybrid-size fields and no Map interface.
|
DbBuilder(TypeIO<K> keyType,
TypeIO<V> valueType)
Build a database a Map interface.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<K,V> |
asMap()
Represents the database as a java.util.Map.
|
DbBuilder<K,V> |
autocommit(boolean b)
Wheter to automatically commit each write in journaling mode.
|
DbBuilder<K,V> |
autoflush(boolean b)
Whether to instantly persist each write.
|
DbBuilder<K,V> |
create()
Creates the in-memory database.
|
DbBuilder<K,V> |
create(java.lang.String path)
Creates the on-disk database over a specified file.
|
Db |
db()
Return raw interface to the database.
|
DbBuilder<K,V> |
journalDurabilityVsSpeed(float v)
Controls the tradeoff between the average write speed and the durability of writes.
|
DbBuilder<K,V> |
journaling(boolean b)
Enable journaling.
|
DbBuilder<K,V> |
journalSizeVsSpeed(float v)
Chooses the max journal size from a meaningful range, in an exponential way,
where 0 corresponds to 2mb, 0.5 to 23mb, and 1 to 130mb.
|
DbBuilder<K,V> |
open(java.lang.String path)
Opens the existing on-disk database.
|
DbBuilder<K,V> |
openOrCreate(java.lang.String path)
If the file exists tries to open it, otherwise creates a new on-disk database.
|
DbBuilder<K,V> |
speedVsCapacity(float v)
Controls the tradeoff between the capacity and speed.
|
DbBuilder<K,V> |
synchronize(boolean b)
Whether to ensure a thread safety.
|
java.lang.String |
toString() |
public DbBuilder()
public DbBuilder(int keySize,
int valueSize,
boolean... hybrid)
keySize - - key size, ether fixed or limited by this parametervalueSize - - value size, ether fixed or limited by this parameterhybrid - - key hybrid flag, value hybrid flagpublic DbBuilder<K,V> speedVsCapacity(float v)
v - - value in the range 0 (better speed) to 1 (better capacity), default is 0.5public DbBuilder<K,V> journaling(boolean b)
b - whether to enable journalingpublic DbBuilder<K,V> journalSizeVsSpeed(float v)
v - - journal max size preference, the allowed range is 0..1, the default value is 0.5public DbBuilder<K,V> journalDurabilityVsSpeed(float v)
v - - a preference in the range of 0..1, where 0 is for max durability, 1 for max speed, default is 0.5public DbBuilder<K,V> autocommit(boolean b)
b - - a choice; default is truepublic DbBuilder<K,V> autoflush(boolean b)
b - - a choice; default is falsepublic DbBuilder<K,V> synchronize(boolean b)
b - - a choice; default is falsepublic DbBuilder<K,V> create(java.lang.String path) throws RuntimeIOException
RuntimeIOExceptionpublic DbBuilder<K,V> open(java.lang.String path) throws RuntimeIOException
RuntimeIOExceptionpublic DbBuilder<K,V> openOrCreate(java.lang.String path) throws RuntimeIOException
RuntimeIOExceptionpublic java.util.Map<K,V> asMap()
DbBuilder(TypeIO, TypeIO)public Db db()
Dbpublic java.lang.String toString()
toString in class java.lang.Object