sgns::crdt::CRDTDataFilter¶
#include <crdt_data_filter.hpp>
Public Types¶
| Name | |
|---|---|
| using std::function< std::optional< std::vector< pb::Element > >(const pb::Element &)> | ElementFilterCallback Element filtering callback definition. |
| using std::unordered_map< std::string, ElementFilterCallback > | FilterCallbackRegistry |
Public Functions¶
| Name | |
|---|---|
| CRDTDataFilter(bool accept_by_default =true) Construct a new CRDTDataFilter object. |
|
| ~CRDTDataFilter() =default Destroy the CRDTDataFilter object. |
|
| bool | RegisterElementFilter(const std::string & pattern, ElementFilterCallback filter) Registers an element filter callback. |
| bool | RegisterTombstoneFilter(const std::string & pattern, ElementFilterCallback filter) Registers a tombstone filter callback. |
| void | UnregisterElementFilter(const std::string & pattern) Removes the registration of an element filter that corresponds to a pattern. |
| void | UnregisterTombstoneFilter(const std::string & pattern) Removes the registration of a tombstone filter that corresponds to a pattern. |
| void | FilterElementsOnDelta(pb::Delta & delta) const Tries to filter the elements on delta according to stored filters. |
| void | FilterTombstonesOnDelta(pb::Delta & delta) Tries to filter the tombstones on delta according to stored filters. |
Public Types Documentation¶
using ElementFilterCallback¶
using sgns::crdt::CRDTDataFilter::ElementFilterCallback = std::function<std::optional<std::vector<pb::Element>>( const pb::Element & )>;
Element filtering callback definition.
using FilterCallbackRegistry¶
using sgns::crdt::CRDTDataFilter::FilterCallbackRegistry = std::unordered_map<std::string, ElementFilterCallback>;
Public Functions Documentation¶
function CRDTDataFilter¶
Construct a new CRDTDataFilter object.
Parameters:
- accept_by_default if true, every delta that doesn't have a filter gets accepted. if false, rejects by default.
function ~CRDTDataFilter¶
Destroy the CRDTDataFilter object.
function RegisterElementFilter¶
Registers an element filter callback.
Parameters:
- pattern The regex/pattern that the key of the element has to match
- filter The callback that is executed in case the pattern matches
Return: true if succeeded, false otherwise
function RegisterTombstoneFilter¶
Registers a tombstone filter callback.
Parameters:
- pattern The regex/pattern that the key of the tombstone has to match
- filter The callback that is executed in case the pattern matches
Return: true if succeeded, false otherwise
function UnregisterElementFilter¶
Removes the registration of an element filter that corresponds to a pattern.
Parameters:
- pattern The regex/pattern that the key of the element has to match
function UnregisterTombstoneFilter¶
Removes the registration of a tombstone filter that corresponds to a pattern.
Parameters:
- pattern The regex/pattern that the key of the tombstone has to match
function FilterElementsOnDelta¶
Tries to filter the elements on delta according to stored filters.
Parameters:
- delta The delta to be filtered
function FilterTombstonesOnDelta¶
Tries to filter the tombstones on delta according to stored filters.
Parameters:
- delta The delta to be filtered
Updated on 2026-03-04 at 13:10:43 -0800