CatapultServer  v0.5.0.1 (Elephant)
catapult::disruptor::Disruptor Class Reference

Disruptor wraps around CircularBuffer for usage within Consumer Dispatcher. More...

Inheritance diagram for catapult::disruptor::Disruptor:
Collaboration diagram for catapult::disruptor::Disruptor:

Public Member Functions

 Disruptor (size_t disruptorSize, size_t elementTraceInterval=1)
 
DisruptorElementId add (ConsumerInput &&input, const ProcessingCompleteFunc &processingComplete)
 
void markSkipped (PositionType position, CompletionCode code)
 Sets skip flag on the element at position with code. More...
 
bool isSkipped (PositionType position) const
 Checks skip flag on the element at position. More...
 
DisruptorElementelementAt (PositionType position)
 Gets element at given position. More...
 
size_t size () const
 Gets the size of the disruptor. More...
 
size_t capacity () const
 Gets the capacity of the disruptor. More...
 
uint64_t added () const
 Gets the number of total elements added to the disruptor. More...
 

Private Attributes

size_t m_elementTraceInterval
 
utils::CircularBuffer< DisruptorElementm_container
 
std::atomic< uint64_t > m_allElementsCount
 

Additional Inherited Members

- Private Member Functions inherited from catapult::utils::NonCopyable
constexpr NonCopyable ()=default
 Default constructor. More...
 
 ~NonCopyable ()=default
 Default destructor. More...
 
 NonCopyable (const NonCopyable &)=delete
 Disabled copy constructor. More...
 
NonCopyableoperator= (const NonCopyable &)=delete
 Disabled assignment operator. More...
 

Detailed Description

Disruptor wraps around CircularBuffer for usage within Consumer Dispatcher.

Constructor & Destructor Documentation

◆ Disruptor()

catapult::disruptor::Disruptor::Disruptor ( size_t  disruptorSize,
size_t  elementTraceInterval = 1 
)
explicit

Creates disruptor container able to hold disruptorSize elements with optional queue logging every elementTraceInterval elements.

Member Function Documentation

◆ add()

DisruptorElementId catapult::disruptor::Disruptor::add ( ConsumerInput &&  input,
const ProcessingCompleteFunc processingComplete 
)

Adds an input to the underlying container and returns the assigned disruptor 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:

◆ added()

uint64_t catapult::disruptor::Disruptor::added ( ) const
inline

Gets the number of total elements added to the disruptor.

Here is the caller graph for this function:

◆ capacity()

size_t catapult::disruptor::Disruptor::capacity ( ) const
inline

Gets the capacity of the disruptor.

Here is the caller graph for this function:

◆ elementAt()

DisruptorElement& catapult::disruptor::Disruptor::elementAt ( PositionType  position)
inline

Gets element at given position.

Here is the caller graph for this function:

◆ isSkipped()

bool catapult::disruptor::Disruptor::isSkipped ( PositionType  position) const

Checks skip flag on the element at position.

Here is the caller graph for this function:

◆ markSkipped()

void catapult::disruptor::Disruptor::markSkipped ( PositionType  position,
CompletionCode  code 
)

Sets skip flag on the element at position with code.

◆ size()

size_t catapult::disruptor::Disruptor::size ( ) const
inline

Gets the size of the disruptor.

Member Data Documentation

◆ m_allElementsCount

std::atomic<uint64_t> catapult::disruptor::Disruptor::m_allElementsCount
private

◆ m_container

utils::CircularBuffer<DisruptorElement> catapult::disruptor::Disruptor::m_container
private

◆ m_elementTraceInterval

size_t catapult::disruptor::Disruptor::m_elementTraceInterval
private

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