sgns::crdt::CRDTCallbackManager¶
#include <crdt_callback_manager.hpp>
Public Types¶
| Name | |
|---|---|
| using std::pair< std::string, base::Buffer > | NewDataPair |
| using std::function< void(NewDataPair new_data, std::string cid)> | NewDataCallback |
| using std::unordered_map< std::string, NewDataCallback > | NewDataCallbackRegistry |
| using std::function< void(std::string deleted_key, std::string cid)> | DeletedDataCallback |
| using std::unordered_map< std::string, DeletedDataCallback > | DeletedDataCallbackRegistry |
Public Functions¶
| Name | |
|---|---|
| CRDTCallbackManager() Construct a new CRDTCallbackManager object. |
|
| ~CRDTCallbackManager() Destroy the CRDTCallbackManager object. |
|
| bool | RegisterNewDataCallback(const std::string & pattern, NewDataCallback callback) Registers a callback for when new data gets recorded to a specific pattern. |
| bool | RegisterDeletedDataCallback(const std::string & pattern, DeletedDataCallback callback) Registers a callback for when data gets deleted to a specific pattern. |
| void | UnregisterNewDataCallback(const std::string & pattern) Removes a previously registered new data callback. |
| void | UnregisterDeletedDataCallback(const std::string & pattern) Removes a previously registered deleted data callback. |
| void | PutDataCallback(const std::string & key, const base::Buffer & value, const std::string & cid) Executes a registered new data callback that matches the key. |
| void | DeleteDataCallback(const std::string & deleted_key, const std::string & cid) Executes a registered deleted data callback that matches the key. |
Public Types Documentation¶
using NewDataPair¶
using NewDataCallback¶
using sgns::crdt::CRDTCallbackManager::NewDataCallback = std::function<void( NewDataPair new_data, std::string cid )>;
using NewDataCallbackRegistry¶
using sgns::crdt::CRDTCallbackManager::NewDataCallbackRegistry = std::unordered_map<std::string, NewDataCallback>;
using DeletedDataCallback¶
using sgns::crdt::CRDTCallbackManager::DeletedDataCallback = std::function<void( std::string deleted_key, std::string cid )>;
using DeletedDataCallbackRegistry¶
using sgns::crdt::CRDTCallbackManager::DeletedDataCallbackRegistry = std::unordered_map<std::string, DeletedDataCallback>;
Public Functions Documentation¶
function CRDTCallbackManager¶
Construct a new CRDTCallbackManager object.
function ~CRDTCallbackManager¶
Destroy the CRDTCallbackManager object.
function RegisterNewDataCallback¶
Registers a callback for when new data gets recorded to a specific pattern.
Parameters:
- pattern Regex pattern that the key should match to call the callback
- callback The callback itself
Return: true if registered, false otherwise
function RegisterDeletedDataCallback¶
Registers a callback for when data gets deleted to a specific pattern.
Parameters:
- pattern Regex pattern that the key should match to call the callback
- callback The callback itself
Return: true if registered, false otherwise
function UnregisterNewDataCallback¶
Removes a previously registered new data callback.
Parameters:
- pattern The pattern of the callback to be deleted
function UnregisterDeletedDataCallback¶
Removes a previously registered deleted data callback.
Parameters:
- pattern The pattern of the callback to be deleted
function PutDataCallback¶
void PutDataCallback(
const std::string & key,
const base::Buffer & value,
const std::string & cid
)
Executes a registered new data callback that matches the key.
Parameters:
- key key of the CRDT
- value value contained on the key
- cid content identifier associated with the value
function DeleteDataCallback¶
Executes a registered deleted data callback that matches the key.
Parameters:
- deleted_key key of the CRDT that was deleted
- cid content identifier associated with the deletion
Updated on 2026-04-13 at 23:22:46 -0700