B2BITS FIX Antenna C++ 2.32.0
Loading...
Searching...
No Matches
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 (removes all messages).
 
StorageType currentConnectionType () const
 Returns type of the storage.
 
virtual std::string const * getBaseFilePath () const =0
 Returns path to the storage without extension.
 
virtual bool getBoolConfigInfo (const std::string &aKey, bool *aValue) const =0
 Retrieves configuration information.
 
virtual bool getConfigInfo (const std::string &aKey, std::string *aValue) const =0
 Retrieves configuration information.
 
virtual System::u64 getCreationTime ()=0
 Returns storage creation time as number of milliseconds sincec Janually 1, 1970.
 
virtual bool getIntConfigInfo (const std::string &aKey, int *aValue) const =0
 Retrieves configuration information.
 
virtual int getMaxSeqNum ()=0
 Returns the maximum message's sequence number in the storage.
 
virtual int getMinSeqNum ()=0
 Returns the minimum message's sequence number in the storage.
 
virtual RejectMsgStoragegetRejectStorage ()
 Return interface to the rejected storage, could be NULL.
 
virtual bool isClearingSupported () const
 Returns true if the storage supports the cleaning (removing of all messages).
 
virtual bool isPersistentStorage () const =0
 Return true if storage is persistent.
 
virtual bool logLocal (StorableMsg const *apMsg, int nSeqNum, const char *pRawMsg, int size)=0
 Stores the given outgoing message and then destroys it.
 
virtual bool logLocal (StorableMsg const *apMsg, int nSeqNum, const std::string &aRawMsg)=0
 Stores the given outgoing message and then destroys it.
 
virtual void logRemote (int msgSeqNum, const char *pRawMsg, int size)=0
 Logs the message from the remote FIX engine.
 
virtual void logRemote (int msgSeqNum, const std::string &rawMsg)=0
 Logs the message from the remote FIX engine.
 
virtual void logRemote (StorableMsgRemote const *apMsg, int msgSeqNum, const char *pRawMsg, int size)
 Logs the message from the remote FIX engine.
 
virtual void markAsTerminated (bool correctlyTerminated)=0
 Closes the storage.
 
 MsgStorage (StorageType type)
 Constructor.
 
virtual CacheHolderBaseprepareLocalRetriving (int beginSeqNum, int endSeqNum, int currentOutSeqNum=INT_MAX, bool filterForResend=true)=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.
 
virtual bool retrieveLocal (CacheHolderBase *cacheHolder, ParserID parserID, std::vector< FIXMessage * > *apMsgs, int aBeginSeqNum, int aEndSeqNum=0, ProtocolIndex preferredVersion=NA)=0
 Locates sent messages.
 
virtual bool retrieveLocal (int outSeqNum, std::string *msg, int currentOutSeqNum=INT_MAX, bool filterForResend=false, CacheHolderBase *cacheHolder=NULL)=0
 Locates sent message (with seqNum=outSeqNum) and returns it into msg.
 
virtual void retrieveRemote (ParserID parserID, std::vector< FIXMessage * > *pMessages, const MsgTypes &msgTypes, const std::vector< FixField > &fieldFilter, int beginSeqNum, int endSeqNum=0, ProtocolIndex fixVersion=NA)=0
 Fills input list with messages that satisfy selection criteria.
 
virtual void setBoolConfigInfo (const std::string &aKey, bool aValue)=0
 Sets the configuration information.
 
virtual void setConfigInfo (const std::string &aKey, const std::string &aValue)=0
 Sets the configuration information.
 
virtual void setIntConfigInfo (const std::string &aKey, int aValue)=0
 Sets the configuration information.
 
virtual void setLastSentSeqNum (int value)=0
 Updates MsgSeqNum of outgoing messages.
 
virtual void setMaxRemoteSeqNum (int msgSeqNum)=0
 Sets the maximum MsgSeqNum of received messages.
 
virtual void setMinSeqNum (int msgSeqNum)=0
 Sets the minimum MsgSeqNum of sended messages.
 
virtual void setRemoteSeqNum (int msgSeqNum)=0
 Updates current MsgSeqNum of received messages.
 
virtual ~MsgStorage ()
 Destructor.
 

Protected Member Functions

void clearFixMsgs (FixMsgs &aMsgs)
 Clears collection (delete all its elements).
 
virtual bool rebuildIndex (const std::string &logPath, const std::string &indexPath, const RestoreOptions &options, unsigned char tagsDelimiter)=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 ( )
inlinevirtual

Clears the storage (removes all messages).

◆ 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.


◆ isClearingSupported()

virtual bool Engine::MsgStorage::isClearingSupported ( ) const
inlinevirtual

Returns true if the storage supports the cleaning (removing of all messages).

If false, the clear function leads to the exception.

◆ 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 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

◆ logLocal() [2/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

◆ logRemote() [1/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() [2/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
rawMsg- message buffer

◆ 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 = INT_MAX,
bool filterForResend = true )
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

Parameters
beginSeqNum- begin message number
endSeqNum- end message number
currentOutSeqNum- number of the current out message to be stored into the storage next time
filterForResend- if true load resendable messages only

◆ rebuildIndex()

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

◆ retrieveLocal() [1/2]

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

Locates sent messages.

Parameters
cacheHolder- cache holder
parserID- parser ID
[out]apMsgs- fix message list, message objects should be destroyed by the caller
aBeginSeqNum- begin message number
aEndSeqNum- end message number
preferredVersion- FIX protocol version

◆ retrieveLocal() [2/2]

virtual bool Engine::MsgStorage::retrieveLocal ( int outSeqNum,
std::string * msg,
int currentOutSeqNum = INT_MAX,
bool filterForResend = false,
CacheHolderBase * cacheHolder = NULL )
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
currentOutSeqNum- number of the current out message to be stored into the storage next time
filterForResend- if true load resendable messages only
cacheHolder- cache holder, the holder must be prepared with the same value of the filterForResend parameter

◆ 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,
ProtocolIndex 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