B2BITS FIX Antenna C++  2.27.0
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Engine::MsgStorage Class Referenceabstract

Basic message storage. More...

#include <B2BITS_MsgStorage.h>

Classes

struct  RestoreOptions
 

Public Types

typedef std::vector< StorableMsg * > FixMsgs
 
typedef std::deque< std::string > OutgoingMessages
 
enum  StorageType { PRIMARY_STORAGE = 0, BACKUP_STORAGE }
 Defines type of the storage. More...
 

Public Member Functions

virtual void clear ()
 Clears the storage. More...
 
StorageType currentConnectionType () const
 Returns type of the storage. More...
 
virtual std::string const * getBaseFilePath () const =0
 Returns path to the storage without extension. More...
 
virtual bool getBoolConfigInfo (const std::string &aKey, bool *aValue) const =0
 Retrieves configuration information. More...
 
virtual bool getConfigInfo (const std::string &aKey, std::string *aValue) const =0
 Retrieves configuration information. More...
 
virtual System::u64 getCreationTime ()=0
 
Returns storage creation time as number of milliseconds sincec Janually 1, 1970 More...
 
virtual bool getIntConfigInfo (const std::string &aKey, int *aValue) const =0
 Retrieves configuration information. More...
 
virtual int getMaxSeqNum ()=0
 Returns the maximum message's sequence number in the storage. More...
 
virtual int getMinSeqNum ()=0
 Returns the minimum message's sequence number in the storage. More...
 
virtual RejectMsgStoragegetRejectStorage ()
 Return interface to the rejected storage, could be NULL. More...
 
virtual bool isPersistentStorage () const =0
 Return true if storage is persistent. More...
 
virtual bool logLocal (StorableMsg const *apMsg, int nSeqNum, const std::string &aRawMsg)=0
 Stores the given outgoing message and then destroys it. More...
 
virtual bool logLocal (StorableMsg const *apMsg, int nSeqNum, const char *pRawMsg, int size)=0
 Stores the given outgoing message and then destroys it. More...
 
virtual void logRemote (int msgSeqNum, const std::string &rawMsg)=0
 Logs the message from the remote FIX engine. More...
 
virtual void logRemote (int msgSeqNum, const char *pRawMsg, int size)=0
 Logs the message from the remote FIX engine. More...
 
virtual void logRemote (StorableMsgRemote const *apMsg, int msgSeqNum, const char *pRawMsg, int size)
 Logs the message from the remote FIX engine. More...
 
virtual void markAsTerminated (bool correctlyTerminated)=0
 Closes the storage. More...
 
 MsgStorage (StorageType type)
 Constructor. More...
 
virtual CacheHolderBaseprepareLocalRetriving (int beginSeqNum, int endSeqNum, int currentOutSeqNum)=0
 Prepare for cache message walk process like a series of retrieveLocal() calls returns an object whose lifetime is bound to the whole series of retrieveLocal() calls when retrieveLocal() calls are complete, the object should be destroyed by the caller. More...
 
virtual bool retrieveLocal (CacheHolderBase *cacheHolder, ParserID parserID, std::vector< FIXMessage *> *apMsgs, int aBeginSeqNum, int aEndSeqNum=0, FIXVersion preferredVersion=NA)=0
 
Locates sent messages More...
 
virtual bool retrieveLocal (int outSeqNum, std::string *msg, int currentOutSeqNum)=0
 Locates sent message (with seqNum=outSeqNum) and returns it into msg. More...
 
virtual void retrieveRemote (ParserID parserID, std::vector< FIXMessage *> *pMessages, const MsgTypes &msgTypes, const std::vector< FixField > &fieldFilter, int beginSeqNum, int endSeqNum=0, FIXVersion fixVersion=NA)=0
 Fills input list with messages that satisfy selection criteria. More...
 
virtual void setBoolConfigInfo (const std::string &aKey, bool aValue)=0
 Sets the configuration information. More...
 
virtual void setConfigInfo (const std::string &aKey, const std::string &aValue)=0
 Sets the configuration information. More...
 
virtual void setIntConfigInfo (const std::string &aKey, int aValue)=0
 Sets the configuration information. More...
 
virtual void setLastSentSeqNum (int value)=0
 Updates MsgSeqNum of outgoing messages. More...
 
virtual void setMaxRemoteSeqNum (int msgSeqNum)=0
 Sets the maximum MsgSeqNum of received messages. More...
 
virtual void setMinSeqNum (int msgSeqNum)=0
 Sets the minimum MsgSeqNum of sended messages. More...
 
virtual void setRemoteSeqNum (int msgSeqNum)=0
 Updates current MsgSeqNum of received messages. More...
 
virtual ~MsgStorage ()
 Destructor. More...
 

Protected Member Functions

void clearFixMsgs (FixMsgs &aMsgs)
 Clears collection (delete all its elements). More...
 
virtual bool rebuildIndex (const std::string &logPath, const std::string &indexPath, const RestoreOptions &options)=0
 

Protected Attributes

StorageType currentConnectionType_
 

Detailed Description

Basic message storage.

Member Typedef Documentation

◆ FixMsgs

◆ OutgoingMessages

typedef std::deque<std::string> Engine::MsgStorage::OutgoingMessages

Member Enumeration Documentation

◆ StorageType

Defines type of the storage.

Either primary or backup.

Enumerator
PRIMARY_STORAGE 
BACKUP_STORAGE 

Constructor & Destructor Documentation

◆ MsgStorage()

Engine::MsgStorage::MsgStorage ( StorageType  type)

Constructor.

◆ ~MsgStorage()

virtual Engine::MsgStorage::~MsgStorage ( )
virtual

Destructor.

Member Function Documentation

◆ clear()

virtual void Engine::MsgStorage::clear ( )
virtual

Clears the storage.

◆ clearFixMsgs()

void Engine::MsgStorage::clearFixMsgs ( FixMsgs aMsgs)
protected

Clears collection (delete all its elements).

◆ currentConnectionType()

StorageType Engine::MsgStorage::currentConnectionType ( ) const

Returns type of the storage.

Returns
current storage type

◆ getBaseFilePath()

virtual std::string const* Engine::MsgStorage::getBaseFilePath ( ) const
pure virtual

Returns path to the storage without extension.

Returns
path to the storage without extension

◆ getBoolConfigInfo()

virtual bool Engine::MsgStorage::getBoolConfigInfo ( const std::string &  aKey,
bool *  aValue 
) const
pure virtual

Retrieves configuration information.

Parameters
aKey- parameter key
aValue- parameter result value
Returns
true if parameter is enabled

◆ getConfigInfo()

virtual bool Engine::MsgStorage::getConfigInfo ( const std::string &  aKey,
std::string *  aValue 
) const
pure virtual

Retrieves configuration information.

Parameters
aKey- parameter key
aValue- parameter result value
Returns
true if parameter is enabled

◆ getCreationTime()

virtual System::u64 Engine::MsgStorage::getCreationTime ( )
pure virtual


Returns storage creation time as number of milliseconds sincec Janually 1, 1970

◆ getIntConfigInfo()

virtual bool Engine::MsgStorage::getIntConfigInfo ( const std::string &  aKey,
int *  aValue 
) const
pure virtual

Retrieves configuration information.

Parameters
aKey- parameter key
aValue- parameter result value
Returns
true if parameter is enabled

◆ getMaxSeqNum()

virtual int Engine::MsgStorage::getMaxSeqNum ( )
pure virtual

Returns the maximum message's sequence number in the storage.

◆ getMinSeqNum()

virtual int Engine::MsgStorage::getMinSeqNum ( )
pure virtual

Returns the minimum message's sequence number in the storage.

◆ getRejectStorage()

virtual RejectMsgStorage* Engine::MsgStorage::getRejectStorage ( )
virtual

Return interface to the rejected storage, could be NULL.

◆ isPersistentStorage()

virtual bool Engine::MsgStorage::isPersistentStorage ( ) const
pure virtual

Return true if storage is persistent.

◆ logLocal() [1/2]

virtual bool Engine::MsgStorage::logLocal ( StorableMsg const *  apMsg,
int  nSeqNum,
const std::string &  aRawMsg 
)
pure virtual

Stores the given outgoing message and then destroys it.

Returns
false if the message with such sequence number already exists in the storage; otherwise true.
Parameters
apMsg- storage message
nSeqNum- message number
aRawMsg- message buffer

◆ logLocal() [2/2]

virtual bool Engine::MsgStorage::logLocal ( StorableMsg const *  apMsg,
int  nSeqNum,
const char *  pRawMsg,
int  size 
)
pure virtual

Stores the given outgoing message and then destroys it.

Returns
false if the message with such sequence number already exists in the storage; otherwise true.
Parameters
apMsg- storage message
nSeqNum- message number
pRawMsg- message buffer pointer
size- message buffer size

◆ logRemote() [1/3]

virtual void Engine::MsgStorage::logRemote ( int  msgSeqNum,
const std::string &  rawMsg 
)
pure virtual

Logs the message from the remote FIX engine.

Parameters
msgSeqNum- message number param rawMsg - message buffer

◆ logRemote() [2/3]

virtual void Engine::MsgStorage::logRemote ( int  msgSeqNum,
const char *  pRawMsg,
int  size 
)
pure virtual

Logs the message from the remote FIX engine.

Parameters
msgSeqNum- message number
pRawMsg- message buffer pointer
size- message buffer size

◆ logRemote() [3/3]

virtual void Engine::MsgStorage::logRemote ( StorableMsgRemote const *  apMsg,
int  msgSeqNum,
const char *  pRawMsg,
int  size 
)
inlinevirtual

Logs the message from the remote FIX engine.

Parameters
apMsg- storage message
msgSeqNum- message number
pRawMsg- message buffer pointer
size- message buffer size

◆ markAsTerminated()

virtual void Engine::MsgStorage::markAsTerminated ( bool  correctlyTerminated)
pure virtual

Closes the storage.

◆ prepareLocalRetriving()

virtual CacheHolderBase* Engine::MsgStorage::prepareLocalRetriving ( int  beginSeqNum,
int  endSeqNum,
int  currentOutSeqNum 
)
pure virtual

Prepare for cache message walk process like a series of retrieveLocal() calls returns an object whose lifetime is bound to the whole series of retrieveLocal() calls when retrieveLocal() calls are complete, the object should be destroyed by the caller.

Returned pointer can have NULL value. To control the lifetime, should be used in conjunction with std::auto_ptr<> The implementaion would typically load the messages from an external storage to memory to prepare for a series of retrieveLocal() calls

◆ rebuildIndex()

virtual bool Engine::MsgStorage::rebuildIndex ( const std::string &  logPath,
const std::string &  indexPath,
const RestoreOptions options 
)
protectedpure virtual

◆ retrieveLocal() [1/2]

virtual bool Engine::MsgStorage::retrieveLocal ( CacheHolderBase cacheHolder,
ParserID  parserID,
std::vector< FIXMessage *> *  apMsgs,
int  aBeginSeqNum,
int  aEndSeqNum = 0,
FIXVersion  preferredVersion = NA 
)
pure virtual


Locates sent messages

Parameters
cacheHolder- cache holder
parserID- parser ID
[out]apMsgs- fix message list
aBeginSeqNum- begin message number
aEndSeqNum- end message number
FIXVersion- FIX protocol version

◆ retrieveLocal() [2/2]

virtual bool Engine::MsgStorage::retrieveLocal ( int  outSeqNum,
std::string *  msg,
int  currentOutSeqNum 
)
pure virtual

Locates sent message (with seqNum=outSeqNum) and returns it into msg.

Returns
true if message was found, false otherwize
Parameters
[out]msg- result message

◆ retrieveRemote()

virtual void Engine::MsgStorage::retrieveRemote ( ParserID  parserID,
std::vector< FIXMessage *> *  pMessages,
const MsgTypes msgTypes,
const std::vector< FixField > &  fieldFilter,
int  beginSeqNum,
int  endSeqNum = 0,
FIXVersion  fixVersion = NA 
)
pure virtual

Fills input list with messages that satisfy selection criteria.

Parameters
parserID- unique parser identifier
pMessages- result messages list
msgTypes- message types filter
fieldFilter- message fields filter
beginSeqNum- begin message number
endSeqNum- end message number
fixVersion- FIX protocol version

◆ setBoolConfigInfo()

virtual void Engine::MsgStorage::setBoolConfigInfo ( const std::string &  aKey,
bool  aValue 
)
pure virtual

Sets the configuration information.

Parameters
aKey- parameter key
aValue- parameter value

◆ setConfigInfo()

virtual void Engine::MsgStorage::setConfigInfo ( const std::string &  aKey,
const std::string &  aValue 
)
pure virtual

Sets the configuration information.

Parameters
aKey- parameter key
aValue- parameter value

◆ setIntConfigInfo()

virtual void Engine::MsgStorage::setIntConfigInfo ( const std::string &  aKey,
int  aValue 
)
pure virtual

Sets the configuration information.

Parameters
aKey- parameter key
aValue- parameter value

◆ setLastSentSeqNum()

virtual void Engine::MsgStorage::setLastSentSeqNum ( int  value)
pure virtual

Updates MsgSeqNum of outgoing messages.

Parameters
value- LastSentSeqNum value

◆ setMaxRemoteSeqNum()

virtual void Engine::MsgStorage::setMaxRemoteSeqNum ( int  msgSeqNum)
pure virtual

Sets the maximum MsgSeqNum of received messages.

Parameters
msgSeqNum- maximum MsgSeqNum value

◆ setMinSeqNum()

virtual void Engine::MsgStorage::setMinSeqNum ( int  msgSeqNum)
pure virtual

Sets the minimum MsgSeqNum of sended messages.

Parameters
msgSeqNum- minimum MsgSeqNum value

◆ setRemoteSeqNum()

virtual void Engine::MsgStorage::setRemoteSeqNum ( int  msgSeqNum)
pure virtual

Updates current MsgSeqNum of received messages.

Parameters
msgSeqNum- MsgSeqNum value

Member Data Documentation

◆ currentConnectionType_

StorageType Engine::MsgStorage::currentConnectionType_
protected