Interface of database abstraction.
|
__init__(self,
opts=0)
Create a database object. |
|
|
|
error(self)
Get the last happened error. |
|
|
|
open(self,
path=' : ' ,
mode=6)
Open a database file. |
|
|
|
close(self)
Close the database file. |
|
|
|
accept(self,
key,
visitor,
writable=True)
Accept a visitor to a record. |
|
|
|
accept_bulk(self,
keys,
visitor,
writable=True)
Accept a visitor to multiple records at once. |
|
|
|
iterate(self,
visitor,
writable=True)
Iterate to accept a visitor for each record. |
|
|
|
set(self,
key,
value)
Set the value of a record. |
|
|
|
add(self,
key,
value)
Add a record. |
|
|
|
replace(self,
key,
value)
Replace the value of a record. |
|
|
|
append(self,
key,
value)
Append the value of a record. |
|
|
|
increment(self,
key,
num=0,
orig=0)
Add a number to the numeric integer value of a record. |
|
|
|
increment_double(self,
key,
num=0.0,
orig=0.0)
Add a number to the numeric double value of a record. |
|
|
|
cas(self,
key,
oval,
nval)
Perform compare-and-swap. |
|
|
|
remove(self,
key)
Remove a record. |
|
|
|
get(self,
key)
Retrieve the value of a record. |
|
|
|
get_str(self,
key)
Retrieve the value of a record. |
|
|
|
check(self,
key)
Check the existence of a record. |
|
|
|
seize(self,
key)
Retrieve the value of a record and remove it atomically. |
|
|
|
seize_str(self,
key)
Retrieve the value of a record and remove it atomically. |
|
|
|
set_bulk(self,
recs,
atomic=True)
Store records at once. |
|
|
|
remove_bulk(self,
keys,
atomic=True)
Remove records at once. |
|
|
|
get_bulk(self,
keys,
atomic=True)
Retrieve records at once. |
|
|
|
get_bulk_str(self,
keys,
atomic=True)
Retrieve records at once. |
|
|
|
clear(self)
Remove all records. |
|
|
|
synchronize(self,
hard=False,
proc=None)
Synchronize updated contents with the file and the device. |
|
|
|
occupy(self,
writable=False,
proc=None)
Occupy database by locking and do something meanwhile. |
|
|
|
copy(self,
dest)
Create a copy of the database file. |
|
|
|
|
|
|
|
transaction(self,
proc,
hard=False)
Perform entire transaction by a functor. |
|
|
|
|
|
|
|
count(self)
Get the number of records. |
|
|
|
size(self)
Get the size of the database file. |
|
|
|
path(self)
Get the path of the database file. |
|
|
|
status(self)
Get the miscellaneous status information. |
|
|
|
match_prefix(self,
prefix,
max=-1)
Get keys matching a prefix string. |
|
|
|
match_regex(self,
regex,
max=-1)
Get keys matching a regular expression string. |
|
|
|
match_similar(self,
origin,
range=1,
utf=False,
max=-1)
Get keys similar to a string in terms of the levenshtein distance. |
|
|
|
merge(self,
srcary,
mode=0)
Merge records from other databases. |
|
|
|
cursor(self)
Create a cursor object. |
|
|
|
|
|
shift(self)
Remove the first record. |
|
|
|
|
|
|
|
__repr__(self)
Get the representing expression. |
|
|
|
__str__(self)
Get the string expression. |
|
|
|
__len__(self)
Alias of the count method. |
|
|
|
__getitem__(self,
key,
value)
Alias of the get method. |
|
|
|
__setitem__(self,
key,
value)
Alias of the set method. |
|
|
|
__iter__(self)
Alias of the cursor method. |
|
|
|
process(proc,
path=' * ' ,
mode=6,
opts=0)
Process a database by a functor. |
|
|
|
GEXCEPTIONAL = 1
generic mode: exceptional mode.
|
|
GCONCURRENT = 2
generic mode: concurrent mode.
|
|
OREADER = 1
open mode: open as a reader.
|
|
OWRITER = 2
open mode: open as a writer.
|
|
OCREATE = 4
open mode: writer creating.
|
|
OTRUNCATE = 8
open mode: writer truncating.
|
|
OAUTOTRAN = 16
open mode: auto transaction.
|
|
OAUTOSYNC = 32
open mode: auto synchronization.
|
|
ONOLOCK = 64
open mode: open without locking.
|
|
OTRYLOCK = 128
open mode: lock without blocking.
|
|
ONOREPAIR = 256
open mode: open without auto repair.
|
|
MSET = 0
merge mode: overwrite the existing value.
|
|
MADD = 1
merge mode: keep the existing value.
|
|
MREPLACE = 2
merge mode: modify the existing record only.
|
|
MAPPEND = 3
merge mode: append the new value.
|