-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After implementing alarm-history we also must implement actions for compressing the status changes history. Those two actions delete all status entries except the latest ones. [1] We can reuse a part of already written Filter for purging alarms. There is similar logic so let's subclass these two filters from the same class implementing the filtering algorithm. The compress action can filter according to the alarm resource. However, in case we filter regular alarms, then it is more complicated (see [2], this has to wait until we support regular expressions in libyang-cpp). [1] https://datatracker.ietf.org/doc/rfc8632/ [2] #2 Change-Id: Iddcd94976f63f22a7a141faee674dd003424c5f5
- Loading branch information
Showing
11 changed files
with
361 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2022 CESNET, https://photonics.cesnet.cz/ | ||
* | ||
* Written by Tomáš Pecka <[email protected]> | ||
* | ||
*/ | ||
|
||
#pragma once | ||
#include <functional> | ||
#include "alarms/Key.h" | ||
|
||
namespace libyang { | ||
class DataNode; | ||
} | ||
|
||
namespace alarms { | ||
|
||
struct AlarmEntry; | ||
|
||
class AlarmFilter { | ||
public: | ||
bool matches(const InstanceKey& key, const AlarmEntry& alarmNode) const; | ||
|
||
protected: | ||
AlarmFilter() = default; // disable public instantiation of this class | ||
std::vector<std::function<bool(const InstanceKey&, const AlarmEntry&)>> m_filters; | ||
}; | ||
|
||
class PurgeFilter : public AlarmFilter { | ||
public: | ||
PurgeFilter(const libyang::DataNode& filterInput); | ||
}; | ||
|
||
class CompressFilter : public AlarmFilter { | ||
public: | ||
CompressFilter(const libyang::DataNode& filterInput); | ||
}; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.