![]() |
boost::log::sinks::bounded_ordering_queue — Bounded ordering log record queueing strategy.
// In header: <boost/log/sinks/bounded_ordering_queue.hpp> template<typename OrderT, std::size_t MaxQueueSizeV, typename OverflowStrategyT> class bounded_ordering_queue : private OverflowStrategyT { public: // construct/copy/destruct template<typename ArgsT> explicit bounded_ordering_queue(ArgsT const &); // public member functions posix_time::time_duration get_ordering_window() const; // public static functions static posix_time::time_duration get_default_ordering_window(); // protected member functions void enqueue(record_view const &); bool try_enqueue(record_view const &); bool try_dequeue_ready(record_view &); bool try_dequeue(record_view &); bool dequeue_ready(record_view &); void interrupt_dequeue(); };
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.
bounded_ordering_queue
protected member functionsvoid enqueue(record_view const & rec);Enqueues log record to the queue.
bool try_enqueue(record_view const & rec);Attempts to enqueue log record to the queue.
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.
bool try_dequeue(record_view & rec);Attempts to dequeue log record from the queue, does not block if the queue is empty.
bool dequeue_ready(record_view & rec);Dequeues log record from the queue, blocks if the queue is empty.
void interrupt_dequeue();Wakes a thread possibly blocked in the
dequeue
method.