OpenSDN source code
|
#include <config_etcd_client.h>
Classes | |
class | EtcdWatcher |
Public Types | |
typedef vector < ConfigEtcdPartition * > | PartitionList |
![]() | |
typedef std::pair< std::string, std::string > | ObjTypeFQNPair |
Public Member Functions | |
ConfigEtcdClient (ConfigClientManager *mgr, EventManager *evm, const ConfigClientOptions &options, int num_workers) | |
virtual | ~ConfigEtcdClient () |
virtual void | InitDatabase () |
void | BulkSyncDone () |
void | EnqueueUUIDRequest (string oper, string obj_type, string uuid_str) |
ConfigEtcdPartition * | GetPartition (const string &uuid) |
const ConfigEtcdPartition * | GetPartition (const string &uuid) const |
const ConfigEtcdPartition * | GetPartition (int worker_id) const |
void | StartWatcher () |
virtual bool | UUIDToObjCacheShow (const string &search_string, int inst_num, const string &last_uuid, uint32_t num_entries, vector< ConfigDBUUIDCacheEntry > *entries) const |
virtual bool | IsListOrMapPropEmpty (const string &uuid_key, const string &lookup_key) |
bool | IsTaskTriggered () const |
virtual void | ProcessResponse (EtcdResponse resp) |
![]() | |
ConfigDbClient (ConfigClientManager *mgr, EventManager *evm, const ConfigClientOptions &options) | |
virtual | ~ConfigDbClient () |
const std::string & | config_db_user () const |
const std::string & | config_db_password () const |
const std::vector< std::string > & | config_db_ips () const |
int | GetFirstConfigDbPort () const |
virtual void | EnqueueUUIDRequest (std::string uuid_str, std::string obj_type, std::string oper)=0 |
virtual bool | UUIDToObjCacheShow (const std::string &search_string, int inst_num, const std::string &last_uuid, uint32_t num_entries, std::vector< ConfigDBUUIDCacheEntry > *entries) const =0 |
virtual bool | IsListOrMapPropEmpty (const std::string &uuid_key, const std::string &lookup_key)=0 |
virtual void | AddFQNameCache (const std::string &uuid, const std::string &obj_type, const std::string &fq_name) |
virtual std::string | FindFQName (const std::string &uuid) const |
virtual void | InvalidateFQNameCache (const std::string &uuid) |
virtual void | PurgeFQNameCache (const std::string &uuid) |
virtual void | ClearFQNameCache () |
ObjTypeFQNPair | UUIDToFQName (const std::string &uuid_str, bool deleted_ok=true) const |
virtual bool | UUIDToFQNameShow (const std::string &search_string, const std::string &last_uuid, uint32_t num_entries, std::vector< ConfigDBFQNameCacheEntry > *entries) const |
virtual std::string | uuid_str (const std::string &uuid) |
virtual std::string | GetUUID (const std::string &key) const |
virtual void | InitConnectionInfo () |
virtual void | UpdateConnectionInfo (bool success, bool force) |
virtual void | GetConnectionInfo (ConfigDBConnInfo &status) const |
ConfigClientManager * | mgr () |
const ConfigClientManager * | mgr () const |
Static Public Member Functions | |
static void | set_watch_disable (bool disable) |
Protected Types | |
typedef pair< string, string > | UUIDValueType |
typedef list< UUIDValueType > | UUIDValueList |
![]() | |
typedef std::map< std::string, FQNameCacheType > | FQNameCacheMap |
Protected Member Functions | |
virtual bool | BulkDataSync () |
void | EnqueueDBSyncRequest (const UUIDValueList &uuid_list) |
virtual int | HashUUID (const std::string &uuid_str) const |
int | num_workers () const |
PartitionList & | partitions () |
virtual void | PostShutdown () |
![]() | |
virtual void | FillFQNameCacheInfo (const std::string &uuid, FQNameCacheMap::const_iterator it, ConfigDBFQNameCacheEntry *entry) const |
virtual const int | GetMaxRequestsToYield () const |
virtual const uint64_t | GetInitRetryTimeUSec () const |
virtual uint32_t | GetNumReadRequestToBunch () const |
EventManager * | event_manager () |
Private Member Functions | |
bool | InitRetry () |
bool | UUIDReader () |
void | HandleEtcdConnectionStatus (bool success, bool force_update=false) |
Private Attributes | |
boost::scoped_ptr< EtcdIf > | eqlif_ |
int | num_workers_ |
PartitionList | partitions_ |
boost::scoped_ptr< TaskTrigger > | uuid_reader_ |
tbb::atomic< long > | bulk_sync_status_ |
Static Private Attributes | |
static bool | disable_watch_ |
Friends | |
class | ConfigEtcdPartition |
Additional Inherited Members | |
![]() | |
static const uint64_t | kInitRetryTimeUSec = 5000000 |
static const int | kMaxRequestsToYield = 512 |
static const int | kNumEntriesToRead = 4096 |
Definition at line 183 of file config_etcd_client.h.
typedef vector<ConfigEtcdPartition *> ConfigEtcdClient::PartitionList |
Definition at line 185 of file config_etcd_client.h.
|
protected |
Definition at line 222 of file config_etcd_client.h.
|
protected |
Definition at line 221 of file config_etcd_client.h.
ConfigEtcdClient::ConfigEtcdClient | ( | ConfigClientManager * | mgr, |
EventManager * | evm, | ||
const ConfigClientOptions & | options, | ||
int | num_workers | ||
) |
|
virtual |
|
protectedvirtual |
Definition at line 245 of file config_etcd_client.cc.
void ConfigEtcdClient::BulkSyncDone | ( | ) |
|
protected |
void ConfigEtcdClient::EnqueueUUIDRequest | ( | string | oper, |
string | obj_type, | ||
string | uuid_str | ||
) |
uuid contains the entire config path For instance /contrail/virtual_network/<uuid> We form the request with the entire path so that testing code can utilize it to form various requests for the same uuid. However, when the request is processed later by the appropriate Partition, the path will be trimmed and only the uuid string will be used. Same is the case for the FQName cache. It will use the trimmed uuid as the key since it is invoked from the Partitions later.
Definition at line 296 of file config_etcd_client.cc.
ConfigEtcdPartition * ConfigEtcdClient::GetPartition | ( | const string & | uuid | ) |
const ConfigEtcdPartition * ConfigEtcdClient::GetPartition | ( | const string & | uuid | ) | const |
const ConfigEtcdPartition * ConfigEtcdClient::GetPartition | ( | int | worker_id | ) | const |
Definition at line 286 of file config_etcd_client.cc.
|
private |
|
protectedvirtual |
Definition at line 291 of file config_etcd_client.cc.
|
virtual |
Implements ConfigDbClient.
Definition at line 199 of file config_etcd_client.cc.
|
private |
|
virtual |
|
virtual |
Walk the partitions and check if ConfigReader task has been triggered in any of them. If so, return true.
Reimplemented from ConfigDbClient.
Definition at line 504 of file config_etcd_client.cc.
|
inlineprotected |
Definition at line 228 of file config_etcd_client.h.
|
inlineprotected |
Definition at line 229 of file config_etcd_client.h.
|
protectedvirtual |
Implements ConfigDbClient.
Definition at line 266 of file config_etcd_client.cc.
|
virtual |
If reinit is triggerred, don't consume the message. Also, stop etcd watch.
To stqrt consuming the message, we should have finished bulk sync in case we started it.
Check for errors and enqueue UUID update/delete request. Also update FQName cache.
Definition at line 164 of file config_etcd_client.cc.
|
inlinestatic |
Definition at line 217 of file config_etcd_client.h.
|
virtual |
If reinit is triggerred, Don't start the ETCD watcher.
Reimplemented from ConfigDbClient.
Definition at line 112 of file config_etcd_client.cc.
|
private |
Ensure that UUIDReader task aborts on reinit trigger.
Get number of UUIDs to read at a time
Read num_entries UUIDs at a time
Process read response
Got UUID data for given ObjType
Parse the json string to get uuid and value
Process the UUID response in parallel by assigning the UUIDs to partitions.
Get the next key to read for the current ObjType
If we read less than what we sought, it means there are no more entries for current obj-type. We move to next obj-type.
ObjType not found. Continue reading next ObjType
RPC failure. Connection down. Retry after a while
Definition at line 386 of file config_etcd_client.cc.
|
virtual |
|
friend |
Definition at line 233 of file config_etcd_client.h.
|
private |
Definition at line 250 of file config_etcd_client.h.
|
staticprivate |
Definition at line 244 of file config_etcd_client.h.
|
private |
Definition at line 246 of file config_etcd_client.h.
|
private |
Definition at line 247 of file config_etcd_client.h.
|
private |
Definition at line 248 of file config_etcd_client.h.
|
private |
Definition at line 249 of file config_etcd_client.h.