|
itch-mold-replay 1.0
Time-accurate NASDAQ TotalView-ITCH 5.0 replay over MoldUDP64
|
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. | |
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.
|
explicit |
| buffer_size | size 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. |
| std::invalid_argument | if buffer_size is 0. |
|
noexcept |
Records a message's file position under its sequence number, overwriting the oldest entry if the buffer is full.
|
noexcept |
Returns the file position for seq_num, or std::nullopt if it's not currently in the buffer.
|
noexcept |
Capacity of the buffer, in messages.