|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttokyocabinet.ADB
public class ADB
Abstract database is a set of interfaces to use on-memory hash database, on-memory tree database, hash database, B+ tree database, fixed-length database, and table database with the same API. Before operations to store or retrieve records, it is necessary to connect the abstract database object to the concrete one. The method `open' is used to open a concrete database and the method `close' is used to close the database. To avoid data missing or corruption, it is important to close every database instance when it is no longer in use. It is forbidden for multible database objects in a process to open the same database at the same time.
Constructor Summary | |
---|---|
ADB()
Create an abstract database object. |
Method Summary | |
---|---|
double |
adddouble(byte[] key,
double num)
Add a real number to a record. |
double |
adddouble(java.lang.String key,
double num)
Add a real number to a record. |
int |
addint(byte[] key,
int num)
Add an integer to a record. |
int |
addint(java.lang.String key,
int num)
Add an integer to a record. |
boolean |
close()
Close the database. |
boolean |
copy(java.lang.String path)
Copy the database file. |
protected void |
finalize()
Release resources. |
long |
fsiz()
Get the size of the database. |
java.util.List |
fwmkeys(byte[] prefix,
int max)
Get forward matching keys. |
java.util.List |
fwmkeys(java.lang.String prefix,
int max)
Get forward matching keys. |
byte[] |
get(byte[] key)
Retrieve a record. |
java.lang.String |
get(java.lang.String key)
Retrieve a record. |
boolean |
iterinit()
Initialize the iterator. |
byte[] |
iternext()
Get the next key of the iterator. |
java.lang.String |
iternext2()
Get the next key of the iterator. |
java.util.List |
misc(java.lang.String name,
java.util.List args)
Call a versatile function for miscellaneous operations. |
boolean |
open(java.lang.String name)
Open a database. |
boolean |
optimize()
Optimize the storage. |
boolean |
optimize(java.lang.String params)
Optimize the storage. |
boolean |
out(byte[] key)
Remove a record. |
boolean |
out(java.lang.String key)
Remove a record. |
java.lang.String |
path()
Get the path of the database file. |
boolean |
put(byte[] key,
byte[] value)
Store a record. |
boolean |
put(java.lang.String key,
java.lang.String value)
Store a record. |
boolean |
putcat(byte[] key,
byte[] value)
Concatenate a value at the end of the existing record. |
boolean |
putcat(java.lang.String key,
java.lang.String value)
Concatenate a value at the end of the existing record. |
boolean |
putkeep(byte[] key,
byte[] value)
Store a new record. |
boolean |
putkeep(java.lang.String key,
java.lang.String value)
Store a new record. |
long |
rnum()
Get the number of records. |
long |
size()
Get the size of the database. |
boolean |
sync()
Synchronize updated contents with the file and the device. |
boolean |
tranabort()
Abort the transaction. |
boolean |
tranbegin()
Begin the transaction. |
boolean |
trancommit()
Commit the transaction. |
boolean |
vanish()
Remove all records. |
int |
vsiz(byte[] key)
Get the size of the value of a record. |
int |
vsiz(java.lang.String key)
Get the size of the value of a record. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ADB()
Method Detail |
---|
public double adddouble(byte[] key, double num)
adddouble
in interface DBM
key
- the key.num
- the additional value.
public double adddouble(java.lang.String key, double num)
adddouble
in interface DBM
adddouble(byte[], double)
public int addint(byte[] key, int num)
addint
in interface DBM
key
- the key.num
- the additional value.
public int addint(java.lang.String key, int num)
addint
in interface DBM
addint(byte[], int)
public boolean close()
public boolean copy(java.lang.String path)
path
- the path of the destination file. If it begins with `@', the trailing substring
is executed as a command line.
protected void finalize()
finalize
in class java.lang.Object
public long fsiz()
fsiz
in interface DBM
size()
public java.util.List fwmkeys(byte[] prefix, int max)
fwmkeys
in interface DBM
prefix
- the prefix of the corresponding keys.max
- the maximum number of keys to be fetched. If it is negative, no limit is
specified.
public java.util.List fwmkeys(java.lang.String prefix, int max)
fwmkeys
in interface DBM
fwmkeys(byte[], int)
public byte[] get(byte[] key)
get
in interface DBM
key
- the key.
public java.lang.String get(java.lang.String key)
get
in interface DBM
get(byte[])
public boolean iterinit()
iterinit
in interface DBM
public byte[] iternext()
iternext
in interface DBM
public java.lang.String iternext2()
iternext2
in interface DBM
iternext()
public java.util.List misc(java.lang.String name, java.util.List args)
name
- the name of the function.args
- a list object of arguments. If it is `null', no argument is specified.
public boolean open(java.lang.String name)
name
- the name of the database. If it is "*", the database will be an on-memory hash
database. If it is "+", the database will be an on-memory tree database. If its suffix is
".tch", the database will be a hash database. If its suffix is ".tcb", the database will be
a B+ tree database. If its suffix is ".tcf", the database will be a fixed-length database.
If its suffix is ".tct", the database will be a table database. Otherwise, this method
fails. Tuning parameters can trail the name, separated by "#". Each parameter is composed
of the name and the value, separated by "=". On-memory hash database supports "bnum",
"capnum", and "capsiz". On-memory tree database supports "capnum" and "capsiz". Hash
database supports "mode", "bnum", "apow", "fpow", "opts", "rcnum", and "xmsiz". B+ tree
database supports "mode", "lmemb", "nmemb", "bnum", "apow", "fpow", "opts", "lcnum", "ncnum",
and "xmsiz". Fixed-length database supports "mode", "width", and "limsiz". Table database
supports "mode", "bnum", "apow", "fpow", "opts", "rcnum", "lcnum", "ncnum", "xmsiz", and
"idx".
public boolean optimize()
optimize(String)
public boolean optimize(java.lang.String params)
params
- specifies the string of the tuning parameters, which works as with the tuning
of parameters the method `open'. If it is `null', it is not used.
public boolean out(byte[] key)
out
in interface DBM
key
- the key.
public boolean out(java.lang.String key)
out
in interface DBM
out(byte[])
public java.lang.String path()
public boolean put(byte[] key, byte[] value)
put
in interface DBM
key
- the key.value
- the value.
public boolean put(java.lang.String key, java.lang.String value)
put
in interface DBM
put(byte[], byte[])
public boolean putcat(byte[] key, byte[] value)
key
- the key.value
- the value.
public boolean putcat(java.lang.String key, java.lang.String value)
putcat(byte[], byte[])
public boolean putkeep(byte[] key, byte[] value)
putkeep
in interface DBM
key
- the key.value
- the value.
public boolean putkeep(java.lang.String key, java.lang.String value)
putkeep
in interface DBM
putkeep(byte[], byte[])
public long rnum()
rnum
in interface DBM
public long size()
public boolean sync()
public boolean tranabort()
public boolean tranbegin()
public boolean trancommit()
public boolean vanish()
public int vsiz(byte[] key)
key
- the key.
public int vsiz(java.lang.String key)
vsiz(byte[])
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |