Kyoto Tycoon

- Main Page
- Namespaces
- Classes
- Files

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

Public Types | Public Member Functions
kyototycoon::ReplicationClient Class Reference

Replication client. More...

`#include <ktremotedb.h>`

List of all members.

## Public Types
enum | Option { WHITESID = 1 << 0 }
| Opening options. More...
## Public Member Functions
| ReplicationClient ()
| Default constructor.
bool | open (const std::string &host="", int32_t port=DEFPORT, double timeout=-1, uint64_t ts=0, uint16_t sid=0, uint32_t opts=0)
| Open the connection.
bool | close ()
| Close the connection.
char * | read (size_t *sp, uint64_t *tsp)
| Read the next message.
bool | alive ()
| Check whether the connection is alive.

## Detailed Description

Replication client.

## Member Enumeration Documentation

enum kyototycoon::ReplicationClient::Option

Opening options.

Enumerator:

  WHITESID | fetch messages of the specified SID only

## Constructor & Destructor Documentation

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

Default constructor.

## Member Function Documentation

bool kyototycoon::ReplicationClient::open | ( | const std::string & | host = `""`,
|  | int32_t | port = `DEFPORT`,
|  | double | timeout = `-1`,
|  | uint64_t | ts = `0`,
|  | uint16_t | sid = `0`,
|  | uint32_t | opts = `0`
| ) |  |

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.
  ts | the maximum time stamp of already read logs.
  sid | the server ID number.
  opts | the optional features by bitwise-or: ReplicationClient::WHITESID to fetch messages whose server ID number is the specified one only.

Returns:
  true on success, or false on failure.

bool kyototycoon::ReplicationClient::close | ( |  | ) |

Close the connection.

Returns:
  true on success, or false on failure.

char* kyototycoon::ReplicationClient::read | ( | size_t * | sp,
|  | uint64_t * | tsp
| ) |  |

Read the next message.

Parameters:

  sp | the pointer to the variable into which the size of the region of the return value is assigned.
  tsp | the pointer to the variable into which the time stamp is assigned.

Returns:
  the pointer to the region of the message, or NULL on failure. 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::ReplicationClient::alive | ( |  | ) |

Check whether the connection is alive.

Returns:
  true if alive, false if not.