Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT > Class Template Reference

Bounded ordering log record queueing strategy. More...

#include <bounded_ordering_queue.hpp>

Inheritance diagram for boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >:
Collaboration diagram for boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >:

Public Member Functions

posix_time::time_duration get_ordering_window () const
 Returns ordering window size specified during initialization. More...
 

Static Public Member Functions

static posix_time::time_duration get_default_ordering_window ()
 Returns default ordering window size. More...
 

Protected Member Functions

template<typename ArgsT >
 bounded_ordering_queue (ArgsT const &args)
 Initializing constructor. More...
 
void enqueue (record_view const &rec)
 Enqueues log record to the queue. More...
 
bool try_enqueue (record_view const &rec)
 Attempts to enqueue log record to the queue. More...
 
bool try_dequeue_ready (record_view &rec)
 Attempts to dequeue a log record ready for processing from the queue, does not block if the queue is empty. More...
 
bool try_dequeue (record_view &rec)
 Attempts to dequeue log record from the queue, does not block if the queue is empty. More...
 
bool dequeue_ready (record_view &rec)
 Dequeues log record from the queue, blocks if the queue is empty. More...
 
void interrupt_dequeue ()
 Wakes a thread possibly blocked in the dequeue method. More...
 

Detailed Description

template<typename OrderT, std::size_t MaxQueueSizeV, typename OverflowStrategyT>
class boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >

Bounded ordering log record queueing strategy.

The bounded_ordering_queue class is intended to be used with the asynchronous_sink frontend as a log record queueing strategy.

This strategy provides the following properties to the record queueing mechanism:

  • The queue has limited capacity specified by the MaxQueueSizeV template parameter.
  • Upon reaching the size limit, the queue invokes the overflow handling strategy specified in the OverflowStrategyT template parameter to handle the situation. The library provides overflow handling strategies for most common cases: drop_on_overflow will silently discard the log record, and block_on_overflow will put the enqueueing thread to wait until there is space in the queue.
  • The queue has a fixed latency window. This means that each log record put into the queue will normally not be dequeued for a certain period of time.
  • The queue performs stable record ordering within the latency window. The ordering predicate can be specified in the OrderT template parameter.

Constructor & Destructor Documentation

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
template<typename ArgsT >
boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::bounded_ordering_queue ( ArgsT const &  args)
inlineexplicitprotected

Initializing constructor.

Member Function Documentation

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
bool boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::dequeue_ready ( record_view rec)
inlineprotected

Dequeues log record from the queue, blocks if the queue is empty.

References boost::geometry::difference(), boost::lock(), boost::size(), and boost::condition_variable::wait().

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
void boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::enqueue ( record_view const &  rec)
inlineprotected

Enqueues log record to the queue.

References boost::lock(), boost::condition_variable::notify_one(), and boost::size().

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
static posix_time::time_duration boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::get_default_ordering_window ( )
inlinestatic

Returns default ordering window size.

The default window size is specific to the operating system thread scheduling mechanism.

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
posix_time::time_duration boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::get_ordering_window ( ) const
inline

Returns ordering window size specified during initialization.

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
void boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::interrupt_dequeue ( )
inlineprotected

Wakes a thread possibly blocked in the dequeue method.

References boost::lock(), and boost::condition_variable::notify_one().

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
bool boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::try_dequeue ( record_view rec)
inlineprotected

Attempts to dequeue log record from the queue, does not block if the queue is empty.

References boost::lock(), and boost::size().

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
bool boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::try_dequeue_ready ( record_view rec)
inlineprotected

Attempts to dequeue a log record ready for processing from the queue, does not block if the queue is empty.

References boost::lock(), and boost::size().

template<typename OrderT , std::size_t MaxQueueSizeV, typename OverflowStrategyT >
bool boost::sinks::bounded_ordering_queue< OrderT, MaxQueueSizeV, OverflowStrategyT >::try_enqueue ( record_view const &  rec)
inlineprotected

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