Leka
A low-latency C++20 price-time-priority limit order book and matching engine
▶ Replay viewer
Loading...
Searching...
No Matches
sequence_number_generator.hpp
1#ifndef SEQUENCE_NUMBER_GENERATOR_HPP
2#define SEQUENCE_NUMBER_GENERATOR_HPP
3
4#include "lob/types/sequence_number.hpp"
5
6namespace lob {
7
8/**
9 * @brief Generates process-wide monotonic sequence numbers.
10 *
11 * Sequence numbers identify accepted engine processing order and are assigned
12 * only after an incoming order passes validation and duplicate checks.
13 */
15 private:
16 static std::uint64_t currentSequence;
17
18 public:
19 /** Returns the next valid sequence number or throws on exhaustion. */
20 static SequenceNumber generate();
21};
22
23} // namespace lob
24
25#endif // SEQUENCE_NUMBER_GENERATOR_HPP
Generates process-wide monotonic sequence numbers.
static SequenceNumber generate()
Returns the next valid sequence number or throws on exhaustion.
Monotonic engine sequence used for deterministic processing order.