Kyoto Tycoon
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

Opening options.

Enumerator:
WHITESID 

fetch messages of the specified SID only


Constructor & Destructor Documentation

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:
hostthe name or the address of the server. If it is an empty string, the local host is specified.
portthe port numger of the server.
timeoutthe timeout of each operation in seconds. If it is not more than 0, no timeout is specified.
tsthe maximum time stamp of already read logs.
sidthe server ID number.
optsthe 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.

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:
spthe pointer to the variable into which the size of the region of the return value is assigned.
tspthe 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.

Check whether the connection is alive.

Returns:
true if alive, false if not.