AOSharedServiceLibrary
Public Member Functions | List of all members
AOSSL::ConsulInterface Class Referenceabstract

The Consul Administrator, who handles configuration & service discovery. More...

#include <consul_interface.h>

Inheritance diagram for AOSSL::ConsulInterface:
Inheritance graph
[legend]
Collaboration diagram for AOSSL::ConsulInterface:
Collaboration graph
[legend]

Public Member Functions

virtual void base64_decode_by_reference (std::string const &encoded_string, StringBuffer &ret_buffer)=0
 Convinience Method for base64 decoding. More...
 
virtual StringBufferbase64_decode_safe (std::string const &encoded_string)=0
 Convinience Method for base64 decoding. More...
 
virtual bool register_service (const ServiceInterface &s)=0
 Register the Service. More...
 
virtual bool deregister_service (const ServiceInterface &s)=0
 Deregister the Service. More...
 
virtual bool set_config_value (std::string key, std::string val)=0
 Set a configuration value. More...
 
virtual bool del_config_value (std::string key)=0
 Delete a configuration value.
 
virtual AOSSL::StringBufferservices ()=0
 Query the local agent for services registered. More...
 
virtual AOSSL::StringBufferagent_info ()=0
 Query the local agent for it's info.
 
virtual AOSSL::StringBufferhealthy_services ()=0
 Query for healthy services only.
 
virtual AOSSL::StringBufferdatacenters ()=0
 Query the catalog for datacenters.
 
virtual AOSSL::StringBuffernodes_dc (std::string data_center)=0
 Query the catalog for the nodes in a particular datacenter. More...
 
virtual AOSSL::StringBufferservices_dc (std::string data_center)=0
 Query the catalog for the services in a particular datacenter. More...
 
virtual AOSSL::StringBuffernodes_service (std::string service)=0
 Query the catalog for the nodes running a particular service. More...
 
virtual AOSSL::StringBufferservices_node (std::string node, std::string data_center)=0
 Query the catalog for the services provided by a particular node. More...
 
virtual void add_acl_token (std::string &token)=0
 Add an ACL Token to the Consul Admin.
 
- Public Member Functions inherited from AOSSL::KeyValueStoreInterface
virtual bool opt_exist (std::string key)=0
 Does a key exist?
 
virtual StringBufferget_opt (std::string key)=0
 Get an option by key.
 
virtual void get_opt (std::string key, StringBuffer &val)=0
 Get an option by key.
 
virtual void load_config ()=0
 Re-load configuration.
 

Detailed Description

The Consul Administrator, who handles configuration & service discovery.

This relies on the HTTP Administrator, and takes in a Service object in order to register. It's responses are JSON strings that are recieved from Consul. Note that the values returned from the Key-Value store will be stored in base64 format

Member Function Documentation

virtual void AOSSL::ConsulInterface::base64_decode_by_reference ( std::string const &  encoded_string,
StringBuffer ret_buffer 
)
pure virtual

Convinience Method for base64 decoding.

This is needed as all configuration values are returned from Consul in base64, and need to be decoded after the json is parsed.

Parameters
encoded_stringThe string to decode
ret_bufferA String buffer in which to populate the response

Implemented in AOSSL::ConsulAdmin.

virtual StringBuffer* AOSSL::ConsulInterface::base64_decode_safe ( std::string const &  encoded_string)
pure virtual

Convinience Method for base64 decoding.

This is needed as all configuration values are returned from Consul in base64, and need to be decoded after the json is parsed.

Parameters
encoded_stringThe string to decode

Implemented in AOSSL::ConsulAdmin.

virtual bool AOSSL::ConsulInterface::deregister_service ( const ServiceInterface s)
pure virtual

Deregister the Service.

Parameters
sThe Service Interface to send to the Consul Agent

Implemented in AOSSL::ConsulAdmin.

virtual AOSSL::StringBuffer* AOSSL::ConsulInterface::nodes_dc ( std::string  data_center)
pure virtual

Query the catalog for the nodes in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query

Implemented in AOSSL::ConsulAdmin.

virtual AOSSL::StringBuffer* AOSSL::ConsulInterface::nodes_service ( std::string  service)
pure virtual

Query the catalog for the nodes running a particular service.

Parameters
serviceThe string identifier for the service to query

Implemented in AOSSL::ConsulAdmin.

virtual bool AOSSL::ConsulInterface::register_service ( const ServiceInterface s)
pure virtual

Register the Service.

Parameters
sThe Service Interface to send to the Consul Agent

Implemented in AOSSL::ConsulAdmin.

virtual AOSSL::StringBuffer* AOSSL::ConsulInterface::services ( )
pure virtual

Query the local agent for services registered.

Query the local agent for services registered

Implemented in AOSSL::ConsulAdmin.

virtual AOSSL::StringBuffer* AOSSL::ConsulInterface::services_dc ( std::string  data_center)
pure virtual

Query the catalog for the services in a particular datacenter.

Parameters
data_centerThe string identifier for the data center to query

Implemented in AOSSL::ConsulAdmin.

virtual AOSSL::StringBuffer* AOSSL::ConsulInterface::services_node ( std::string  node,
std::string  data_center 
)
pure virtual

Query the catalog for the services provided by a particular node.

Parameters
nodeThe string identifier for the node to query
data_centerThe string id for the data center which holds the node

Implemented in AOSSL::ConsulAdmin.

virtual bool AOSSL::ConsulInterface::set_config_value ( std::string  key,
std::string  val 
)
pure virtual

Set a configuration value.

If the key does not exist, then this will add it. Otherwise, it will update the existing key.

Parameters
keyA string key that will be created/updated in the KV Store
valA string value that will be stored in the KV Store

Implemented in AOSSL::ConsulAdmin.


The documentation for this class was generated from the following file: