lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
lintel::IEventBus Class Referenceabstract

#include <EventBus.h>

Inheritance diagram for lintel::IEventBus:
lintel::EventBusView

Public Member Functions

virtual ~IEventBus ()=default
 
virtual const char * getName () const =0
 
virtual EventBusConfig getConfig () const =0
 
virtual bool isLockFree () const =0
 
virtual bool registerTopic (const std::string &topic)=0
 
virtual bool isTopicRegistered (const std::string &topic) const =0
 
virtual std::size_t topicCount () const =0
 
virtual bool subscribe (const std::string &topic, const std::string &subscriber)=0
 
virtual bool unsubscribe (const std::string &topic, const std::string &subscriber)=0
 
virtual bool isSubscribed (const std::string &topic, const std::string &subscriber) const =0
 
virtual std::size_t numberOfSubscribersOf (const std::string &topic) const =0
 
virtual std::size_t subscriberCount () const =0
 
virtual bool publish (const Event &event)=0
 
virtual bool publishToSubscribers (const Event &event)=0
 
virtual std::optional< Event > receive ()=0
 
virtual std::optional< Event > receiveOf (const std::string &subscriber)=0
 
virtual bool isEmpty () const =0
 
virtual bool isEmptyOf (const std::string &subscriber) const =0
 
virtual std::int64_t sequenceOf () const =0
 
virtual std::uint64_t droppedEventsOf () const =0
 
virtual void reset ()=0
 

Detailed Description

Abstract interface of an EventBus used by the local service layer (dependency inversion). Implemented by EventBusView, which forwards to the EventBus object stored in shared memory.

Constructor & Destructor Documentation

◆ ~IEventBus()

virtual lintel::IEventBus::~IEventBus ( )
virtualdefault

Member Function Documentation

◆ droppedEventsOf()

virtual std::uint64_t lintel::IEventBus::droppedEventsOf ( ) const
pure virtual
Returns
the number of events that were dropped due to full queues

Implemented in lintel::EventBusView.

◆ getConfig()

virtual EventBusConfig lintel::IEventBus::getConfig ( ) const
pure virtual
Returns
the configuration the bus was created with

Implemented in lintel::EventBusView.

◆ getName()

virtual const char * lintel::IEventBus::getName ( ) const
pure virtual
Returns
the name of the bus

Implemented in lintel::EventBusView.

◆ isEmpty()

virtual bool lintel::IEventBus::isEmpty ( ) const
pure virtual
Returns
true if the point-to-point bus queue is empty

Implemented in lintel::EventBusView.

◆ isEmptyOf()

virtual bool lintel::IEventBus::isEmptyOf ( const std::string &  subscriber) const
pure virtual
Parameters
subscriberthe subscriber name
Returns
true if the subscriber queue is empty or unknown

Implemented in lintel::EventBusView.

◆ isLockFree()

virtual bool lintel::IEventBus::isLockFree ( ) const
pure virtual
Returns
true if the underlying queues are lock-free

Implemented in lintel::EventBusView.

◆ isSubscribed()

virtual bool lintel::IEventBus::isSubscribed ( const std::string &  topic,
const std::string &  subscriber 
) const
pure virtual
Parameters
topicthe topic name
subscriberthe subscriber name
Returns
true if the subscriber is subscribed to the topic

Implemented in lintel::EventBusView.

◆ isTopicRegistered()

virtual bool lintel::IEventBus::isTopicRegistered ( const std::string &  topic) const
pure virtual
Parameters
topicthe topic name
Returns
true if the topic is registered

Implemented in lintel::EventBusView.

◆ numberOfSubscribersOf()

virtual std::size_t lintel::IEventBus::numberOfSubscribersOf ( const std::string &  topic) const
pure virtual
Parameters
topicthe topic name
Returns
the number of subscribers of the topic

Implemented in lintel::EventBusView.

◆ publish()

virtual bool lintel::IEventBus::publish ( const Event &  event)
pure virtual

Publish an event into the point-to-point bus queue.

Parameters
eventthe event to publish
Returns
false if the bus queue is full

Implemented in lintel::EventBusView.

◆ publishToSubscribers()

virtual bool lintel::IEventBus::publishToSubscribers ( const Event &  event)
pure virtual

Publish an event to every subscriber of the event topic.

Parameters
eventthe event to publish
Returns
false if no subscriber received the event

Implemented in lintel::EventBusView.

◆ receive()

virtual std::optional< Event > lintel::IEventBus::receive ( )
pure virtual

Receive the next event from the point-to-point bus queue.

Returns
the event or std::nullopt if the queue is empty

Implemented in lintel::EventBusView.

◆ receiveOf()

virtual std::optional< Event > lintel::IEventBus::receiveOf ( const std::string &  subscriber)
pure virtual

Receive the next event of a subscriber queue.

Parameters
subscriberthe subscriber name
Returns
the event or std::nullopt if the queue is empty

Implemented in lintel::EventBusView.

◆ registerTopic()

virtual bool lintel::IEventBus::registerTopic ( const std::string &  topic)
pure virtual

Register a topic on the bus (idempotent).

Parameters
topicthe topic name
Returns
false if the topic table is full

Implemented in lintel::EventBusView.

◆ reset()

virtual void lintel::IEventBus::reset ( )
pure virtual

Drop all queued events on the bus and every subscriber queue.

Implemented in lintel::EventBusView.

◆ sequenceOf()

virtual std::int64_t lintel::IEventBus::sequenceOf ( ) const
pure virtual
Returns
the last assigned sequence number

Implemented in lintel::EventBusView.

◆ subscribe()

virtual bool lintel::IEventBus::subscribe ( const std::string &  topic,
const std::string &  subscriber 
)
pure virtual

Subscribe a named subscriber to a topic.

Parameters
topicthe topic name
subscriberthe subscriber name
Returns
false if the topic does not exist or the table is full

Implemented in lintel::EventBusView.

◆ subscriberCount()

virtual std::size_t lintel::IEventBus::subscriberCount ( ) const
pure virtual
Returns
the number of reserved subscriber slots

Implemented in lintel::EventBusView.

◆ topicCount()

virtual std::size_t lintel::IEventBus::topicCount ( ) const
pure virtual
Returns
the number of registered topics

Implemented in lintel::EventBusView.

◆ unsubscribe()

virtual bool lintel::IEventBus::unsubscribe ( const std::string &  topic,
const std::string &  subscriber 
)
pure virtual

Unsubscribe a named subscriber from a topic.

Parameters
topicthe topic name
subscriberthe subscriber name
Returns
true if the subscriber was removed

Implemented in lintel::EventBusView.


The documentation for this class was generated from the following file: