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
Datacratic::ConfigurationService Struct Reference
Inheritance diagram for Datacratic::ConfigurationService:
Datacratic::InternalConfigurationService Datacratic::ZookeeperConfigurationService

List of all members.

Classes

struct  Watch

Public Types

enum  ChangeType { VALUE_CHANGED, DELETED, CREATED, NEW_CHILD }
typedef std::function< void(std::string
path, ChangeType changeType)> 
OnChange
typedef std::function< bool(std::string
key, Json::Value value)> 
OnEntry

Public Member Functions

virtual void set (const std::string &key, const Json::Value &value)=0
virtual std::string setUnique (const std::string &key, const Json::Value &value)=0
virtual Json::Value getJson (const std::string &key, Watch watch=Watch())=0
virtual std::vector< std::string > getChildren (const std::string &key, Watch watch=Watch())=0
virtual bool forEachEntry (const OnEntry &onEntry, const std::string &startPrefix="") const =0
virtual void removePath (const std::string &path)=0
void dump (std::ostream &stream) const
Json::Value jsonDump () const

Static Public Member Functions

static std::pair< std::string,
std::string > 
splitPath (const std::string &path)

Detailed Description

Definition at line 104 of file service_base.h.


Member Typedef Documentation

typedef std::function<void (std::string path, ChangeType changeType)> Datacratic::ConfigurationService::OnChange

Callback that will be called if a given entry changes.

Definition at line 120 of file service_base.h.

typedef std::function<bool (std::string key, Json::Value value)> Datacratic::ConfigurationService::OnEntry

Callback called for each entry. Return code is whether we should continue iterating or not.

Definition at line 250 of file service_base.h.


Member Enumeration Documentation

Enumerator:
VALUE_CHANGED 

Contents of value have changed.

DELETED 

Value has been deleted outright.

CREATED 

Entry was created.

NEW_CHILD 

Entry has new children.

Definition at line 110 of file service_base.h.


Member Function Documentation

void Datacratic::ConfigurationService::dump ( std::ostream &  stream) const

Dump the contents to the given stream. Mostly useful for debugging purposes.

Definition at line 117 of file service_base.cc.

virtual bool Datacratic::ConfigurationService::forEachEntry ( const OnEntry onEntry,
const std::string &  startPrefix = "" 
) const [pure virtual]

Iterate over all entries in the configuration database recursively, calling the given callback. Note that no watches can be set using this function.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.

virtual std::vector<std::string> Datacratic::ConfigurationService::getChildren ( const std::string &  key,
Watch  watch = Watch() 
) [pure virtual]

Return the set of children for the given node. If the node does not exist, the watch will be set for the creation of the node itself.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.

virtual Json::Value Datacratic::ConfigurationService::getJson ( const std::string &  key,
Watch  watch = Watch() 
) [pure virtual]

Get the JSON value of a node in a synchronous manner.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.

Dump the contents to a json object.

Definition at line 130 of file service_base.cc.

virtual void Datacratic::ConfigurationService::removePath ( const std::string &  path) [pure virtual]

Recursively remove everything below this path.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.

virtual void Datacratic::ConfigurationService::set ( const std::string &  key,
const Json::Value value 
) [pure virtual]

Set the JSON value of a node. If the linkedKey is set, then the lifecycle of the value is linked to the lifecycle of the linked key, and if the linked key is deleted the given value will be deleted also.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.

virtual std::string Datacratic::ConfigurationService::setUnique ( const std::string &  key,
const Json::Value value 
) [pure virtual]

Set the value of a node, ensuring that it's created by adding a suffix if necessary. Returns the actual place under which it was added.

Implemented in Datacratic::InternalConfigurationService, and Datacratic::ZookeeperConfigurationService.


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