Kyoto Tycoon

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Attributes
kyototycoon::RemoteDB Class Reference

Remote database. More...

`#include <ktremotedb.h>`

List of all members.

## Classes
struct | BulkRecord
| Record for bulk operation. More...
class | Cursor
| Cursor to indicate a record. More...
class | Error
| Error data. More...
struct | OrderedKey
| Key with the order.
## Public Types
enum | BinaryMagic { BMNOP = 0xb0, BMREPLICATION = 0xb1, BMPLAYSCRIPT = 0xb4, BMSETBULK = 0xb8, BMREMOVEBULK = 0xb9, BMGETBULK = 0xba, BMERROR = 0xbf }
| Magic data in binary protocol. More...
enum | BinaryOption { BONOREPLY = 1 << 0 }
| Options in binary protocol. More...
## Public Member Functions
| RemoteDB ()
| Default constructor.
virtual | ~RemoteDB ()
| Destructor.
Error | error () const
| Get the last happened error code.
bool | open (const std::string &host="", int32_t port=DEFPORT, double timeout=-1)
| Open the connection.
bool | close (bool grace=true)
| Close the connection.
bool | report (std::map< std::string, std::string > *strmap)
| Get the report of the server information.
bool | play_script (const std::string &name, const std::map< std::string, std::string > &params, std::map< std::string, std::string > *result)
| Call a procedure of the scripting extension.
bool | tune_replication (const std::string &host="", int32_t port=DEFPORT, uint64_t ts=kc::UINT64MAX, double iv=-1)
| Set the replication configuration.
bool | ulog_list (std::vector< UpdateLogger::FileStatus > *fstvec)
| Get status of each update log files.
bool | ulog_remove (uint64_t ts=kc::UINT64MAX)
| Remove old update log files.
bool | status (std::map< std::string, std::string > *strmap)
| Get the miscellaneous status information.
bool | clear ()
| Remove all records.
bool | synchronize (bool hard, const std::string &command="")
| Synchronize updated contents with the file and the device.
int64_t | count ()
| Get the number of records.
int64_t | size ()
| Get the size of the database file.
bool | set (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz, int64_t xt=kc::INT64MAX)
| Set the value of a record.
bool | set (const std::string &key, const std::string &value, int64_t xt=kc::INT64MAX)
| Set the value of a record.
bool | add (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz, int64_t xt=kc::INT64MAX)
| Add a record.
bool | add (const std::string &key, const std::string &value, int64_t xt=kc::INT64MAX)
| Set the value of a record.
bool | replace (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz, int64_t xt=kc::INT64MAX)
| Replace the value of a record.
bool | replace (const std::string &key, const std::string &value, int64_t xt=kc::INT64MAX)
| Replace the value of a record.
bool | append (const char *kbuf, size_t ksiz, const char *vbuf, size_t vsiz, int64_t xt=kc::INT64MAX)
| Append the value of a record.
bool | append (const std::string &key, const std::string &value, int64_t xt=kc::INT64MAX)
| Set the value of a record.
int64_t | increment (const char *kbuf, size_t ksiz, int64_t num, int64_t orig=0, int64_t xt=kc::INT64MAX)
| Add a number to the numeric integer value of a record.
int64_t | increment (const std::string &key, int64_t num, int64_t orig=0, int64_t xt=kc::INT64MAX)
| Add a number to the numeric integer value of a record.
double | increment_double (const char *kbuf, size_t ksiz, double num, double orig=0, int64_t xt=kc::INT64MAX)
| Add a number to the numeric double value of a record.
double | increment_double (const std::string &key, double num, double orig=0, int64_t xt=kc::INT64MAX)
| Add a number to the numeric double value of a record.
bool | cas (const char *kbuf, size_t ksiz, const char *ovbuf, size_t ovsiz, const char *nvbuf, size_t nvsiz, int64_t xt=kc::INT64MAX)
| Perform compare-and-swap.
bool | cas (const std::string &key, const std::string &ovalue, const std::string &nvalue, int64_t xt=kc::INT64MAX)
| Perform compare-and-swap.
bool | remove (const char *kbuf, size_t ksiz)
| Remove a record.
bool | remove (const std::string &key)
| Remove a record.
char * | get (const char *kbuf, size_t ksiz, size_t *sp, int64_t *xtp=NULL)
| Retrieve the value of a record.
bool | get (const std::string &key, std::string *value, int64_t *xtp=NULL)
| Retrieve the value of a record.
int32_t | check (const char *kbuf, size_t ksiz, int64_t *xtp=NULL)
| Check the existence of a record.
int32_t | check (const std::string &key, int64_t *xtp=NULL)
| Check the existence of a record.
char * | seize (const char *kbuf, size_t ksiz, size_t *sp, int64_t *xtp=NULL)
| Retrieve the value of a record and remove it atomically.
bool | seize (const std::string &key, std::string *value, int64_t *xtp=NULL)
| Retrieve the value of a record and remove it atomically.
int64_t | set_bulk (const std::map< std::string, std::string > &recs, int64_t xt=kc::INT64MAX, bool atomic=true)
| Store records at once.
int64_t | remove_bulk (const std::vector< std::string > &keys, bool atomic=true)
| Store records at once.
int64_t | get_bulk (const std::vector< std::string > &keys, std::map< std::string, std::string > *recs, bool atomic=true)
| Retrieve records at once.
bool | vacuum (int64_t step=0)
| Scan the database and eliminate regions of expired records.
int64_t | match_prefix (const std::string &prefix, std::vector< std::string > *strvec, int64_t max=-1)
| Get keys matching a prefix string.
int64_t | match_regex (const std::string &regex, std::vector< std::string > *strvec, int64_t max=-1)
| Get keys matching a regular expression string.
int64_t | match_similar (const std::string &origin, size_t range, bool utf, std::vector< std::string > *strvec, int64_t max=-1)
| Get keys similar to a string in terms of the levenshtein distance.
void | set_target (const std::string &expr)
| Set the target database.
void | set_signal_waiting (const std::string &name, double timeout=0)
| Set the signal waiting condition of the next procedure.
void | set_signal_sending (const std::string &name, bool broadcast=false)
| Set the signal sending condition of the next procedure.
bool | play_script_binary (const std::string &name, const std::map< std::string, std::string > &params, std::map< std::string, std::string > *result=NULL, uint32_t opts=0)
| Call a procedure of the scripting extension in the binary protocol.
int64_t | set_bulk_binary (const std::vector< BulkRecord > &recs, uint32_t opts=0)
| Store records at once in the binary protocol.
int64_t | remove_bulk_binary (const std::vector< BulkRecord > &recs, uint32_t opts=0)
| Store records at once in the binary protocol.
int64_t | get_bulk_binary (std::vector< BulkRecord > *recs)
| Retrieve records at once in the binary protocol.
const std::string | expression ()
| Get the expression of the socket.
Cursor * | cursor ()
| Create a cursor object.
## Static Public Attributes
static const size_t | DATAMAXSIZ = 1ULL << 28
| The maximum size of each record data.

## Detailed Description

Remote database.

Note:
  This class is a concrete class to access remote database servers. This class can be inherited but overwriting methods is forbidden. Before every database operation, it is necessary to call the RemoteDB::open method in order to connect to a database server. To avoid resource starvation it is important to close every database file by the RemoteDB::close method when the connection is no longer in use. Although all methods of this class are thread-safe, its instance does not have mutual exclusion mechanism. So, multiple threads must not share the same instance and they must use their own respective instances.

## Member Enumeration Documentation

enum kyototycoon::RemoteDB::BinaryMagic

Magic data in binary protocol.

Enumerator:

  BMNOP | no operation
  BMREPLICATION | replication
  BMPLAYSCRIPT | call a scripting procedure
  BMSETBULK | set in bulk
  BMREMOVEBULK | remove in bulk
  BMGETBULK | get in bulk
  BMERROR | error

enum kyototycoon::RemoteDB::BinaryOption

Options in binary protocol.

Enumerator:

  BONOREPLY | no reply

## Constructor & Destructor Documentation

kyototycoon::RemoteDB::RemoteDB | ( |  | ) | `[explicit]`

Default constructor.

virtual kyototycoon::RemoteDB::~RemoteDB | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

Error kyototycoon::RemoteDB::error | ( |  | ) | const

Get the last happened error code.

Returns:
  the last happened error code.

bool kyototycoon::RemoteDB::open | ( | const std::string & | host = `""`,
|  | int32_t | port = `DEFPORT`,
|  | double | timeout = `-1`
| ) |  |

Open the connection.

Parameters:

  host | the name or the address of the server. If it is an empty string, the local host is specified.
  port | the port numger of the server.
  timeout | the timeout of each operation in seconds. If it is not more than 0, no timeout is specified.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::close | ( | bool | grace = `true` | ) |

Close the connection.

Parameters:

  grace | true for graceful shutdown, or false for immediate disconnection.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::report | ( | std::map< std::string, std::string > * | strmap | ) |

Get the report of the server information.

Parameters:

  strmap | a string map to contain the result.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::play_script | ( | const std::string & | name,
|  | const std::map< std::string, std::string > & | params,
|  | std::map< std::string, std::string > * | result
| ) |  |

Call a procedure of the scripting extension.

Parameters:

  name | the name of the procedure to call.
  params | a string map containing the input parameters.
  result | a string map to contain the output data.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::tune_replication | ( | const std::string & | host = `""`,
|  | int32_t | port = `DEFPORT`,
|  | uint64_t | ts = `kc::UINT64MAX`,
|  | double | iv = `-1`
| ) |  |

Set the replication configuration.

Parameters:

  host | the name or the address of the master server. If it is an empty string, replication is disabled.
  port | the port numger of the server.
  ts | the maximum time stamp of already read logs. If it is kyotocabinet::UINT64MAX, the current setting is not modified. If it is kyotocabinet::UINT64MAX - 1, the current time is specified.
  iv | the interval of each replication operation in milliseconds. If it is negative, the current interval is not modified.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::ulog_list | ( | std::vector< UpdateLogger::FileStatus > * | fstvec | ) |

Get status of each update log files.

Parameters:

  fstvec | a vector to store status structures of each update log files.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::ulog_remove | ( | uint64_t | ts = `kc::UINT64MAX` | ) |

Remove old update log files.

Parameters:

  ts | the maximum time stamp of disposable logs.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::status | ( | std::map< std::string, std::string > * | strmap | ) |

Get the miscellaneous status information.

Parameters:

  strmap | a string map to contain the result.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::clear | ( |  | ) |

Remove all records.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::synchronize | ( | bool | hard,
|  | const std::string & | command = `""`
| ) |  |

Synchronize updated contents with the file and the device.

Parameters:

  hard | true for physical synchronization with the device, or false for logical synchronization with the file system.
  command | the command name to process the database file. If it is an empty string, no postprocessing is performed.

Returns:
  true on success, or false on failure.

int64_t kyototycoon::RemoteDB::count | ( |  | ) |

Get the number of records.

Returns:
  the number of records, or -1 on failure.

int64_t kyototycoon::RemoteDB::size | ( |  | ) |

Get the size of the database file.

Returns:
  the size of the database file in bytes, or -1 on failure.

bool kyototycoon::RemoteDB::set | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | const char * | vbuf,
|  | size_t | vsiz,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Set the value of a record.

Parameters:

  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.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  true on success, or false on failure.

Note:
  If no record corresponds to the key, a new record is created. If the corresponding record exists, the value is overwritten.

bool kyototycoon::RemoteDB::set | ( | const std::string & | key,
|  | const std::string & | value,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Set the value of a record.

Note:
  Equal to the original DB::set method except that the parameters are std::string.

bool kyototycoon::RemoteDB::add | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | const char * | vbuf,
|  | size_t | vsiz,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Add a record.

Parameters:

  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.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  true on success, or false on failure.

Note:
  If no record corresponds to the key, a new record is created. If the corresponding record exists, the record is not modified and false is returned.

bool kyototycoon::RemoteDB::add | ( | const std::string & | key,
|  | const std::string & | value,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Set the value of a record.

Note:
  Equal to the original DB::add method except that the parameters are std::string.

bool kyototycoon::RemoteDB::replace | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | const char * | vbuf,
|  | size_t | vsiz,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Replace the value of a record.

Parameters:

  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.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  true on success, or false on failure.

Note:
  If no record corresponds to the key, no new record is created and false is returned. If the corresponding record exists, the value is modified.

bool kyototycoon::RemoteDB::replace | ( | const std::string & | key,
|  | const std::string & | value,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Replace the value of a record.

Note:
  Equal to the original DB::replace method except that the parameters are std::string.

bool kyototycoon::RemoteDB::append | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | const char * | vbuf,
|  | size_t | vsiz,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Append the value of a record.

Parameters:

  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.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  true on success, or false on failure.

Note:
  If no record corresponds to the key, a new record is created. If the corresponding record exists, the given value is appended at the end of the existing value.

bool kyototycoon::RemoteDB::append | ( | const std::string & | key,
|  | const std::string & | value,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Set the value of a record.

Note:
  Equal to the original DB::append method except that the parameters are std::string.

int64_t kyototycoon::RemoteDB::increment | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | int64_t | num,
|  | int64_t | orig = `0`,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Add a number to the numeric integer value of a record.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.
  num | the additional number.
  orig | the origin number if no record corresponds to the key. If it is INT64MIN and no record corresponds, this function fails. If it is INT64MAX, the value is set as the additional number regardless of the current value.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  the result value, or kyotocabinet::INT64MIN on failure.

Note:
  The value is serialized as an 8-byte binary integer in big-endian order, not a decimal string. If existing value is not 8-byte, this function fails.

int64_t kyototycoon::RemoteDB::increment | ( | const std::string & | key,
|  | int64_t | num,
|  | int64_t | orig = `0`,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Add a number to the numeric integer value of a record.

Note:
  Equal to the original DB::increment method except that the parameter is std::string.

double kyototycoon::RemoteDB::increment_double | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | double | num,
|  | double | orig = `0`,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Add a number to the numeric double value of a record.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.
  num | the additional number.
  orig | the origin number if no record corresponds to the key. If it is negative infinity and no record corresponds, this function fails. If it is positive infinity, the value is set as the additional number regardless of the current value.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  the result value, or Not-a-number on failure.

Note:
  The value is serialized as an 16-byte binary fixed-point number in big-endian order, not a decimal string. If existing value is not 16-byte, this function fails.

double kyototycoon::RemoteDB::increment_double | ( | const std::string & | key,
|  | double | num,
|  | double | orig = `0`,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Add a number to the numeric double value of a record.

Note:
  Equal to the original DB::increment_double method except that the parameter is std::string.

bool kyototycoon::RemoteDB::cas | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | const char * | ovbuf,
|  | size_t | ovsiz,
|  | const char * | nvbuf,
|  | size_t | nvsiz,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Perform compare-and-swap.

Parameters:

  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.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.

Returns:
  true on success, or false on failure.

bool kyototycoon::RemoteDB::cas | ( | const std::string & | key,
|  | const std::string & | ovalue,
|  | const std::string & | nvalue,
|  | int64_t | xt = `kc::INT64MAX`
| ) |  |

Perform compare-and-swap.

Note:
  Equal to the original DB::cas method except that the parameters are std::string.

bool kyototycoon::RemoteDB::remove | ( | const char * | kbuf,
|  | size_t | ksiz
| ) |  |

Remove a record.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.

Returns:
  true on success, or false on failure.

Note:
  If no record corresponds to the key, false is returned.

bool kyototycoon::RemoteDB::remove | ( | const std::string & | key | ) |

Remove a record.

Note:
  Equal to the original DB::remove method except that the parameter is std::string.

char* kyototycoon::RemoteDB::get | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | size_t * | sp,
|  | int64_t * | xtp = `NULL`
| ) |  |

Retrieve the value of a record.

Parameters:

  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.
  xtp | the pointer to the variable into which the absolute expiration time is assigned. If it is NULL, it is ignored.

Returns:
  the pointer to the value region of the corresponding record, or NULL on failure.

Note:
  If no record corresponds to the key, NULL is returned. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a C-style string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

bool kyototycoon::RemoteDB::get | ( | const std::string & | key,
|  | std::string * | value,
|  | int64_t * | xtp = `NULL`
| ) |  |

Retrieve the value of a record.

Note:
  Equal to the original DB::get method except that the first parameters is the key string and the second parameter is a string to contain the result and the return value is bool for success.

int32_t kyototycoon::RemoteDB::check | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | int64_t * | xtp = `NULL`
| ) |  |

Check the existence of a record.

Parameters:

  kbuf | the pointer to the key region.
  ksiz | the size of the key region.
  xtp | the pointer to the variable into which the absolute expiration time is assigned. If it is NULL, it is ignored.

Returns:
  the size of the value, or -1 on failure.

int32_t kyototycoon::RemoteDB::check | ( | const std::string & | key,
|  | int64_t * | xtp = `NULL`
| ) |  |

Check the existence of a record.

Note:
  Equal to the original DB::check method except that the first parameters is the key string.

char* kyototycoon::RemoteDB::seize | ( | const char * | kbuf,
|  | size_t | ksiz,
|  | size_t * | sp,
|  | int64_t * | xtp = `NULL`
| ) |  |

Retrieve the value of a record and remove it atomically.

Parameters:

  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.
  xtp | the pointer to the variable into which the absolute expiration time is assigned. If it is NULL, it is ignored.

Returns:
  the pointer to the value region of the corresponding record, or NULL on failure.

Note:
  If no record corresponds to the key, NULL is returned. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a C-style string. Because the region of the return value is allocated with the the new[] operator, it should be released with the delete[] operator when it is no longer in use.

bool kyototycoon::RemoteDB::seize | ( | const std::string & | key,
|  | std::string * | value,
|  | int64_t * | xtp = `NULL`
| ) |  |

Retrieve the value of a record and remove it atomically.

Note:
  Equal to the original DB::seize method except that the first parameters is the key string and the second parameter is a string to contain the result and the return value is bool for success.

int64_t kyototycoon::RemoteDB::set_bulk | ( | const std::map< std::string, std::string > & | recs,
|  | int64_t | xt = `kc::INT64MAX`,
|  | bool | atomic = `true`
| ) |  |

Store records at once.

Parameters:

  recs | the records to store.
  xt | the expiration time from now in seconds. If it is negative, the absolute value is treated as the epoch time.
  atomic | true to perform all operations atomically, or false for non-atomic operations.

Returns:
  the number of stored records, or -1 on failure.

int64_t kyototycoon::RemoteDB::remove_bulk | ( | const std::vector< std::string > & | keys,
|  | bool | atomic = `true`
| ) |  |

Store records at once.

Parameters:

  keys | the keys of the records to remove.
  atomic | true to perform all operations atomically, or false for non-atomic operations.

Returns:
  the number of removed records, or -1 on failure.

int64_t kyototycoon::RemoteDB::get_bulk | ( | const std::vector< std::string > & | keys,
|  | std::map< std::string, std::string > * | recs,
|  | bool | atomic = `true`
| ) |  |

Retrieve records at once.

Parameters:

  keys | the keys of the records to retrieve.
  recs | a string map to contain the retrieved records.
  atomic | true to perform all operations atomically, or false for non-atomic operations.

Returns:
  the number of retrieved records, or -1 on failure.

bool kyototycoon::RemoteDB::vacuum | ( | int64_t | step = `0` | ) |

Scan the database and eliminate regions of expired records.

Parameters:

  step | the number of steps. If it is not more than 0, the whole region is scanned.

Returns:
  true on success, or false on failure.

int64_t kyototycoon::RemoteDB::match_prefix | ( | const std::string & | prefix,
|  | std::vector< std::string > * | strvec,
|  | int64_t | max = `-1`
| ) |  |

Get keys matching a prefix string.

Parameters:

  prefix | the prefix string.
  strvec | a string vector to contain the result.
  max | the maximum number to retrieve. If it is negative, no limit is specified.

Returns:
  the number of retrieved keys or -1 on failure.

int64_t kyototycoon::RemoteDB::match_regex | ( | const std::string & | regex,
|  | std::vector< std::string > * | strvec,
|  | int64_t | max = `-1`
| ) |  |

Get keys matching a regular expression string.

Parameters:

  regex | the regular expression string.
  strvec | a string vector to contain the result.
  max | the maximum number to retrieve. If it is negative, no limit is specified.

Returns:
  the number of retrieved keys or -1 on failure.

int64_t kyototycoon::RemoteDB::match_similar | ( | const std::string & | origin,
|  | size_t | range,
|  | bool | utf,
|  | std::vector< std::string > * | strvec,
|  | int64_t | max = `-1`
| ) |  |

Get keys similar to a string in terms of the levenshtein distance.

Parameters:

  origin | the origin string.
  range | the maximum distance of keys to adopt.
  utf | flag to treat keys as UTF-8 strings.
  strvec | a string vector to contain the result.
  max | the maximum number to retrieve. If it is negative, no limit is specified.

Returns:
  the number of retrieved keys or -1 on failure.

void kyototycoon::RemoteDB::set_target | ( | const std::string & | expr | ) |

Set the target database.

Parameters:

  expr | the expression of the target database.

void kyototycoon::RemoteDB::set_signal_waiting | ( | const std::string & | name,
|  | double | timeout = `0`
| ) |  |

Set the signal waiting condition of the next procedure.

Parameters:

  name | the name of the condition variable.
  timeout | the timeout in seconds.

Note:
  This setting is used only in the next procedure call and then cleared.

void kyototycoon::RemoteDB::set_signal_sending | ( | const std::string & | name,
|  | bool | broadcast = `false`
| ) |  |

Set the signal sending condition of the next procedure.

Parameters:

  name | the name of the condition variable.
  broadcast | true to send the signal to every corresponding thread, or false to send it to just one thread.

Note:
  This setting is used only in the next procedure call and then cleared.

bool kyototycoon::RemoteDB::play_script_binary | ( | const std::string & | name,
|  | const std::map< std::string, std::string > & | params,
|  | std::map< std::string, std::string > * | result = `NULL`,
|  | uint32_t | opts = `0`
| ) |  |

Call a procedure of the scripting extension in the binary protocol.

Parameters:

  name | the name of the procedure to call.
  params | a string map containing the input parameters.
  result | a string map to contain the output data. If it is NULL, it is ignored.
  opts | the optional features by bitwise-or: RemoteDB::BONOREPLY to ignore reply from the server.

Returns:
  true on success, or false on failure.

int64_t kyototycoon::RemoteDB::set_bulk_binary | ( | const std::vector< BulkRecord > & | recs,
|  | uint32_t | opts = `0`
| ) |  |

Store records at once in the binary protocol.

Parameters:

  recs | the records to store.
  opts | the optional features by bitwise-or: RemoteDB::BONOREPLY to ignore reply from the server.

Returns:
  the number of stored records, or -1 on failure.

int64_t kyototycoon::RemoteDB::remove_bulk_binary | ( | const std::vector< BulkRecord > & | recs,
|  | uint32_t | opts = `0`
| ) |  |

Store records at once in the binary protocol.

Parameters:

  recs | the records to remove.
  opts | the optional features by bitwise-or: RemoteDB::BONOREPLY to ignore reply from the server.

Returns:
  the number of removed records, or -1 on failure.

int64_t kyototycoon::RemoteDB::get_bulk_binary | ( | std::vector< BulkRecord > * | recs | ) |

Retrieve records at once in the binary protocol.

Parameters:

  recs | the records to retrieve. The value member and the xt member of each retrieved record will be set appropriately. The xt member of each missing record will be -1.

Returns:
  the number of retrieved records, or -1 on failure.

const std::string kyototycoon::RemoteDB::expression | ( |  | ) |

Get the expression of the socket.

Returns:
  the expression of the socket or an empty string on failure.

Cursor* kyototycoon::RemoteDB::cursor | ( |  | ) |

Create a cursor object.

Returns:
  the return value is the created cursor object.

Note:
  Because the object of the return value is allocated by the constructor, it should be released with the delete operator when it is no longer in use.

## Member Data Documentation

const size_t kyototycoon::RemoteDB::DATAMAXSIZ = 1ULL << 28`[static]`

The maximum size of each record data.