13 #include "../common/sandesh_uve_types.h"
27 const std::map<std::string, ds_conf_elem> &dsmap) {
31 for (map<string, ds_conf_elem>::const_iterator cit = dsmap.begin();
32 cit != dsmap.end(); cit++) {
33 uve_global_map::iterator it =
map_->find(cit->first);
34 if (it==
map_->end()) {
37 if (!(it->second.second)->InitDerivedStats(cit->second))
47 for (uve_global_map::iterator it =
map_->begin();
48 it !=
map_->end(); it++) {
49 uint32_t subcount = it->second.second->ClearUVEs(proxy, partition);
51 SANDESH_LOG(INFO, __func__ <<
" for " << it->first <<
" partition " <<
52 partition <<
" proxy " << proxy <<
" cleared " <<
62 static uint64_t periodic_count = 0;
63 if (periodic) periodic_count++;
64 for (uve_global_map::iterator it =
map_->begin();
65 it !=
map_->end(); it++) {
66 map<string,uint32_t>::const_iterator iit = inpMap.find(it->first);
69 uint64_t target_count =
71 if (target_count == 0)
continue;
72 if ((periodic_count % target_count) != 0)
continue;
73 cycle = (uint32_t) (periodic_count / target_count);
74 assert(inpMap.size() == 0);
77 if (iit == inpMap.end()) {
78 uint count = it->second.second->SyncUVE(
"", stype, 0, cycle,
"");
79 SANDESH_LOG(INFO, __func__ <<
" for " << it->first <<
":" << stype <<
80 " period " << it->second.first <<
" cycle " << cycle <<
81 " without seqno , total = " << count);
83 uint count = it->second.second->SyncUVE(
"", stype, iit->second, cycle,
"");
84 SANDESH_LOG(INFO, __func__ <<
" for " << it->first <<
":" << stype <<
85 " period " << it->second.first <<
" cycle " << cycle <<
86 " with seqno " << iit->second <<
87 ", total = " << count);
94 std::string tname, std::string table, std::string key) {
96 um.second->SendUVE(table, key,
"");
100 SandeshUVETypesReq::HandleRequest()
const {
101 std::vector<SandeshUVETypeInfo> stv;
103 SandeshUVETypeMaps::uve_global_map::const_iterator it =
106 SandeshUVETypeInfo sti;
107 sti.set_type_name(it->first);
108 sti.set_seq_num(it->second.second->TypeSeq());
109 sti.set_period(it->second.first);
110 sti.set_dsconf(it->second.second->GetDSConf());
111 sti.set_timeout(it->second.second->GetTimeout());
114 SandeshUVETypesResp *sur =
new SandeshUVETypesResp();
115 sur->set_type_info(stv);
116 sur->set_context(context());
120 SandeshUVEDSConfReq::HandleRequest()
const {
124 map<string,string> dsconf;
125 bool success =
false;
127 dsconf.insert(std::make_pair(get_dsattr(), get_dsconf()));
128 success = um.second->InitDerivedStats(dsconf);
130 SandeshUVEDSConfResp *sur =
new SandeshUVEDSConfResp();
131 sur->set_success(success);
132 if (success) sur->set_dsconf(um.second->GetDSConf());
133 sur->set_context(context());
138 SandeshUVECacheReq::HandleRequest()
const {
139 uint32_t returned = 0;
145 returned = um.second->SendUVE(
"", get_key(), context());
151 SandeshUVECacheResp *sur =
new SandeshUVECacheResp();
152 sur->set_returned(returned);
153 if (um.second) sur->set_period(um.first);
154 sur->set_context(context());
static const int kTickInterval
static uve_global_map::const_iterator Begin()
static bool InitDerivedStats(const std::map< std::string, ds_conf_elem > &)
static uve_global_map * map_
std::pair< int, SandeshUVEPerTypeMap * > uve_global_elem
std::map< std::string, uve_global_elem > uve_global_map
static const uve_global_elem TypeMap(const std::string &s)
static uve_global_map::const_iterator End()
static void SyncAllMaps(const std::map< std::string, uint32_t > &, bool periodic=false)
static void SyncIntrospect(std::string tname, std::string table, std::string key)
static uint32_t Clear(const std::string &proxy, int partition)
#define SANDESH_LOG(_Level, _Msg)