Kyoto Tycoon
|
Cursor to indicate a record. More...
#include <kttimeddb.h>
Public Member Functions | |
Cursor (TimedDB *db) | |
Constructor. | |
virtual | ~Cursor () |
Destructor. | |
bool | jump () |
Jump the cursor to the first record for forward scan. | |
bool | jump (const char *kbuf, size_t ksiz) |
Jump the cursor to a record for forward scan. | |
bool | jump (const std::string &key) |
Jump the cursor to a record for forward scan. | |
bool | jump_back () |
Jump the cursor to the last record for backward scan. | |
bool | jump_back (const char *kbuf, size_t ksiz) |
Jump the cursor to a record for backward scan. | |
bool | jump_back (const std::string &key) |
Jump the cursor to a record for backward scan. | |
bool | step () |
Step the cursor to the next record. | |
bool | step_back () |
Step the cursor to the previous record. | |
bool | accept (Visitor *visitor, bool writable=true, bool step=false) |
Accept a visitor to the current record. | |
bool | set_value (const char *vbuf, size_t vsiz, int64_t xt=kc::INT64MAX, bool step=false) |
Set the value of the current record. | |
bool | set_value_str (const std::string &value, int64_t xt=kc::INT64MAX, bool step=false) |
Set the value of the current record. | |
bool | remove () |
Remove the current record. | |
char * | get_key (size_t *sp, bool step=false) |
Get the key of the current record. | |
bool | get_key (std::string *key, bool step=false) |
Get the key of the current record. | |
char * | get_value (size_t *sp, bool step=false) |
Get the value of the current record. | |
bool | get_value (std::string *value, bool step=false) |
Get the value of the current record. | |
char * | get (size_t *ksp, const char **vbp, size_t *vsp, int64_t *xtp=NULL, bool step=false) |
Get a pair of the key and the value of the current record. | |
bool | get (std::string *key, std::string *value, int64_t *xtp=NULL, bool step=false) |
Get a pair of the key and the value of the current record. | |
char * | seize (size_t *ksp, const char **vbp, size_t *vsp, int64_t *xtp=NULL) |
Get a pair of the key and the value of the current record and remove it atomically. | |
bool | seize (std::string *key, std::string *value, int64_t *xtp=NULL) |
Get a pair of the key and the value of the current record and remove it atomically. | |
TimedDB * | db () |
Get the database object. | |
kc::BasicDB::Error | error () |
Get the last happened error. | |
Friends | |
class | TimedDB |
Cursor to indicate a record.
kyototycoon::TimedDB::Cursor::Cursor | ( | TimedDB * | db | ) | [explicit] |
Constructor.
db | the container database object. |
virtual kyototycoon::TimedDB::Cursor::~Cursor | ( | ) | [virtual] |
Destructor.
bool kyototycoon::TimedDB::Cursor::jump | ( | ) |
Jump the cursor to the first record for forward scan.
bool kyototycoon::TimedDB::Cursor::jump | ( | const char * | kbuf, |
size_t | ksiz | ||
) |
Jump the cursor to a record for forward scan.
kbuf | the pointer to the key region. |
ksiz | the size of the key region. |
bool kyototycoon::TimedDB::Cursor::jump | ( | const std::string & | key | ) |
Jump the cursor to a record for forward scan.
Jump the cursor to the last record for backward scan.
bool kyototycoon::TimedDB::Cursor::jump_back | ( | const char * | kbuf, |
size_t | ksiz | ||
) |
Jump the cursor to a record for backward scan.
kbuf | the pointer to the key region. |
ksiz | the size of the key region. |
bool kyototycoon::TimedDB::Cursor::jump_back | ( | const std::string & | key | ) |
Jump the cursor to a record for backward scan.
bool kyototycoon::TimedDB::Cursor::step | ( | ) |
Step the cursor to the next record.
Step the cursor to the previous record.
bool kyototycoon::TimedDB::Cursor::accept | ( | Visitor * | visitor, |
bool | writable = true , |
||
bool | step = false |
||
) |
Accept a visitor to the current record.
visitor | a visitor object. |
writable | true for writable operation, or false for read-only operation. |
step | true to move the cursor to the next record, or false for no move. |
bool kyototycoon::TimedDB::Cursor::set_value | ( | const char * | vbuf, |
size_t | vsiz, | ||
int64_t | xt = kc::INT64MAX , |
||
bool | step = false |
||
) |
Set the value of the current record.
vbuf | the pointer to the value region. |
vsiz | the size of the value region. |
xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time. |
step | true to move the cursor to the next record, or false for no move. |
bool kyototycoon::TimedDB::Cursor::set_value_str | ( | const std::string & | value, |
int64_t | xt = kc::INT64MAX , |
||
bool | step = false |
||
) |
Set the value of the current record.
bool kyototycoon::TimedDB::Cursor::remove | ( | ) |
Remove the current record.
char* kyototycoon::TimedDB::Cursor::get_key | ( | size_t * | sp, |
bool | step = false |
||
) |
Get the key of the current record.
sp | the pointer to the variable into which the size of the region of the return value is assigned. |
step | true to move the cursor to the next record, or false for no move. |
bool kyototycoon::TimedDB::Cursor::get_key | ( | std::string * | key, |
bool | step = false |
||
) |
Get the key of the current record.
char* kyototycoon::TimedDB::Cursor::get_value | ( | size_t * | sp, |
bool | step = false |
||
) |
Get the value of the current record.
sp | the pointer to the variable into which the size of the region of the return value is assigned. |
step | true to move the cursor to the next record, or false for no move. |
bool kyototycoon::TimedDB::Cursor::get_value | ( | std::string * | value, |
bool | step = false |
||
) |
Get the value of the current record.
char* kyototycoon::TimedDB::Cursor::get | ( | size_t * | ksp, |
const char ** | vbp, | ||
size_t * | vsp, | ||
int64_t * | xtp = NULL , |
||
bool | step = false |
||
) |
Get a pair of the key and the value of the current record.
ksp | the pointer to the variable into which the size of the region of the return value is assigned. |
vbp | the pointer to the variable into which the pointer to the value region is assigned. |
vsp | the pointer to the variable into which the size of the value region is assigned. |
xtp | the pointer to the variable into which the absolute expiration time is assigned. If it is NULL, it is ignored. |
step | true to move the cursor to the next record, or false for no move. |
bool kyototycoon::TimedDB::Cursor::get | ( | std::string * | key, |
std::string * | value, | ||
int64_t * | xtp = NULL , |
||
bool | step = false |
||
) |
Get a pair of the key and the value of the current record.
char* kyototycoon::TimedDB::Cursor::seize | ( | size_t * | ksp, |
const char ** | vbp, | ||
size_t * | vsp, | ||
int64_t * | xtp = NULL |
||
) |
Get a pair of the key and the value of the current record and remove it atomically.
ksp | the pointer to the variable into which the size of the region of the return value is assigned. |
vbp | the pointer to the variable into which the pointer to the value region is assigned. |
vsp | the pointer to the variable into which the size of the value region is assigned. |
xtp | the pointer to the variable into which the absolute expiration time is assigned. If it is NULL, it is ignored. |
bool kyototycoon::TimedDB::Cursor::seize | ( | std::string * | key, |
std::string * | value, | ||
int64_t * | xtp = NULL |
||
) |
Get a pair of the key and the value of the current record and remove it atomically.
Get the database object.
kc::BasicDB::Error kyototycoon::TimedDB::Cursor::error | ( | ) |
Get the last happened error.