Skip to content

sgns::securecrdt::SecureCrdtRegistry

Static registry resolving a CRDT key to its SecureCrdtRegistryEntry.

#include <SecureCrdtRegistry.hpp>

Public Functions

Name
void Register(const std::string & key_pattern, SecureCrdtRegistryEntry entry)
Registers (or replaces) the policy entry for key_pattern. Compiles compiled_pattern as "/?" + key_pattern + "(/sig/[^/]+)?" so both the base key and a valid sig/<addr> child resolve to the same entry - mirrors CRDTDataFilter::RegisterElementFilter's regex shape (src/crdt/impl/crdt_data_filter.cpp).
void UnregisterIf(const std::string & key_pattern, const void * expected_token)
Removes the registration for key_pattern only if the caller's token matches the token supplied at Register() time (compare-and-remove, prevents a second unrelated registration from clobbering removal).
const SecureCrdtRegistryEntry * Resolve(const std::string & key)
Resolves key against all registered patterns, returning the first matching entry (base_key or any sig/<addr> child).
std::vector< SecureCrdtRegistryEntry > AllEntries()
Returns a snapshot copy of every currently-registered entry. Used by SecureCrdt::RegisterFilters to self-register a filter callback for each registered base_key pattern at startup.

Public Functions Documentation

function Register

static inline void Register(
    const std::string & key_pattern,
    SecureCrdtRegistryEntry entry
)

Registers (or replaces) the policy entry for key_pattern. Compiles compiled_pattern as "/?" + key_pattern + "(/sig/[^/]+)?" so both the base key and a valid sig/<addr> child resolve to the same entry - mirrors CRDTDataFilter::RegisterElementFilter's regex shape (src/crdt/impl/crdt_data_filter.cpp).

Parameters:

  • key_pattern Base key pattern (regex-escaped by the caller if it contains regex metacharacters).
  • entry Policy entry to register (compiled_pattern is overwritten by this call).

function UnregisterIf

static inline void UnregisterIf(
    const std::string & key_pattern,
    const void * expected_token
)

Removes the registration for key_pattern only if the caller's token matches the token supplied at Register() time (compare-and-remove, prevents a second unrelated registration from clobbering removal).

Parameters:

  • key_pattern Base key pattern to unregister.
  • expected_token Opaque token that must match the registering token for the removal to take effect.

function Resolve

static inline const SecureCrdtRegistryEntry * Resolve(
    const std::string & key
)

Resolves key against all registered patterns, returning the first matching entry (base_key or any sig/<addr> child).

Parameters:

  • key CRDT key to resolve.

Return: Pointer to the matching entry, or nullptr if unregistered.

function AllEntries

static inline std::vector< SecureCrdtRegistryEntry > AllEntries()

Returns a snapshot copy of every currently-registered entry. Used by SecureCrdt::RegisterFilters to self-register a filter callback for each registered base_key pattern at startup.

Return: Vector of registered entries (order unspecified).


Updated on 2026-08-06 at 13:59:18 +0000