ark::logging::LogWriterMessageQueue

Defined in header “ark/logging/stages/log_writer_message_queue.hh”.


This class provides access to a message queue, allowing you to place incoming objects into the queue and taking care of managing them. This further allows us to manage things like “event based logging”, where we buffer some objects into standalone queues that get flushed on demand.

Methods

  • LogWriterMessageQueue(LogWriterMessageQueueConfig config)
    Constructor.

  • void set_minimum_message_timestamp(LoggingClock::time_point minimum_message_time)
    Sets the minimum timestamp that this message queue accepts. Initially zero (accepting all messages), you can set this to filter out messages that come before a particular timestamp (such as before a log starts). You can also set this to “far into the future” so that all data is ignored, aside from latched messages.

  • LogWriterMessageQueueStatistics statistics(LoggingClock::time_point now)
    Returns statistics related to this message queue.

  • void register_event_buffer(const ObjectDeclaration & declaration, const std::string & event_buffer_name)
    Marks that all messages coming in for the specified declaration are redirected to the event buffer. If the event buffer is active, it will simply write the message to the primary queue. If inactive, it will buffer.

  • void push(const ObjectDeclaration & declaration, const pipeline::AbstractEnvelopeCPtr & envelope)
    Enqueues the given object; this will handle buffering the object into the primary queue or the event queues.

  • void push_primary_queue(const std::vector< QueuedObjectPtr > & source, int64_t source_offset)
    Re-enqueues all objects from the given list, starting at the specified offset. This does not apply event-based or time filtering rules; it’s assumed that ALL of these objects will be placed onto the primary queue.

  • std::vector< QueuedObjectPtr > pop_primary_queue(std::atomic< uint64_t > & popped_message_size, std::atomic< uint64_t > & popped_message_count)
    Pops all of the elements on the primary queue, returning them as a list of objects. Returns the popped message size and queue in atomic variables.

  • std::map< ObjectDeclaration, core::ByteBuffer > latest_latched_messages()
    Returns a copy of all of the latest latched messages received.

  • std::optional< LoggingClock::time_point > oldest_message_timestamp()
    Returns the oldest message timestamp in the primary queue, or an empty optional if there are no messages in the queue.

  • void set_event_buffer_enabled_until(const std::string & buffer_name, LoggingClock::time_point enabled_until)
    Sets that the event buffer should be enabled until the given time is reached.

    The event buffer will remain enabled until it is either disabled, or the time has been reached. Additional calls to this can extend the duration of the buffer enabled state, but cannot shorten it.

  • void set_event_buffer_disabled(const std::string & buffer_name)
    Disables this event buffer immediately. Data will stop flowing into the logger, and will instead be buffered.

  • void clear_queues()
    Clears all of the queues (primary and event). Leaves the latched messages as-is.