CatapultServer  v0.5.0.1 (Elephant)
catapult::disruptor::ConsumerDispatcher Class Referencefinal

Dispatcher for disruptor consumers. More...

Inheritance diagram for catapult::disruptor::ConsumerDispatcher:
Collaboration diagram for catapult::disruptor::ConsumerDispatcher:

Public Member Functions

 ConsumerDispatcher (const ConsumerDispatcherOptions &options, const std::vector< DisruptorConsumer > &consumers, const DisruptorInspector &inspector)
 
 ConsumerDispatcher (const ConsumerDispatcherOptions &options, const std::vector< DisruptorConsumer > &consumers)
 Creates a dispatcher of consumers configured with options. More...
 
 ~ConsumerDispatcher ()
 
void shutdown ()
 Shuts down dispatcher and stops all threads. More...
 
bool isRunning () const
 Returns true if dispatcher is running, false otherwise. More...
 
size_t size () const
 Returns the number of registered consumers. More...
 
DisruptorElementId processElement (ConsumerInput &&input, const ProcessingCompleteFunc &processingComplete)
 
DisruptorElementId processElement (ConsumerInput &&input)
 Pushes the input into underlying disruptor and returns the assigned element id. More...
 
size_t numAddedElements () const
 Returns the total number of elements added to the disruptor. More...
 
size_t numActiveElements () const
 Returns the number of elements currently in the disruptor. More...
 
- Public Member Functions inherited from catapult::utils::NamedObjectMixin
 NamedObjectMixin (const std::string &name)
 Creates a mixin with name. More...
 
const std::string & name () const
 Returns the name. More...
 

Private Member Functions

DisruptorElementtryNext (ConsumerEntry &consumerEntry)
 
void advance (ConsumerEntry &consumerEntry)
 
bool canProcessNextElement () const
 
ProcessingCompleteFunc wrap (const ProcessingCompleteFunc &processingComplete)
 

Private Attributes

size_t m_elementTraceInterval
 
bool m_shouldThrowIfFull
 
std::atomic_bool m_keepRunning
 
DisruptorBarriers m_barriers
 
Disruptor m_disruptor
 
DisruptorInspector m_inspector
 
boost::thread_group m_threads
 
std::atomic< size_t > m_numActiveElements
 
utils::SpinLock m_addSpinLock
 

Detailed Description

Dispatcher for disruptor consumers.

Constructor & Destructor Documentation

◆ ConsumerDispatcher() [1/2]

catapult::disruptor::ConsumerDispatcher::ConsumerDispatcher ( const ConsumerDispatcherOptions options,
const std::vector< DisruptorConsumer > &  consumers,
const DisruptorInspector inspector 
)

Creates a dispatcher of consumers configured with options. Inspector (inspector) is a special consumer that is always run (independent of skip) and as a last one. Inspector runs within a thread of the last consumer.

Here is the call graph for this function:

◆ ConsumerDispatcher() [2/2]

catapult::disruptor::ConsumerDispatcher::ConsumerDispatcher ( const ConsumerDispatcherOptions options,
const std::vector< DisruptorConsumer > &  consumers 
)
explicit

Creates a dispatcher of consumers configured with options.

◆ ~ConsumerDispatcher()

catapult::disruptor::ConsumerDispatcher::~ConsumerDispatcher ( )
Here is the call graph for this function:

Member Function Documentation

◆ advance()

void catapult::disruptor::ConsumerDispatcher::advance ( ConsumerEntry consumerEntry)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canProcessNextElement()

bool catapult::disruptor::ConsumerDispatcher::canProcessNextElement ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isRunning()

bool catapult::disruptor::ConsumerDispatcher::isRunning ( ) const

Returns true if dispatcher is running, false otherwise.

◆ numActiveElements()

size_t catapult::disruptor::ConsumerDispatcher::numActiveElements ( ) const

Returns the number of elements currently in the disruptor.

Here is the caller graph for this function:

◆ numAddedElements()

size_t catapult::disruptor::ConsumerDispatcher::numAddedElements ( ) const

Returns the total number of elements added to the disruptor.

Here is the call graph for this function:

◆ processElement() [1/2]

DisruptorElementId catapult::disruptor::ConsumerDispatcher::processElement ( ConsumerInput &&  input)

Pushes the input into underlying disruptor and returns the assigned element id.

Here is the call graph for this function:

◆ processElement() [2/2]

DisruptorElementId catapult::disruptor::ConsumerDispatcher::processElement ( ConsumerInput &&  input,
const ProcessingCompleteFunc processingComplete 
)

Pushes the input into underlying disruptor and returns the assigned element id. Once the processing of the input is complete, processingComplete will be called.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

void catapult::disruptor::ConsumerDispatcher::shutdown ( )

Shuts down dispatcher and stops all threads.

Here is the caller graph for this function:

◆ size()

size_t catapult::disruptor::ConsumerDispatcher::size ( ) const

Returns the number of registered consumers.

◆ tryNext()

DisruptorElement * catapult::disruptor::ConsumerDispatcher::tryNext ( ConsumerEntry consumerEntry)
private
Here is the call graph for this function:

◆ wrap()

ProcessingCompleteFunc catapult::disruptor::ConsumerDispatcher::wrap ( const ProcessingCompleteFunc processingComplete)
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_addSpinLock

utils::SpinLock catapult::disruptor::ConsumerDispatcher::m_addSpinLock
private

◆ m_barriers

DisruptorBarriers catapult::disruptor::ConsumerDispatcher::m_barriers
private

◆ m_disruptor

Disruptor catapult::disruptor::ConsumerDispatcher::m_disruptor
private

◆ m_elementTraceInterval

size_t catapult::disruptor::ConsumerDispatcher::m_elementTraceInterval
private

◆ m_inspector

DisruptorInspector catapult::disruptor::ConsumerDispatcher::m_inspector
private

◆ m_keepRunning

std::atomic_bool catapult::disruptor::ConsumerDispatcher::m_keepRunning
private

◆ m_numActiveElements

std::atomic<size_t> catapult::disruptor::ConsumerDispatcher::m_numActiveElements
private

◆ m_shouldThrowIfFull

bool catapult::disruptor::ConsumerDispatcher::m_shouldThrowIfFull
private

◆ m_threads

boost::thread_group catapult::disruptor::ConsumerDispatcher::m_threads
private

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