1 #ifndef _ASSET_TRACKING_H 2 #define _ASSET_TRACKING_H 16 #include <unordered_set> 17 #include <management_client.h> 21 #include <condition_variable> 22 #include <storage_client.h> 24 #define MIN_ASSET_TRACKER_UPDATE 500 // The minimum interval for asset tracker updates 36 std::string &instanceName) = 0;
37 virtual std::string assetToString() = 0;
50 std::string assetToString()
53 o <<
"service:" << m_serviceName <<
54 ", plugin:" << m_pluginName <<
55 ", asset:" << m_assetName <<
56 ", event:" << m_eventName <<
57 ", deprecated:" << m_deprecated;
63 return ( x.m_serviceName==m_serviceName &&
64 x.m_pluginName==m_pluginName &&
65 x.m_assetName==m_assetName &&
66 x.m_eventName==m_eventName);
70 const std::string& plugin,
71 const std::string& asset,
72 const std::string& event,
73 const bool& deprecated =
false) :
74 m_serviceName(service),
78 m_deprecated(deprecated) {}
80 std::string &getAssetName() {
return m_assetName; };
81 std::string getPluginName() {
return m_pluginName;}
82 std::string getEventName() {
return m_eventName;}
83 std::string getServiceName() {
return m_serviceName;}
84 bool isDeprecated() {
return m_deprecated; };
85 void unDeprecate() { m_deprecated =
false; };
90 std::string &instanceName);
93 std::string m_serviceName;
94 std::string m_pluginName;
95 std::string m_assetName;
96 std::string m_eventName;
115 return (std::hash<std::string>()(t.m_serviceName + t.m_pluginName + t.m_assetName + t.m_eventName));
124 return (std::hash<std::string>()(t->m_serviceName + t->m_pluginName + t->m_assetName + t->m_eventName));
132 const std::string& plugin,
133 const std::string& asset,
134 const std::string& event,
135 const bool& deprecated =
false,
136 const std::string& datapoints =
"",
137 unsigned int c = 0) : m_datapoints(datapoints),
139 m_serviceName(service),
140 m_pluginName(plugin),
143 m_deprecated(deprecated)
148 return ( x.m_serviceName==m_serviceName &&
149 x.m_pluginName==m_pluginName &&
150 x.m_assetName==m_assetName &&
151 x.m_eventName==m_eventName);
153 std::string assetToString()
155 std::ostringstream o;
156 o <<
"service:" << m_serviceName <<
157 ", plugin:" << m_pluginName <<
158 ", asset:" << m_assetName <<
159 ", event:" << m_eventName <<
160 ", deprecated:" << m_deprecated <<
161 ", m_datapoints:" << m_datapoints <<
162 ", m_maxCount:" << m_maxCount;
166 bool isDeprecated() {
return m_deprecated; };
168 unsigned int getMaxCount() {
return m_maxCount; }
169 std::string getDataPoints() {
return m_datapoints; }
170 void unDeprecate() { m_deprecated =
false; };
171 void setDeprecate() { m_deprecated =
true; };
176 std::string &instanceName);
179 std::string m_datapoints;
180 unsigned int m_maxCount;
181 std::string m_serviceName;
182 std::string m_pluginName;
183 std::string m_assetName;
184 std::string m_eventName;
203 return (std::hash<std::string>()(t.m_serviceName +
215 return (std::hash<std::string>()(t->m_serviceName +
224 std::set<std::string>,
228 std::set<std::string>,
245 void populateAssetTrackingCache(std::string plugin, std::string event);
246 void populateStorageAssetTrackingCache();
251 void addAssetTrackingTuple(std::string plugin, std::string asset, std::string event);
253 std::set<std::string>& dpSet,
254 bool addObj =
false);
258 getIngestService(
const std::string& asset)
260 return getService(
"Ingest", asset);
263 getEgressService(
const std::string& asset)
265 return getService(
"Egress", asset);
271 std::set<std::string>
273 bool tune(
unsigned long updateInterval);
277 getService(
const std::string& event,
const std::string& asset);
280 std::set<std::string>
281 getDataPointsSet(std::string strDatapoints);
282 bool getFledgeConfigInfo();
287 std::string m_service;
289 assetTrackerTuplesCache;
290 std::queue<TrackingTuple *> m_pending;
291 std::thread *m_thread;
293 std::condition_variable m_cv;
295 std::string m_fledgeName;
297 StorageAssetCacheMap storageAssetTrackerTuplesCache;
298 unsigned int m_updateInterval;
310 void remove(
const std::string& name);
313 std::map<std::string, AssetTrackingTuple *>
A class to hold a set of asset tracking tuples that allows lookup by name.
Definition: asset_tracking.h:305
Definition: asset_tracking.h:102
The AssetTrackingTuple class is used to represent an asset tracking tuple.
Definition: asset_tracking.h:47
Tracking abstract base class to be passed in the process data queue.
Definition: asset_tracking.h:29
Definition: asset_tracking.h:190
Definition: asset_tracking.h:108
The management client class used by services and tasks to communicate with the management API of the ...
Definition: management_client.h:43
Client for accessing the storage service.
Definition: storage_client.h:43
The AssetTracker class provides the asset tracking functionality.
Definition: asset_tracking.h:239
Definition: asset_tracking.h:211
Definition: asset_tracking.h:129