Skip to content

peerregistry/PeerRegistry.hpp

Abstract authorization authority resolving the current authorized peer set and quorum for a set of CRDT keys (D-04). SecureCRDT policy entries associate each registered key pattern with the PeerRegistry instance that owns it, so SecureCrdt stays generic and never assumes TrustedPeerRegistry globally. TrustedPeerRegistry (global root trust domain, D-05) and NetworkRegistry (per privateNetworkId, D-06) both implement this interface. More...

Namespaces

Name
sgns
sgns::peerregistry

Classes

Name
class sgns::peerregistry::PeerRegistry
Interface of an authorization authority that resolves the current authorized peer set and its quorum threshold from cached state. SecureCrdtRegistryEntry carries an optional shared_ptr to the PeerRegistry instance owning the registered key pattern, making the per-key association explicit instead of implicitly assuming TrustedPeerRegistry (D-04).

Functions

Name
sgns::securecrdt::SignerSetSource MakeRegistrySignerSetSource(std::shared_ptr< PeerRegistry > registry)
Builds a securecrdt::SignerSetSource forwarding to registry's CurrentSignerSet() (the cached-only path). Lives here rather than in SecureCrdtRegistry.hpp so SecureCrdtRegistry.hpp only needs a forward declaration of PeerRegistry, avoiding an include cycle.

Detailed Description

Abstract authorization authority resolving the current authorized peer set and quorum for a set of CRDT keys (D-04). SecureCRDT policy entries associate each registered key pattern with the PeerRegistry instance that owns it, so SecureCrdt stays generic and never assumes TrustedPeerRegistry globally. TrustedPeerRegistry (global root trust domain, D-05) and NetworkRegistry (per privateNetworkId, D-06) both implement this interface.

Date: 2026-09-01 Henrique A. Klein ([email protected])

Functions Documentation

function MakeRegistrySignerSetSource

inline sgns::securecrdt::SignerSetSource MakeRegistrySignerSetSource(
    std::shared_ptr< PeerRegistry > registry
)

Builds a securecrdt::SignerSetSource forwarding to registry's CurrentSignerSet() (the cached-only path). Lives here rather than in SecureCrdtRegistry.hpp so SecureCrdtRegistry.hpp only needs a forward declaration of PeerRegistry, avoiding an include cycle.

Parameters:

  • registry Registry whose cached signer set authorizes the key.

Return: SignerSetSource lambda capturing the registry shared_ptr.

Source code

#ifndef SGNS_PEERREGISTRY_PEERREGISTRY_HPP
#define SGNS_PEERREGISTRY_PEERREGISTRY_HPP

#include <memory>
#include <vector>

#include "crdt/hierarchical_key.hpp"
#include "outcome/outcome.hpp"
#include "securecrdt/SecureCrdtRegistry.hpp"

namespace sgns::peerregistry
{
    class PeerRegistry
    {
    public:
        virtual ~PeerRegistry() = default;

        virtual outcome::result<sgns::securecrdt::SignerSetSnapshot> CurrentSignerSet() const = 0;

        virtual std::vector<std::string> GetCurrentPeers() const = 0;

        virtual sgns::crdt::HierarchicalKey BaseKey() const = 0;
    };

    inline sgns::securecrdt::SignerSetSource MakeRegistrySignerSetSource( std::shared_ptr<PeerRegistry> registry )
    {
        return [registry]( const std::string & /*base_key*/ ) -> outcome::result<sgns::securecrdt::SignerSetSnapshot>
        { return registry->CurrentSignerSet(); };
    }
} // namespace sgns::peerregistry

#endif // SGNS_PEERREGISTRY_PEERREGISTRY_HPP

Updated on 2026-10-06 at 13:34:21 +0000