title: sgns::trustedpeer::TrustedPeerListPayload summary: ISignedCRDTData payload type carrying the trusted-peer list. Serialization is a newline-joined encoding of the peer address list (addresses are 128-char hex strings and never contain ' '). Verify() performs structural validation ONLY (non-empty, no duplicates, each entry exactly 128 lowercase-hex characters) it never diffs against any cached/mutable state (Pitfall 4).
sgns::trustedpeer::TrustedPeerListPayload¶
ISignedCRDTData payload type carrying the trusted-peer list. Serialization is a newline-joined encoding of the peer address list (addresses are 128-char hex strings and never contain ' '). Verify() performs structural validation ONLY (non-empty, no duplicates, each entry exactly 128 lowercase-hex characters) – it never diffs against any cached/mutable state (Pitfall 4).
#include <TrustedPeerRegistry.hpp>
Inherits from sgns::securecrdt::ISignedCRDTData
Public Functions¶
| Name | |
|---|---|
| TrustedPeerListPayload() =default | |
| TrustedPeerListPayload(std::vector< std::string > peers) Constructs a payload directly from a peer list (used by callers that need to serialize a proposed value). |
|
| virtual std::vector< uint8_t > | SerializeToBytes() const override Serializes this instance's payload to raw bytes (codec, encode side). |
| virtual bool | DeserializeFromBytes(const std::vector< uint8_t > & bytes) override |
| virtual bool | Verify(const std::vector< uint8_t > & payload) const override Performs type-specific semantic validation of payload beyond signature/quorum checks (e.g. field-range checks). |
| virtual void | Apply() override Applies the side effect of this value once the caller has independently confirmed quorum (e.g. via SecureCrdt::ReadIfQuorum). Apply() itself does NOT check quorum. |
| const std::vector< std::string > & | GetPeers() const Returns the decoded/constructed peer list. |
| std::optional< TrustedPeerListPayload > | FromBytes(const std::vector< uint8_t > & bytes) Decodes a trusted-peer list into a fully-constructed payload. |
Additional inherited members¶
Public Functions inherited from sgns::securecrdt::ISignedCRDTData
| Name | |
|---|---|
| virtual | ~ISignedCRDTData() =default |
Public Functions Documentation¶
function TrustedPeerListPayload¶
function TrustedPeerListPayload¶
Constructs a payload directly from a peer list (used by callers that need to serialize a proposed value).
Parameters:
- peers Peer address list.
function SerializeToBytes¶
Serializes this instance's payload to raw bytes (codec, encode side).
Return: Raw payload bytes representing this instance's current state.
Reimplements: sgns::securecrdt::ISignedCRDTData::SerializeToBytes
function DeserializeFromBytes¶
Note: Prefer FromBytes() in concrete TrustedPeerListPayload call sites. This mutating override remains for ISignedCRDTData consumers.
Reimplements: sgns::securecrdt::ISignedCRDTData::DeserializeFromBytes
function Verify¶
Performs type-specific semantic validation of payload beyond signature/quorum checks (e.g. field-range checks).
Parameters:
- payload Raw payload bytes to validate.
Return: true if payload is semantically valid for this type.
Reimplements: sgns::securecrdt::ISignedCRDTData::Verify
function Apply¶
Applies the side effect of this value once the caller has independently confirmed quorum (e.g. via SecureCrdt::ReadIfQuorum). Apply() itself does NOT check quorum.
Reimplements: sgns::securecrdt::ISignedCRDTData::Apply
function GetPeers¶
Returns the decoded/constructed peer list.
Return: Peer address list.
function FromBytes¶
Decodes a trusted-peer list into a fully-constructed payload.
Parameters:
- bytes Raw newline-delimited peer-list bytes.
Return: The decoded payload, or std::nullopt if bytes is malformed.
Updated on 2026-08-28 at 22:24:30 +0000