CatapultServer
v0.5.0.1 (Elephant)
|
Go to the documentation of this file.
27 #include <boost/thread.hpp>
30 namespace catapult {
namespace disruptor {
class ConsumerEntry; } }
32 namespace catapult {
namespace disruptor {
42 const std::vector<DisruptorConsumer>& consumers,
boost::thread_group m_threads
Definition: ConsumerDispatcher.h:89
ConsumerDispatcher(const ConsumerDispatcherOptions &options, const std::vector< DisruptorConsumer > &consumers, const DisruptorInspector &inspector)
Definition: ConsumerDispatcher.cpp:53
#define CATAPULT_LOG(SEV)
Writes a log entry to the default logger with SEV severity.
Definition: Logging.h:340
Container for disruptor barriers.
Definition: DisruptorBarriers.h:30
size_t size() const
Returns number of barriers.
Definition: DisruptorBarriers.h:37
void advance(ConsumerEntry &consumerEntry)
Definition: ConsumerDispatcher.cpp:128
PositionType position() const
Returns current position (in the circular buffer).
Definition: ConsumerEntry.h:42
Disruptor m_disruptor
Definition: ConsumerDispatcher.h:87
size_t m_elementTraceInterval
Definition: ConsumerDispatcher.h:83
bool isRunning() const
Returns true if dispatcher is running, false otherwise.
Definition: ConsumerDispatcher.cpp:98
std::atomic< size_t > m_numActiveElements
Definition: ConsumerDispatcher.h:90
Mixin to have named objects.
Definition: NamedObject.h:28
size_t numActiveElements() const
Returns the number of elements currently in the disruptor.
Definition: ConsumerDispatcher.cpp:110
def warning(*args)
Definition: colorPrint.py:10
DisruptorInspector m_inspector
Definition: ConsumerDispatcher.h:88
DisruptorElement & elementAt(PositionType position)
Gets element at given position.
Definition: Disruptor.h:51
Dispatcher for disruptor consumers.
Definition: ConsumerDispatcher.h:35
Holds information about a consumer.
Definition: ConsumerEntry.h:27
bool isSkipped(PositionType position) const
Checks skip flag on the element at position.
Definition: Disruptor.cpp:52
~ConsumerDispatcher()
Definition: ConsumerDispatcher.cpp:89
uint64_t added() const
Gets the number of total elements added to the disruptor.
Definition: Disruptor.h:66
Processing of the entity was aborted by a consumer.
Augments consumer input with disruptor metadata.
Definition: DisruptorElement.h:28
Definition: SpinLock.h:31
const char * DispatcherName
Name of the dispatcher.
Definition: ConsumerDispatcherOptions.h:39
Consumer dispatcher options.
Definition: ConsumerDispatcherOptions.h:27
size_t numAddedElements() const
Returns the total number of elements added to the disruptor.
Definition: ConsumerDispatcher.cpp:106
uint64_t DisruptorElementId
Id of a disruptor element.
Definition: DisruptorTypes.h:32
consumer< ConsumerInput &, const ConsumerCompletionResult & > DisruptorInspector
A disruptor inspector function.
Definition: DisruptorInspector.h:28
std::atomic_bool m_keepRunning
Definition: ConsumerDispatcher.h:85
void SetThreadName(const std::string &name)
Definition: ThreadInfo.cpp:69
DisruptorElement * tryNext(ConsumerEntry &consumerEntry)
Definition: ConsumerDispatcher.cpp:114
bool canProcessNextElement() const
Definition: ConsumerDispatcher.cpp:143
def info(*args)
Definition: forwardsValidation.py:12
uint64_t size
Definition: MemoryCounters.cpp:65
consumer< DisruptorElementId, const ConsumerCompletionResult & > ProcessingCompleteFunc
Function signature for signaling that processing finished.
Definition: DisruptorTypes.h:117
bool m_shouldThrowIfFull
Definition: ConsumerDispatcher.h:84
size_t level() const
Returns consumer level.
Definition: ConsumerEntry.h:47
DisruptorElementId processElement(ConsumerInput &&input, const ProcessingCompleteFunc &processingComplete)
Definition: ConsumerDispatcher.cpp:163
utils::SpinLock m_addSpinLock
Definition: ConsumerDispatcher.h:92
Disruptor wraps around CircularBuffer for usage within Consumer Dispatcher.
Definition: Disruptor.h:33
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
DisruptorElementId add(ConsumerInput &&input, const ProcessingCompleteFunc &processingComplete)
Definition: Disruptor.cpp:39
PositionType advance()
Advances the position.
Definition: ConsumerEntry.h:36
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
Definition: AddressExtractionExtension.cpp:28
ProcessingCompleteFunc wrap(const ProcessingCompleteFunc &processingComplete)
Definition: ConsumerDispatcher.cpp:156
void shutdown()
Shuts down dispatcher and stops all threads.
Definition: ConsumerDispatcher.cpp:93
constexpr bool IsIntervalElementId(DisruptorElementId id, size_t interval)
Returns true if id matches interval.
Definition: DisruptorElement.h:99
DisruptorBarriers m_barriers
Definition: ConsumerDispatcher.h:86
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
std::lock_guard< SpinLock > SpinLockGuard
A spin lock guard.
Definition: SpinLock.h:60
size_t capacity() const
Gets the capacity of the disruptor.
Definition: Disruptor.h:61
size_t size() const
Returns the number of registered consumers.
Definition: ConsumerDispatcher.cpp:102