CatapultServer
v0.5.0.1 (Elephant)
|
Dispatcher for disruptor consumers. More...
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 | |
DisruptorElement * | tryNext (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 |
Dispatcher for disruptor consumers.
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.
|
explicit |
Creates a dispatcher of consumers configured with options.
catapult::disruptor::ConsumerDispatcher::~ConsumerDispatcher | ( | ) |
|
private |
|
private |
bool catapult::disruptor::ConsumerDispatcher::isRunning | ( | ) | const |
Returns true
if dispatcher is running, false
otherwise.
size_t catapult::disruptor::ConsumerDispatcher::numActiveElements | ( | ) | const |
Returns the number of elements currently in the disruptor.
size_t catapult::disruptor::ConsumerDispatcher::numAddedElements | ( | ) | const |
Returns the total number of elements added to the disruptor.
DisruptorElementId catapult::disruptor::ConsumerDispatcher::processElement | ( | ConsumerInput && | input | ) |
Pushes the input into underlying disruptor and returns the assigned element id.
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.
void catapult::disruptor::ConsumerDispatcher::shutdown | ( | ) |
Shuts down dispatcher and stops all threads.
size_t catapult::disruptor::ConsumerDispatcher::size | ( | ) | const |
Returns the number of registered consumers.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |