Skip to content

sgns::crdt::PubSubBroadcaster

#include <pubsub_broadcaster.hpp>

Inherits from sgns::crdt::Broadcaster

Public Types

Name
using sgns::ipfs_pubsub::GossipPubSub GossipPubSub
using sgns::ipfs_pubsub::GossipPubSubTopic GossipPubSubTopic

Public Functions

Name
PubSubBroadcaster(std::shared_ptr< GossipPubSubTopic > pubSubTopic)
void SetLogger(base::Logger logger)
virtual outcome::result< void > Broadcast(const base::Buffer & buff, std::string topic, boost::optional< libp2p::peer::PeerInfo > peerInfo =boost::none) override
virtual outcome::result< base::Buffer > Next() override
virtual bool HasTopic(const std::string & topic) override
Checks whether the broadcaster is subscribed to the specified topic.

Additional inherited members

Public Types inherited from sgns::crdt::Broadcaster

Name
enum class ErrorCode

Public Functions inherited from sgns::crdt::Broadcaster

Name
virtual ~Broadcaster() =default
virtual std::shared_ptr< void > GetDagSyncer() const
Get the underlying DAG syncer (if available).

Public Types Documentation

using GossipPubSub

using sgns::crdt::PubSubBroadcaster::GossipPubSub = sgns::ipfs_pubsub::GossipPubSub;

using GossipPubSubTopic

using sgns::crdt::PubSubBroadcaster::GossipPubSubTopic = sgns::ipfs_pubsub::GossipPubSubTopic;

Public Functions Documentation

function PubSubBroadcaster

PubSubBroadcaster(
    std::shared_ptr< GossipPubSubTopic > pubSubTopic
)

function SetLogger

inline void SetLogger(
    base::Logger logger
)

function Broadcast

virtual outcome::result< void > Broadcast(
    const base::Buffer & buff,
    std::string topic,
    boost::optional< libp2p::peer::PeerInfo > peerInfo =boost::none
) override

Parameters:

  • buff Buffer containing the data to broadcast.
  • topic Topic to broadcast to.
  • peerInfo Optional peer info.

Return: outcome::success on success or outcome::failure on error

Reimplements: sgns::crdt::Broadcaster::Broadcast

Send buffer payload to other replicas.

function Next

virtual outcome::result< base::Buffer > Next() override

Return: buffer value or outcome::failure on error

Reimplements: sgns::crdt::Broadcaster::Next

Obtain the next payload received from the network.

function HasTopic

inline virtual bool HasTopic(
    const std::string & topic
) override

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.

Reimplements: sgns::crdt::Broadcaster::HasTopic


Updated on 2026-03-04 at 13:10:43 -0800