Interface of database abstraction. More...
#include <kcdb.h>
Classes | |
class | Cursor |
Interface of cursor to indicate a record. More... | |
class | Visitor |
Interface to access a record. More... | |
Public Types | |
enum | Type { TYPEVOID = 0x00, TYPEPHASH = 0x01, TYPEPTREE = 0x02, TYPEPMISC = 0x08, TYPECACHE = 0x09, TYPEHASH = 0x11, TYPETREE = 0x12, TYPEMISC = 0x20 } |
Database types. More... | |
Public Member Functions | |
DB () | |
Default constructor. | |
virtual | ~DB () |
Destructor. | |
virtual bool | accept (const char *kbuf, size_t ksiz, Visitor *visitor, bool writable=true)=0 |
Accept a visitor to a record. | |
virtual bool | iterate (Visitor *visitor, bool writable=true)=0 |
Iterate to accept a visitor for each record. | |
virtual bool | set (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)=0 |
Set the value of a record. | |
virtual bool | set (const std::string &key, const std::string &value)=0 |
Set the value of a record. | |
virtual bool | add (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)=0 |
Add a record. | |
virtual bool | add (const std::string &key, const std::string &value)=0 |
Set the value of a record. | |
virtual bool | append (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz)=0 |
Append the value of a record. | |
virtual bool | append (const std::string &key, const std::string &value)=0 |
Set the value of a record. | |
virtual int64_t | increment (const char *kbuf, size_t ksiz, int64_t num)=0 |
Add a number to the numeric value of a record. | |
virtual int64_t | increment (const std::string &key, int64_t num)=0 |
Add a number to the numeric value of a record. | |
virtual double | increment (const char *kbuf, size_t ksiz, double num)=0 |
Add a number to the numeric value of a record. | |
virtual double | increment (const std::string &key, double num)=0 |
Add a number to the numeric value of a record. | |
virtual bool | cas (const char *kbuf, size_t ksiz, const char *ovbuf, size_t ovsiz, const char *nvbuf, size_t nvsiz)=0 |
Perform compare-and-swap. | |
virtual bool | cas (const std::string &key, const std::string &ovalue, const std::string &nvalue)=0 |
Perform compare-and-swap. | |
virtual bool | remove (const char *kbuf, size_t ksiz)=0 |
Remove a record. | |
virtual bool | remove (const std::string &key)=0 |
Remove a record. | |
virtual char * | get (const char *kbuf, size_t ksiz, size_t *sp)=0 |
Retrieve the value of a record. | |
virtual std::string * | get (const std::string &key)=0 |
Retrieve the value of a record. | |
virtual int32_t | get (const char *kbuf, size_t ksiz, char *vbuf, size_t max)=0 |
Retrieve the value of a record. | |
virtual bool | clear ()=0 |
Remove all records. | |
virtual int64_t | count ()=0 |
Get the number of records. | |
virtual Cursor * | cursor ()=0 |
Create a cursor object. | |
Static Public Member Functions | |
static const char * | typestring (uint32_t type) |
Get the string of a database type. |
Interface of database abstraction.
kyotocabinet::DB::DB | ( | ) | [explicit] |
Default constructor.
virtual kyotocabinet::DB::~DB | ( | ) | [virtual] |
Destructor.
static const char* kyotocabinet::DB::typestring | ( | uint32_t | type | ) | [static] |
Get the string of a database type.
type | the database type. |
virtual bool kyotocabinet::DB::accept | ( | const char * | kbuf, | |
size_t | ksiz, | |||
Visitor * | visitor, | |||
bool | writable = true | |||
) | [pure virtual] |
Accept a visitor to a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
visitor | a visitor object. | |
writable | true for writable operation, or false for read-only operation. |
Implemented in kyotocabinet::CacheDB, kyotocabinet::HashDB, kyotocabinet::PolyDB, kyotocabinet::ProtoDB< STRMAP >, and kyotocabinet::TreeDB.
virtual bool kyotocabinet::DB::iterate | ( | Visitor * | visitor, | |
bool | writable = true | |||
) | [pure virtual] |
Iterate to accept a visitor for each record.
visitor | a visitor object. | |
writable | true for writable operation, or false for read-only operation. |
Implemented in kyotocabinet::CacheDB, kyotocabinet::HashDB, kyotocabinet::PolyDB, kyotocabinet::ProtoDB< STRMAP >, and kyotocabinet::TreeDB.
virtual bool kyotocabinet::DB::set | ( | const char * | kbuf, | |
size_t | ksiz, | |||
const char * | vbuf, | |||
size_t | vsiz | |||
) | [pure virtual] |
Set the value of a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
vbuf | the pointer to the value region. | |
vsiz | the size of the value region. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::set | ( | const std::string & | key, | |
const std::string & | value | |||
) | [pure virtual] |
Set the value of a record.
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::add | ( | const char * | kbuf, | |
size_t | ksiz, | |||
const char * | vbuf, | |||
size_t | vsiz | |||
) | [pure virtual] |
Add a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
vbuf | the pointer to the value region. | |
vsiz | the size of the value region. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::add | ( | const std::string & | key, | |
const std::string & | value | |||
) | [pure virtual] |
Set the value of a record.
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::append | ( | const char * | kbuf, | |
size_t | ksiz, | |||
const char * | vbuf, | |||
size_t | vsiz | |||
) | [pure virtual] |
Append the value of a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
vbuf | the pointer to the value region. | |
vsiz | the size of the value region. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::append | ( | const std::string & | key, | |
const std::string & | value | |||
) | [pure virtual] |
Set the value of a record.
Implemented in kyotocabinet::FileDB.
virtual int64_t kyotocabinet::DB::increment | ( | const char * | kbuf, | |
size_t | ksiz, | |||
int64_t | num | |||
) | [pure virtual] |
Add a number to the numeric value of a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
num | the additional number. |
Implemented in kyotocabinet::FileDB.
virtual int64_t kyotocabinet::DB::increment | ( | const std::string & | key, | |
int64_t | num | |||
) | [pure virtual] |
Add a number to the numeric value of a record.
Implemented in kyotocabinet::FileDB.
virtual double kyotocabinet::DB::increment | ( | const char * | kbuf, | |
size_t | ksiz, | |||
double | num | |||
) | [pure virtual] |
Add a number to the numeric value of a record.
Implemented in kyotocabinet::FileDB.
virtual double kyotocabinet::DB::increment | ( | const std::string & | key, | |
double | num | |||
) | [pure virtual] |
Add a number to the numeric value of a record.
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::cas | ( | const char * | kbuf, | |
size_t | ksiz, | |||
const char * | ovbuf, | |||
size_t | ovsiz, | |||
const char * | nvbuf, | |||
size_t | nvsiz | |||
) | [pure virtual] |
Perform compare-and-swap.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
ovbuf | the pointer to the old value region. NULL means that no record corresponds. | |
ovsiz | the size of the old value region. | |
nvbuf | the pointer to the new value region. NULL means that the record is removed. | |
nvsiz | the size of new old value region. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::cas | ( | const std::string & | key, | |
const std::string & | ovalue, | |||
const std::string & | nvalue | |||
) | [pure virtual] |
Perform compare-and-swap.
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::remove | ( | const char * | kbuf, | |
size_t | ksiz | |||
) | [pure virtual] |
Remove a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::remove | ( | const std::string & | key | ) | [pure virtual] |
Remove a record.
Implemented in kyotocabinet::FileDB.
virtual char* kyotocabinet::DB::get | ( | const char * | kbuf, | |
size_t | ksiz, | |||
size_t * | sp | |||
) | [pure virtual] |
Retrieve the value of a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
sp | the pointer to the variable into which the size of the region of the return value is assigned. |
Implemented in kyotocabinet::FileDB.
virtual std::string* kyotocabinet::DB::get | ( | const std::string & | key | ) | [pure virtual] |
Retrieve the value of a record.
Implemented in kyotocabinet::FileDB.
virtual int32_t kyotocabinet::DB::get | ( | const char * | kbuf, | |
size_t | ksiz, | |||
char * | vbuf, | |||
size_t | max | |||
) | [pure virtual] |
Retrieve the value of a record.
kbuf | the pointer to the key region. | |
ksiz | the size of the key region. | |
vbuf | the pointer to the buffer into which the value of the corresponding record is written. | |
max | the size of the buffer. |
Implemented in kyotocabinet::FileDB.
virtual bool kyotocabinet::DB::clear | ( | ) | [pure virtual] |
Remove all records.
Implemented in kyotocabinet::CacheDB, kyotocabinet::HashDB, kyotocabinet::PolyDB, kyotocabinet::ProtoDB< STRMAP >, and kyotocabinet::TreeDB.
virtual int64_t kyotocabinet::DB::count | ( | ) | [pure virtual] |
Get the number of records.
Implemented in kyotocabinet::CacheDB, kyotocabinet::HashDB, kyotocabinet::PolyDB, kyotocabinet::ProtoDB< STRMAP >, and kyotocabinet::TreeDB.
virtual Cursor* kyotocabinet::DB::cursor | ( | ) | [pure virtual] |
Create a cursor object.
Implemented in kyotocabinet::CacheDB, kyotocabinet::FileDB, kyotocabinet::HashDB, kyotocabinet::PolyDB, kyotocabinet::ProtoDB< STRMAP >, and kyotocabinet::TreeDB.