Skip to content

src/crdt/broadcaster.hpp

Namespaces

Name
sgns
sgns::crdt

Classes

Name
class sgns::crdt::Broadcaster
A Broadcaster provides a way to send (notify) an opaque payload to all replicas and to retrieve payloads broadcasted.

Source code

#ifndef SUPERGENIUS_BROADCASTER_HPP
#define SUPERGENIUS_BROADCASTER_HPP

#include "base/buffer.hpp"
#include <libp2p/peer/peer_info.hpp>
#include <boost/optional.hpp>
#include <tuple>
#include <string>
#include <optional>

namespace sgns::crdt
{
    class Broadcaster
    {
    public:
        virtual ~Broadcaster() = default;

        enum class ErrorCode
        {
            Success            = 0, /*> 0 should not represent an error */
            ErrNoMoreBroadcast = 1, /*> no more data to broadcast */
        };

        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;

        virtual std::shared_ptr<void> GetDagSyncer() const { return nullptr; }
    };
} // namespace sgns::crdt

#endif // SUPERGENIUS_BROADCASTER_HPP

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