BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
fix_client::SeqNumStore Class Reference

A thread-safe, file-backed repository for FIX Sequence Numbers. More...

#include <SeqNumStore.h>

Collaboration diagram for fix_client::SeqNumStore:
Collaboration graph

Public Member Functions

 SeqNumStore (const std::string &senderCompId, const std::string &directory="seq_store")
 Constructs a new SeqNumStore.
 
uint32_t getNextSenderSeqNum () const
 Gets the next expected outgoing sequence number.
 
uint32_t getNextTargetSeqNum () const
 Gets the next expected incoming sequence number.
 
void reset ()
 Resets the sequence numbers to 1 (e.g., on a new day or clean Logon).
 
void setSeqNums (uint32_t inSeq, uint32_t outSeq)
 Sets both sequence numbers and persists them to disk.
 

Private Member Functions

void load ()
 
void save () const
 

Private Attributes

std::string mFilePath
 
uint32_t mInSeqNum = 1
 
std::mutex mMutex
 
uint32_t mOutSeqNum = 1
 

Detailed Description

A thread-safe, file-backed repository for FIX Sequence Numbers.

To prevent ResendRequest loops on startup, the client must remember its last known sequence numbers. This class saves them to disk.

Constructor & Destructor Documentation

◆ SeqNumStore()

fix_client::SeqNumStore::SeqNumStore ( const std::string &  senderCompId,
const std::string &  directory = "seq_store" 
)

Constructs a new SeqNumStore.

Parameters
senderCompIdThe component ID, used to generate the filename.
directoryThe directory to save the sequence files (defaults to local dir).
Here is the call graph for this function:

Member Function Documentation

◆ getNextSenderSeqNum()

uint32_t fix_client::SeqNumStore::getNextSenderSeqNum ( ) const

Gets the next expected outgoing sequence number.

Here is the caller graph for this function:

◆ getNextTargetSeqNum()

uint32_t fix_client::SeqNumStore::getNextTargetSeqNum ( ) const

Gets the next expected incoming sequence number.

Here is the caller graph for this function:

◆ load()

void fix_client::SeqNumStore::load ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void fix_client::SeqNumStore::reset ( )

Resets the sequence numbers to 1 (e.g., on a new day or clean Logon).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save()

void fix_client::SeqNumStore::save ( ) const
private
Here is the caller graph for this function:

◆ setSeqNums()

void fix_client::SeqNumStore::setSeqNums ( uint32_t  inSeq,
uint32_t  outSeq 
)

Sets both sequence numbers and persists them to disk.

Parameters
inSeqThe incoming sequence number (TargetSeqNum, from server).
outSeqThe outgoing sequence number (SenderSeqNum, from client).
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mFilePath

std::string fix_client::SeqNumStore::mFilePath
private

◆ mInSeqNum

uint32_t fix_client::SeqNumStore::mInSeqNum = 1
private

◆ mMutex

std::mutex fix_client::SeqNumStore::mMutex
mutableprivate

◆ mOutSeqNum

uint32_t fix_client::SeqNumStore::mOutSeqNum = 1
private

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