sgns::crdt::Broadcaster¶
A Broadcaster provides a way to send (notify) an opaque payload to all replicas and to retrieve payloads broadcasted.
#include <broadcaster.hpp>
Inherited by sgns::crdt::PubSubBroadcaster, sgns::crdt::PubSubBroadcasterExt
Public Types¶
| Name | |
|---|---|
| enum class | ErrorCode |
Public Functions¶
| Name | |
|---|---|
| virtual | ~Broadcaster() =default |
| virtual outcome::result< void > | Broadcast(const base::Buffer & buff, std::string topic, boost::optional< libp2p::peer::PeerInfo > peerInfo =boost::none) =0 |
| virtual outcome::result< base::Buffer > | Next() =0 |
| virtual bool | HasTopic(const std::string & topic) =0 Checks whether the broadcaster is subscribed to the specified topic. |
| virtual std::shared_ptr< void > | GetDagSyncer() const Get the underlying DAG syncer (if available). |
Public Types Documentation¶
enum ErrorCode¶
| Enumerator | Value | Description |
|---|---|---|
| Success | 0 | |
| ErrNoMoreBroadcast | 1 |
Public Functions Documentation¶
function ~Broadcaster¶
function Broadcast¶
virtual outcome::result< void > Broadcast(
const base::Buffer & buff,
std::string topic,
boost::optional< libp2p::peer::PeerInfo > peerInfo =boost::none
) =0
Parameters:
- buff Buffer containing the data to broadcast.
- topic Topic to broadcast to.
- peerInfo Optional peer info to avoid repeated GetPeerInfo calls.
Return: outcome::success on success or outcome::failure on error.
Reimplemented by: sgns::crdt::PubSubBroadcaster::Broadcast, sgns::crdt::PubSubBroadcasterExt::Broadcast
Send buffer payload to other replicas.
function Next¶
Return: buffer value or outcome::failure on error
Reimplemented by: sgns::crdt::PubSubBroadcaster::Next, sgns::crdt::PubSubBroadcasterExt::Next
Obtain the next payload and its topic received from the network.
function HasTopic¶
Checks whether the broadcaster is subscribed to the specified topic.
Parameters:
- topic The topic string to check.
Return: true if the broadcaster is subscribed to the topic, false otherwise.
Reimplemented by: sgns::crdt::PubSubBroadcaster::HasTopic, sgns::crdt::PubSubBroadcasterExt::HasTopic
function GetDagSyncer¶
Get the underlying DAG syncer (if available).
Return: Shared pointer to the DAG syncer, or nullptr if not available.
Reimplemented by: sgns::crdt::PubSubBroadcasterExt::GetDagSyncer
Updated on 2026-03-04 at 13:10:43 -0800