OpenSDN source code
|
#include <eql_if.h>
Classes | |
struct | EtcdAsyncCall |
struct | EtcdAsyncDeleteCall |
struct | EtcdAsyncGetCall |
struct | EtcdAsyncSetCall |
struct | EtcdAsyncWatchCall |
Public Types | |
typedef boost::function< void(const EtcdResponse &Resp)> | WatchCb |
Public Member Functions | |
EtcdIf (const std::vector< std::string > &etcd_hosts, const int port, bool useSsl) | |
virtual | ~EtcdIf () |
virtual bool | Connect () |
virtual EtcdResponse | Get (const std::string &key, const std::string &range_end, int limit) |
virtual void | Set (const std::string &key, const std::string &value) |
virtual void | Delete (const std::string &key, const std::string &range_end) |
virtual void | Watch (const std::string &key, WatchCb cb) |
virtual void | StopWatch () |
int | port () const |
std::vector< Endpoint > | endpoints () const |
std::vector< std::string > | hosts () const |
Private Attributes | |
std::vector< Endpoint > | endpoints_ |
std::vector< std::string > | hosts_ |
int | port_ |
bool | useSsl_ |
std::unique_ptr< KV::Stub > | kv_stub_ |
std::unique_ptr< Watch::Stub > | watch_stub_ |
std::unique_ptr< EtcdAsyncGetCall > | get_call_ |
std::unique_ptr< EtcdAsyncSetCall > | set_call_ |
std::unique_ptr < EtcdAsyncDeleteCall > | delete_call_ |
std::unique_ptr < EtcdAsyncWatchCall > | watch_call_ |
EtcdIf is the etcd client that is used to create and maintain connection to the etcd server. The methods of the client can be used to perform etcd operations. Control node is only interested in the reading data from or watching changes on a specific key or directory in etcd and hence only those operations are implemented here.
typedef boost::function<void (const EtcdResponse& Resp)> etcd::etcdql::EtcdIf::WatchCb |
EtcdIf::EtcdIf | ( | const std::vector< std::string > & | etcd_hosts, |
const int | port, | ||
bool | useSsl | ||
) |
|
virtual |
|
virtual |
ONLY FOR TEST PURPOSES. Sends a DELETE request to the etcd server to delete a key or set of keys
key | The key or directory to be deleted |
range_end | The key range to fetch |
Set up DELETE request.
Create a SET stream reader and invoke async set.
Parse the DELETE response.
Definition at line 243 of file eql_if.cc.
|
inline |
|
virtual |
Sends a GET request to the etcd server to get data for key or directory rooted at key.
key | The key or directory to be read |
range_end | The key range to fetch |
limit | The number of keys to read |
Set up GET request.
Create a GET stream reader and invoke async read.
Parse the GET response.
Definition at line 82 of file eql_if.cc.
|
inline |
|
virtual |
ONLY FOR TEST PURPOSES. Sends a SET request to the etcd server to create or update a key-value pair.
key | The key to be created/updated |
value | The value corresponding to the key. |
Set up SET request.
Create a SET stream reader and invoke async set.
Parse the SET response.
Definition at line 190 of file eql_if.cc.
|
virtual |
|
virtual |
Watches for changes to a key or directory rooted at key. And invokes callback when an update is received.
key | The key or directory to be watched |
callback | The callback to be invoked when there is an update |
Create and start the Async reader-writer stream.
When we start a stream, that is creating the reader/writer object with a tag, we need to use CompletionQueue::Next to wait for the tag to come back before calling Write. Write the watch request to the stream and set up the first read with the tag as the call object.
Definition at line 304 of file eql_if.cc.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |