itch-mold-replay 1.0
Time-accurate NASDAQ TotalView-ITCH 5.0 replay over MoldUDP64
Loading...
Searching...
No Matches
imr::mold::RetransmissionBuffer Class Reference

Retransmission buffer of the last buffer_size messages. More...

#include <retransmission_buffer.h>

Classes

struct  MessageRecord
 

Public Member Functions

 RetransmissionBuffer (std::size_t buffer_size)
 
void push (const MessageRecord &message_record) noexcept
 Records a message's file position under its sequence number, overwriting the oldest entry if the buffer is full.
 
std::optional< std::size_t > file_position_for (types::header::SequenceNumber seq_num) const noexcept
 Returns the file position for seq_num, or std::nullopt if it's not currently in the buffer.
 
std::size_t size () const noexcept
 Capacity of the buffer, in messages.
 

Detailed Description

Retransmission buffer of the last buffer_size messages.

Implemented as a circular array, using the sequence number as the index. Single writer (downstream), N readers (retransmission); acquire/release on write_seq_ guards buffer visibility across threads.

Constructor & Destructor Documentation

◆ RetransmissionBuffer()

imr::mold::RetransmissionBuffer::RetransmissionBuffer ( std::size_t  buffer_size)
explicit
Parameters
buffer_sizesize of the retransmission buffer, in messages. Choose a power of two for faster lookup via bitmasking; non power-of-two sizes fall back to division.
Exceptions
std::invalid_argumentif buffer_size is 0.

Member Function Documentation

◆ push()

void imr::mold::RetransmissionBuffer::push ( const MessageRecord message_record)
noexcept

Records a message's file position under its sequence number, overwriting the oldest entry if the buffer is full.

◆ file_position_for()

std::optional< std::size_t > imr::mold::RetransmissionBuffer::file_position_for ( types::header::SequenceNumber  seq_num) const
noexcept

Returns the file position for seq_num, or std::nullopt if it's not currently in the buffer.

◆ size()

std::size_t imr::mold::RetransmissionBuffer::size ( ) const
noexcept

Capacity of the buffer, in messages.


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