B2BITS FIX Antenna HFT  1.0.13
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>

+ Inheritance diagram for Engine::MsgStorage:

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 int getInSeqNum ()
 
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 ::System::u64 getSessionGlobalID () const
 
virtual bool isPersistentStorage () const =0
 Return true if storage is persistent. More...
 
virtual bool isStorageCorrupted () const =0
 Checks if the storage is corrupted. More...
 
virtual bool logLocal (StorableMsg const *pMsg, const std::string &aRawMsg)=0
 Stores the given outgoing message and then destroys it. More...
 
virtual bool logLocal (StorableMsg const *pMsg, const char *pRawMsg, int size)=0
 Stores the given outgoing message and then destroys it. More...
 
virtual void logRemote (StorableMsg const *pMsg, const std::string &rawMsg)=0
 Logs the message from the remote FIX engine. More...
 
virtual void logRemote (StorableMsg const *pMsg, const char *pRawMsg, int size)=0
 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, ProtocolID protocolID, 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 (ProtocolID protocolID, 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)
 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 void syncMessageStorage ()=0
 
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

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

Member Enumeration Documentation

Defines type of the storage.

Either primary or backup.

Enumerator
PRIMARY_STORAGE 
BACKUP_STORAGE 

Constructor & Destructor Documentation

Engine::MsgStorage::MsgStorage ( StorageType  type)

Constructor.

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

Destructor.

Member Function Documentation

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

Clears the storage.

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

Clears collection (delete all its elements).

StorageType Engine::MsgStorage::currentConnectionType ( ) const

Returns type of the storage.

Returns
current storage type
virtual std::string const* Engine::MsgStorage::getBaseFilePath ( ) const
pure virtual

Returns path to the storage without extension.

Returns
path to the storage without extension

Implemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

virtual int Engine::MsgStorage::getInSeqNum ( )
inlinevirtual

Reimplemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

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

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

Implemented in Engine::B2B_SEALED< FileT >.

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

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

Implemented in Engine::B2B_SEALED< FileT >.

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

Return interface to the rejected storage, could be NULL.

Reimplemented in Engine::B2B_SEALED< FileT >.

virtual ::System::u64 Engine::MsgStorage::getSessionGlobalID ( ) const
inline
virtual bool Engine::MsgStorage::isPersistentStorage ( ) const
pure virtual

Return true if storage is persistent.

Implemented in Engine::B2B_SEALED< FileT >.

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

Checks if the storage is corrupted.

Returns
true if the storage contains corrupted messages, false otherwise

Implemented in Engine::B2B_SEALED< FileT >.

virtual bool Engine::MsgStorage::logLocal ( StorableMsg const *  pMsg,
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

Implemented in Engine::B2B_SEALED< FileT >.

virtual bool Engine::MsgStorage::logLocal ( StorableMsg const *  pMsg,
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

Implemented in Engine::B2B_SEALED< FileT >.

virtual void Engine::MsgStorage::logRemote ( StorableMsg const *  pMsg,
const std::string &  rawMsg 
)
pure virtual

Logs the message from the remote FIX engine.

Parameters
msgSeqNum- message number param rawMsg - message buffer

Implemented in Engine::B2B_SEALED< FileT >.

virtual void Engine::MsgStorage::logRemote ( StorableMsg const *  pMsg,
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

Implemented in Engine::B2B_SEALED< FileT >.

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

Closes the storage.

Implemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

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

Locates sent messages.

Parameters
cacheHolder- cache holder
protocolID- protocol ID
[out]apMsgs- fix message list
aBeginSeqNum- begin message number
aEndSeqNum- end message number
FIXVersion- FIX protocol version
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

Implemented in Engine::B2B_SEALED< FileT >.

virtual void Engine::MsgStorage::retrieveRemote ( ProtocolID  protocolID,
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
protocolID- unique protocol 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
virtual void Engine::MsgStorage::setBoolConfigInfo ( const std::string &  aKey,
bool  aValue 
)
pure virtual

Sets the configuration information.

Parameters
aKey- parameter key
aValue- parameter value

Implemented in Engine::B2B_SEALED< FileT >.

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

Implemented in Engine::B2B_SEALED< FileT >.

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

Sets the configuration information.

Parameters
aKey- parameter key
aValue- parameter value

Implemented in Engine::B2B_SEALED< FileT >.

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

Updates MsgSeqNum of outgoing messages.

Parameters
value- LastSentSeqNum value
virtual void Engine::MsgStorage::setMaxRemoteSeqNum ( int  msgSeqNum)
pure virtual

Sets the maximum MsgSeqNum of received messages.

Parameters
msgSeqNum- maximum MsgSeqNum value

Implemented in Engine::B2B_SEALED< FileT >.

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

Sets the minimum MsgSeqNum of sended messages.

Parameters
msgSeqNum- minimum MsgSeqNum value

Implemented in Engine::B2B_SEALED< FileT >.

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

Updates current MsgSeqNum of received messages.

Parameters
msgSeqNum- MsgSeqNum value

Implemented in Engine::B2B_SEALED< FileT >.

virtual void Engine::MsgStorage::syncMessageStorage ( )
pure virtual

Implemented in Engine::B2B_SEALED< FileT >.

Member Data Documentation

StorageType Engine::MsgStorage::currentConnectionType_
protected