RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
Datacratic::ZookeeperConnection Struct Reference

List of all members.

Classes

struct  Callback
struct  CallbackNode
struct  Node

Public Types

enum  CheckResult { CR_RETRY, CR_DONE }

Public Member Functions

CallbackgetCallback (Callback::Type watch, std::string const &path, void *data)
void connect (const std::string &host, double timeoutInSeconds=5)
void reconnect ()
void close ()
CheckResult checkRes (int returnCode, int &retries, const char *operation, const char *path)
std::pair< std::string, bool > createNode (const std::string &path, const std::string &value, bool ephemeral, bool sequence, bool mustSucceed=true, bool createPath=false)
bool deleteNode (const std::string &path, bool throwIfNodeMissing=true)
void createPath (const std::string &path)
void removePath (const std::string &path)
bool nodeExists (const std::string &path, Callback::Type watcher=0, void *watcherData=0)
std::string readNode (const std::string &path, Callback::Type watcher=0, void *watcherData=0)
void writeNode (const std::string &path, const std::string &value)
std::vector< std::string > getChildren (const std::string &path, bool failIfNodeMissing=true, Callback::Type watcher=0, void *watcherData=0)

Static Public Member Functions

static std::string printEvent (int eventType)
static std::string printState (int state)
static void eventHandlerFn (zhandle_t *handle, int event, int state, const char *path, void *context)
static std::string fixPath (const std::string &path)

Public Attributes

std::timed_mutex connectMutex
std::string host
int recvTimeout
clientid_t clientId
zhandle_t * handle
std::set< Nodeephemerals
CallbackNode< Callbackcallbacks

Detailed Description

Definition at line 28 of file zookeeper.h.


Member Enumeration Documentation

Enumerator:
CR_RETRY 

Retry the operation.

CR_DONE 

Finish the operation.

Definition at line 97 of file zookeeper.h.


Member Function Documentation

ZookeeperConnection::CheckResult Datacratic::ZookeeperConnection::checkRes ( int  returnCode,
int &  retries,
const char *  operation,
const char *  path 
)

Check the result of an operation. Will either return RETRY if the operation should be redone, DONE if the operation completed, or will throw an exception if there was an error.

Definition at line 160 of file zookeeper.cc.

void Datacratic::ZookeeperConnection::connect ( const std::string &  host,
double  timeoutInSeconds = 5 
)

Connect synchronously.

Definition at line 84 of file zookeeper.cc.

void Datacratic::ZookeeperConnection::createPath ( const std::string &  path)

Create nodes such that the given path exists.

Definition at line 195 of file zookeeper.cc.

bool Datacratic::ZookeeperConnection::deleteNode ( const std::string &  path,
bool  throwIfNodeMissing = true 
)

Delete the given node. If throwIfNodeMissing is false, then a missing node will not be considered an error. Returns if the node was deleted or not, and throws an exception in the case of an error.

Definition at line 304 of file zookeeper.cc.

std::string Datacratic::ZookeeperConnection::fixPath ( const std::string &  path) [static]

Remove trailing slash so it can be used as a path.

Definition at line 324 of file zookeeper.cc.

bool Datacratic::ZookeeperConnection::nodeExists ( const std::string &  path,
Callback::Type  watcher = 0,
void *  watcherData = 0 
)

Return if the node exists or not.

Definition at line 336 of file zookeeper.cc.

void Datacratic::ZookeeperConnection::removePath ( const std::string &  path)

Remove the entire path including all children.

Definition at line 228 of file zookeeper.cc.


The documentation for this struct was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator