blob: 18ca9c171a41562d9b4ff57fd2962f7e5d4fb6da [file] [log] [blame]
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +02001#include "report.hpp"
2
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +01003#include "messages/collect_trigger_id.hpp"
4#include "messages/trigger_presence_changed_ind.hpp"
5#include "messages/update_report_ind.hpp"
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +02006#include "report_manager.hpp"
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +01007#include "utils/clock.hpp"
Krzysztof Grobelny51497a02021-11-09 14:56:22 +01008#include "utils/contains.hpp"
Wludzik, Jozefe2362792020-10-27 17:23:55 +01009#include "utils/transform.hpp"
10
11#include <phosphor-logging/log.hpp>
Wludzik, Jozefb1ff1f62020-10-23 13:20:52 +020012#include <sdbusplus/vtable.hpp>
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020013
Szymon Dompke3eb56862021-09-20 15:32:04 +020014#include <limits>
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020015#include <numeric>
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020016
17Report::Report(boost::asio::io_context& ioc,
18 const std::shared_ptr<sdbusplus::asio::object_server>& objServer,
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010019 const std::string& reportId, const std::string& reportName,
Szymon Dompke3eb56862021-09-20 15:32:04 +020020 const ReportingType reportingTypeIn,
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010021 std::vector<ReportAction> reportActionsIn,
Szymon Dompke3eb56862021-09-20 15:32:04 +020022 const Milliseconds intervalIn, const uint64_t appendLimitIn,
23 const ReportUpdates reportUpdatesIn,
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020024 interfaces::ReportManager& reportManager,
Wludzik, Jozefe2362792020-10-27 17:23:55 +010025 interfaces::JsonStorage& reportStorageIn,
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020026 std::vector<std::shared_ptr<interfaces::Metric>> metricsIn,
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010027 const bool enabledIn, std::unique_ptr<interfaces::Clock> clock) :
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010028 id(reportId),
29 name(reportName), reportingType(reportingTypeIn), interval(intervalIn),
30 reportActions(std::move(reportActionsIn)),
Szymon Dompke3eb56862021-09-20 15:32:04 +020031 sensorCount(getSensorCount(metricsIn)),
32 appendLimit(deduceAppendLimit(appendLimitIn)),
33 reportUpdates(reportUpdatesIn),
34 readingsBuffer(deduceBufferSize(reportUpdates, reportingType)),
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000035 objServer(objServer), metrics(std::move(metricsIn)), timer(ioc),
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010036 triggerIds(collectTriggerIds(ioc)), reportStorage(reportStorageIn),
37 enabled(enabledIn), clock(std::move(clock)), messanger(ioc)
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020038{
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000039 readingParameters =
40 toReadingParameters(utils::transform(metrics, [](const auto& metric) {
41 return metric->dumpConfiguration();
42 }));
43
44 readingParametersPastVersion =
45 utils::transform(readingParameters, [](const auto& item) {
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010046 const auto& [sensorData, operationType, id, collectionTimeScope,
47 collectionDuration] = item;
48
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000049 return ReadingParametersPastVersion::value_type(
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010050 std::get<0>(sensorData.front()), operationType, id,
51 std::get<1>(sensorData.front()));
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000052 });
53
Wludzik, Jozefe2362792020-10-27 17:23:55 +010054 deleteIface = objServer->add_unique_interface(
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010055 getPath(), deleteIfaceName,
56 [this, &ioc, &reportManager](auto& dbusIface) {
Wludzik, Jozefe2362792020-10-27 17:23:55 +010057 dbusIface.register_method("Delete", [this, &ioc, &reportManager] {
58 if (persistency)
59 {
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010060 reportStorage.remove(fileName());
Wludzik, Jozefe2362792020-10-27 17:23:55 +010061 }
62 boost::asio::post(ioc, [this, &reportManager] {
63 reportManager.removeReport(this);
64 });
65 });
66 });
67
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +000068 persistency = storeConfiguration();
69 reportIface = makeReportInterface();
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020070
Krzysztof Grobelny51497a02021-11-09 14:56:22 +010071 if (reportingType == ReportingType::periodic)
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020072 {
73 scheduleTimer(interval);
74 }
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000075
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020076 if (enabled)
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000077 {
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +020078 for (auto& metric : this->metrics)
79 {
80 metric->initialize();
81 }
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +000082 }
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010083
84 messanger.on_receive<messages::TriggerPresenceChangedInd>(
85 [this](const auto& msg) {
86 const auto oldSize = triggerIds.size();
87
88 if (msg.presence == messages::Presence::Exist)
89 {
90 if (utils::contains(msg.reportIds, id))
91 {
92 triggerIds.insert(msg.triggerId);
93 }
94 else if (!utils::contains(msg.reportIds, id))
95 {
96 triggerIds.erase(msg.triggerId);
97 }
98 }
99 else if (msg.presence == messages::Presence::Removed)
100 {
101 triggerIds.erase(msg.triggerId);
102 }
103
104 if (triggerIds.size() != oldSize)
105 {
106 reportIface->signal_property("TriggerIds");
107 }
108 });
109
110 messanger.on_receive<messages::UpdateReportInd>([this](const auto& msg) {
111 if (utils::contains(msg.reportIds, id))
112 {
113 updateReadings();
114 }
115 });
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200116}
117
Szymon Dompke3eb56862021-09-20 15:32:04 +0200118uint64_t Report::getSensorCount(
119 std::vector<std::shared_ptr<interfaces::Metric>>& metrics)
120{
121 uint64_t sensorCount = 0;
122 for (auto& metric : metrics)
123 {
124 sensorCount += metric->sensorCount();
125 }
126 return sensorCount;
127}
128
Krzysztof Grobelnye6c417c2022-02-02 17:25:53 +0100129std::optional<uint64_t>
130 Report::deduceAppendLimit(const uint64_t appendLimitIn) const
Szymon Dompke3eb56862021-09-20 15:32:04 +0200131{
132 if (appendLimitIn == std::numeric_limits<uint64_t>::max())
133 {
Krzysztof Grobelnye6c417c2022-02-02 17:25:53 +0100134 return std::nullopt;
Szymon Dompke3eb56862021-09-20 15:32:04 +0200135 }
136 else
137 {
138 return appendLimitIn;
139 }
140}
141
142uint64_t Report::deduceBufferSize(const ReportUpdates reportUpdatesIn,
143 const ReportingType reportingTypeIn) const
144{
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100145 if (reportUpdatesIn == ReportUpdates::overwrite ||
146 reportingTypeIn == ReportingType::onRequest)
Szymon Dompke3eb56862021-09-20 15:32:04 +0200147 {
148 return sensorCount;
149 }
150 else
151 {
Krzysztof Grobelnye6c417c2022-02-02 17:25:53 +0100152 return appendLimit.value_or(sensorCount);
Szymon Dompke3eb56862021-09-20 15:32:04 +0200153 }
154}
155
156void Report::setReportUpdates(const ReportUpdates newReportUpdates)
157{
158 if (reportUpdates != newReportUpdates)
159 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100160 if (reportingType != ReportingType::onRequest &&
161 (reportUpdates == ReportUpdates::overwrite ||
162 newReportUpdates == ReportUpdates::overwrite))
Szymon Dompke3eb56862021-09-20 15:32:04 +0200163 {
164 readingsBuffer.clearAndResize(
165 deduceBufferSize(newReportUpdates, reportingType));
166 }
167 reportUpdates = newReportUpdates;
168 }
169}
170
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000171std::unique_ptr<sdbusplus::asio::dbus_interface> Report::makeReportInterface()
172{
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100173 auto dbusIface =
174 objServer->add_unique_interface(getPath(), reportIfaceName);
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000175 dbusIface->register_property_rw(
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200176 "Enabled", enabled, sdbusplus::vtable::property_::emits_change,
177 [this](bool newVal, const auto&) {
178 if (newVal != enabled)
179 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100180 if (true == newVal && ReportingType::periodic == reportingType)
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200181 {
182 scheduleTimer(interval);
183 }
184 if (newVal)
185 {
186 for (auto& metric : metrics)
187 {
188 metric->initialize();
189 }
190 }
191 else
192 {
193 for (auto& metric : metrics)
194 {
195 metric->deinitialize();
196 }
197 }
198
199 enabled = newVal;
200 persistency = storeConfiguration();
201 }
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100202 return 1;
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200203 },
204 [this](const auto&) { return enabled; });
205 dbusIface->register_property_rw(
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000206 "Interval", interval.count(),
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000207 sdbusplus::vtable::property_::emits_change,
208 [this](uint64_t newVal, auto&) {
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200209 if (Milliseconds newValT{newVal};
210 newValT >= ReportManager::minInterval)
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000211 {
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200212 if (newValT != interval)
213 {
214 interval = newValT;
215 persistency = storeConfiguration();
216 }
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100217 return 1;
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000218 }
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100219 throw sdbusplus::exception::SdBusError(
220 static_cast<int>(std::errc::invalid_argument),
221 "Invalid interval");
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000222 },
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000223 [this](const auto&) { return interval.count(); });
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000224 dbusIface->register_property_rw(
225 "Persistency", persistency, sdbusplus::vtable::property_::emits_change,
226 [this](bool newVal, const auto&) {
227 if (newVal == persistency)
228 {
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100229 return 1;
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000230 }
231 if (newVal)
232 {
233 persistency = storeConfiguration();
234 }
235 else
236 {
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100237 reportStorage.remove(fileName());
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000238 persistency = false;
239 }
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100240 return 1;
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000241 },
242 [this](const auto&) { return persistency; });
243
244 auto readingsFlag = sdbusplus::vtable::property_::none;
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100245 if (utils::contains(reportActions, ReportAction::emitsReadingsUpdate))
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000246 {
247 readingsFlag = sdbusplus::vtable::property_::emits_change;
248 }
249 dbusIface->register_property_r("Readings", readings, readingsFlag,
250 [this](const auto&) { return readings; });
251 dbusIface->register_property_r(
Szymon Dompke3eb56862021-09-20 15:32:04 +0200252 "ReportingType", std::string(), sdbusplus::vtable::property_::const_,
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100253 [this](const auto&) { return utils::enumToString(reportingType); });
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000254 dbusIface->register_property_r(
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000255 "ReadingParameters", readingParametersPastVersion,
256 sdbusplus::vtable::property_::const_,
257 [this](const auto&) { return readingParametersPastVersion; });
258 dbusIface->register_property_r(
259 "ReadingParametersFutureVersion", readingParameters,
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000260 sdbusplus::vtable::property_::const_,
261 [this](const auto&) { return readingParameters; });
262 dbusIface->register_property_r(
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100263 "EmitsReadingsUpdate", bool{}, sdbusplus::vtable::property_::const_,
264 [this](const auto&) {
265 return utils::contains(reportActions,
266 ReportAction::emitsReadingsUpdate);
267 });
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100268 dbusIface->register_property_r("Name", std::string{},
269 sdbusplus::vtable::property_::const_,
270 [this](const auto&) { return name; });
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000271 dbusIface->register_property_r(
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100272 "LogToMetricReportsCollection", bool{},
273 sdbusplus::vtable::property_::const_, [this](const auto&) {
274 return utils::contains(reportActions,
275 ReportAction::logToMetricReportsCollection);
276 });
277 dbusIface->register_property_r(
278 "ReportActions", std::vector<std::string>{},
279 sdbusplus::vtable::property_::const_, [this](const auto&) {
280 return utils::transform(reportActions, [](const auto reportAction) {
281 return utils::enumToString(reportAction);
282 });
283 });
Krzysztof Grobelnye6c417c2022-02-02 17:25:53 +0100284 dbusIface->register_property_r(
285 "AppendLimit", appendLimit.value_or(sensorCount),
286 sdbusplus::vtable::property_::emits_change,
287 [this](const auto&) { return appendLimit.value_or(sensorCount); });
Szymon Dompke3eb56862021-09-20 15:32:04 +0200288 dbusIface->register_property_rw(
289 "ReportUpdates", std::string(),
290 sdbusplus::vtable::property_::emits_change,
291 [this](auto newVal, auto& oldVal) {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100292 setReportUpdates(utils::toReportUpdates(newVal));
Szymon Dompke3eb56862021-09-20 15:32:04 +0200293 oldVal = newVal;
Szymon Dompke3e2cc9d2021-12-14 12:00:52 +0100294 return 1;
Szymon Dompke3eb56862021-09-20 15:32:04 +0200295 },
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100296 [this](const auto&) { return utils::enumToString(reportUpdates); });
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +0100297 dbusIface->register_property_r(
298 "TriggerIds", std::vector<std::string>{},
299 sdbusplus::vtable::property_::emits_change, [this](const auto&) {
300 return std::vector<std::string>(triggerIds.begin(),
301 triggerIds.end());
302 });
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000303 dbusIface->register_method("Update", [this] {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100304 if (reportingType == ReportingType::onRequest)
Krzysztof Grobelny85db8bd2021-05-28 12:13:23 +0000305 {
306 updateReadings();
307 }
308 });
309 constexpr bool skipPropertiesChangedSignal = true;
310 dbusIface->initialize(skipPropertiesChangedSignal);
311 return dbusIface;
312}
313
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200314void Report::timerProc(boost::system::error_code ec, Report& self)
315{
316 if (ec)
317 {
318 return;
319 }
320
321 self.updateReadings();
322 self.scheduleTimer(self.interval);
323}
324
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000325void Report::scheduleTimer(Milliseconds timerInterval)
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200326{
327 timer.expires_after(timerInterval);
328 timer.async_wait(
329 [this](boost::system::error_code ec) { timerProc(ec, *this); });
330}
331
332void Report::updateReadings()
333{
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200334 if (!enabled)
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000335 {
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200336 return;
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000337 }
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200338
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100339 if (reportUpdates == ReportUpdates::overwrite ||
340 reportingType == ReportingType::onRequest)
Szymon Dompke3eb56862021-09-20 15:32:04 +0200341 {
342 readingsBuffer.clear();
343 }
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +0000344
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200345 for (const auto& metric : metrics)
346 {
Szymon Dompke3eb56862021-09-20 15:32:04 +0200347 for (const auto& [id, metadata, value, timestamp] :
348 metric->getReadings())
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200349 {
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100350 if (reportUpdates == ReportUpdates::appendStopsWhenFull &&
Szymon Dompke3eb56862021-09-20 15:32:04 +0200351 readingsBuffer.isFull())
352 {
353 enabled = false;
Krzysztof Grobelnyfbeb5bf2022-01-03 09:41:29 +0100354 for (auto& m : metrics)
Szymon Dompke3eb56862021-09-20 15:32:04 +0200355 {
Krzysztof Grobelnyfbeb5bf2022-01-03 09:41:29 +0100356 m->deinitialize();
Szymon Dompke3eb56862021-09-20 15:32:04 +0200357 }
358 break;
359 }
360 readingsBuffer.emplace(id, metadata, value, timestamp);
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200361 }
362 }
Szymon Dompke3eb56862021-09-20 15:32:04 +0200363
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100364 readings = {
Krzysztof Grobelny51f0fd52021-12-28 16:32:08 +0100365 std::chrono::duration_cast<Milliseconds>(clock->systemTimestamp())
366 .count(),
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100367 std::vector<ReadingData>(readingsBuffer.begin(), readingsBuffer.end())};
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100368
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +0200369 reportIface->signal_property("Readings");
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +0200370}
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100371
372bool Report::storeConfiguration() const
373{
374 try
375 {
376 nlohmann::json data;
377
Lukasz Kazmierczak7e098e92021-09-16 15:59:56 +0200378 data["Enabled"] = enabled;
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100379 data["Version"] = reportVersion;
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100380 data["Id"] = id;
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100381 data["Name"] = name;
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100382 data["ReportingType"] = utils::toUnderlying(reportingType);
383 data["ReportActions"] =
384 utils::transform(reportActions, [](const auto reportAction) {
385 return utils::toUnderlying(reportAction);
386 });
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100387 data["Interval"] = interval.count();
Krzysztof Grobelnye6c417c2022-02-02 17:25:53 +0100388 data["AppendLimit"] =
389 appendLimit.value_or(std::numeric_limits<uint64_t>::max());
Krzysztof Grobelny51497a02021-11-09 14:56:22 +0100390 data["ReportUpdates"] = utils::toUnderlying(reportUpdates);
Krzysztof Grobelnyd2238192020-12-02 09:27:28 +0000391 data["ReadingParameters"] =
392 utils::transform(metrics, [](const auto& metric) {
393 return metric->dumpConfiguration();
394 });
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100395
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100396 reportStorage.store(fileName(), data);
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100397 }
398 catch (const std::exception& e)
399 {
400 phosphor::logging::log<phosphor::logging::level::ERR>(
401 "Failed to store a report in storage",
Wludzik, Jozef982c5b52021-01-02 12:05:21 +0100402 phosphor::logging::entry("EXCEPTION_MSG=%s", e.what()));
Wludzik, Jozefe2362792020-10-27 17:23:55 +0100403 return false;
404 }
405
406 return true;
407}
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +0100408
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +0100409interfaces::JsonStorage::FilePath Report::fileName() const
410{
411 return interfaces::JsonStorage::FilePath{
412 std::to_string(std::hash<std::string>{}(id))};
413}
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +0100414
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +0100415std::unordered_set<std::string>
416 Report::collectTriggerIds(boost::asio::io_context& ioc) const
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +0100417{
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +0100418 utils::Messanger tmp(ioc);
419
420 auto result = std::unordered_set<std::string>();
421
422 tmp.on_receive<messages::CollectTriggerIdResp>(
423 [&result](const auto& msg) { result.insert(msg.triggerId); });
424
425 tmp.send(messages::CollectTriggerIdReq{id});
426
427 return result;
Szymon Dompkeb4ef22e2022-02-07 15:15:12 +0100428}