B2BITS FIX Antenna C++ 2.32.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Engine::StorageMgr Class Referenceabstract

Manages MsgStorages. More...

#include <B2BITS_StorageMgr.h>

Classes

struct  PersistentSessionInfo
 Information about the persistent session. More...
 

Public Types

typedef std::list< PersistentSessionInfoIncompleteSessionsInfo
 Information about the persistent sessions that were non-gracefully terminated.
 

Public Member Functions

virtual MsgStoragecreate (const SessionId &sessionId, FIXVersion version, int outgoingStorageSize, Session::ActiveConnection type=Session::PRIMARY_CONNECTION, const std::string &location="", const std::string &baseFilePath="", unsigned char tagsDelimiter='\x01')=0
 Creates new MsgStorage object at subFolder.
 
virtual MsgStoragecreate (const std::string &sender, const std::string &target, FIXVersion version, int outgoingStorageSize, Session::ActiveConnection type=Session::PRIMARY_CONNECTION, const std::string &location="", const std::string &baseFilePath="", unsigned char tagsDelimiter='\x01')=0
 Creates new MsgStorage object at subFolder.
 
virtual MsgStoragecreate (PersistentSessionInfo *info, int outgoingStorageSize)=0
 Creates new MsgStorage object.
 
virtual bool existStorage (const SessionId &sessionId, const std::string &primLocation, const std::string &backupLocation, bool *reuse)=0
 Search for the session's storage and read it.
 
virtual bool existStorage (const std::string &sender, const std::string &target, const std::string &primLocation, const std::string &backupLocation, bool *reuse)=0
 Loads information about sessions that were terminated non-gracefully.
 
virtual bool isPersistent () const =0
 Returns true if storage is persistent; false otherwise.
 
virtual bool load (const SessionId &sessionId, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)=0
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const SessionId &sessionId, FIXVersion version, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)=0
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const SessionId &sessionId, FIXVersion version, Session::ActiveConnection type, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const std::string &baseFilePath, PersistentSessionInfo *info)=0
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const std::string &sender, const std::string &target, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)=0
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const std::string &sender, const std::string &target, FIXVersion version, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)=0
 Loads information about the session that was terminated non-gracefully.
 
virtual bool load (const std::string &sender, const std::string &target, FIXVersion version, Session::ActiveConnection type, const std::string &primLocation, const std::string &backupLocation, PersistentSessionInfo *info)
 Loads information about the session that was terminated non-gracefully.
 
virtual MessageStorageType type () const =0
 Return storage type.
 
virtual ~StorageMgr ()
 This destructor is implemented by StorageMgr and used by StorageMgr.
 

Static Public Member Functions

static void destroy ()
 Destroys the instance.
 
static void init ()
 Register built-in storage managers.
 
static bool const isStorageManagerRegistered (std::string const &name)
 Check if the specified storage already registered.
 
static void registerCustomStorage (StorageMgr *)
 Register storage manager named "custom".
 
static void registerStorageManager (std::string const &sname, StorageMgr *storageManager)
 Add new storage manager.
 
static StorageMgrsingleton (const MessageStorageType type)
 Returns the pointer to the instance of StorageMgr.
 
static StorageMgrsingleton (std::string const &type)
 Returns the pointer to the instance of StorageMgr.
 
static std::vector< std::string > conststorageManagersNames ()
 Get the list of the registered storages.
 
static std::size_t totalStorageManagers ()
 Get the number of registered storages.
 

Protected Member Functions

 StorageMgr ()
 

Detailed Description

Manages MsgStorages.

Member Typedef Documentation

◆ IncompleteSessionsInfo

Information about the persistent sessions that were non-gracefully terminated.

Constructor & Destructor Documentation

◆ ~StorageMgr()

virtual Engine::StorageMgr::~StorageMgr ( )
virtual

This destructor is implemented by StorageMgr and used by StorageMgr.

This destructor of StorageMgr implementation is used by "central" StorageMgr registry to deallocate resources previously acquired.

◆ StorageMgr()

Engine::StorageMgr::StorageMgr ( )
protected

Member Function Documentation

◆ create() [1/3]

virtual MsgStorage * Engine::StorageMgr::create ( const SessionId & sessionId,
FIXVersion version,
int outgoingStorageSize,
Session::ActiveConnection type = Session::PRIMARY_CONNECTION,
const std::string & location = "",
const std::string & baseFilePath = "",
unsigned char tagsDelimiter = '\x01' )
pure virtual

Creates new MsgStorage object at subFolder.

Parameters
sessionId- session identifier
version- session's version
outgoingStorageSize- Specifies size of the transient message storage
type- connection type of the storage to create
location- path to the folder where files have to be created. When empty - files will be created in the default folder.
baseFilePathPath to the storage without etension. if empty, path will be calculated based on sender, target and engine log directory parameters.
tagsDelimiter- tags delimiter symbol default value is SOH (0x01)
Returns
new MsgStorage object

◆ create() [2/3]

virtual MsgStorage * Engine::StorageMgr::create ( const std::string & sender,
const std::string & target,
FIXVersion version,
int outgoingStorageSize,
Session::ActiveConnection type = Session::PRIMARY_CONNECTION,
const std::string & location = "",
const std::string & baseFilePath = "",
unsigned char tagsDelimiter = '\x01' )
pure virtual

Creates new MsgStorage object at subFolder.

Parameters
sender- session sender
target- session target
version- session's version
outgoingStorageSize- Specifies size of the transient message storage
type- connection type of the storage to create
location- path to the folder where files have to be created. When empty - files will be created in the default folder.
baseFilePathPath to the storage without extension. if empty, path will be calculated based on sender, target and engine log directory parameters.
tagsDelimiter- tags delimiter symbol default value is SOH (0x01)
Returns
new MsgStorage object

◆ create() [3/3]

virtual MsgStorage * Engine::StorageMgr::create ( PersistentSessionInfo * info,
int outgoingStorageSize )
pure virtual

Creates new MsgStorage object.

Parameters
info- information about the persistent session
outgoingStorageSize- Specifies size of the transient message storage
Returns
new MsgStorage object

◆ destroy()

static void Engine::StorageMgr::destroy ( )
static

Destroys the instance.

Deallocate resources taken by registered instances of StorageMgr.

Warning
This function is not thread safe.

◆ existStorage() [1/2]

virtual bool Engine::StorageMgr::existStorage ( const SessionId & sessionId,
const std::string & primLocation,
const std::string & backupLocation,
bool * reuse )
pure virtual

Search for the session's storage and read it.

Parameters
sessionId- session identifier
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
Returns
'true' if the information was found, otherwise - false.

◆ existStorage() [2/2]

virtual bool Engine::StorageMgr::existStorage ( const std::string & sender,
const std::string & target,
const std::string & primLocation,
const std::string & backupLocation,
bool * reuse )
pure virtual

Loads information about sessions that were terminated non-gracefully.

Returns
the number of found sessions. Search for the session's storage and read it.
Parameters
sender- session's sender name
target- session's target name
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
Returns
'true' if the information was found, otherwise - false.

◆ init()

static void Engine::StorageMgr::init ( )
static

Register built-in storage managers.

FIX Antenna have the number of built-in storages like: persistent, transient, persistentMM, splitPersistent and null. This function performs initialization of storage register and registers all compiled-in storage managers.

Warning
This function is not thread safe.

◆ isPersistent()

virtual bool Engine::StorageMgr::isPersistent ( ) const
pure virtual

Returns true if storage is persistent; false otherwise.

◆ isStorageManagerRegistered()

static bool const Engine::StorageMgr::isStorageManagerRegistered ( std::string const & name)
static

Check if the specified storage already registered.

Warning
This function is not thread safe.
Parameters
[in]nameStorage identifier.
Returns
true if the name of the storage is already registered and false if the name is not registered.

◆ load() [1/7]

virtual bool Engine::StorageMgr::load ( const SessionId & sessionId,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
pure virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sessionId- session identifier
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [2/7]

virtual bool Engine::StorageMgr::load ( const SessionId & sessionId,
FIXVersion version,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
pure virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sessionId- session identifier
version- fix protocol version
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [3/7]

virtual bool Engine::StorageMgr::load ( const SessionId & sessionId,
FIXVersion version,
Session::ActiveConnection type,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sessionId- session identifier
version- fix protocol version
type- active connection type
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [4/7]

virtual bool Engine::StorageMgr::load ( const std::string & baseFilePath,
PersistentSessionInfo * info )
pure virtual

Loads information about the session that was terminated non-gracefully.

Parameters
baseFilePathPath to the storage without etension
info- information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [5/7]

virtual bool Engine::StorageMgr::load ( const std::string & sender,
const std::string & target,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
pure virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sender- session's sender name
target- session's target name
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [6/7]

virtual bool Engine::StorageMgr::load ( const std::string & sender,
const std::string & target,
FIXVersion version,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
pure virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sender- session's sender name
target- session's target name
version- fix protocol version
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ load() [7/7]

virtual bool Engine::StorageMgr::load ( const std::string & sender,
const std::string & target,
FIXVersion version,
Session::ActiveConnection type,
const std::string & primLocation,
const std::string & backupLocation,
PersistentSessionInfo * info )
virtual

Loads information about the session that was terminated non-gracefully.

Parameters
sender- session's sender name
target- session's target name
version- fix protocol version
type- active connection type
primLocation- path to session logs for primary connection
backupLocation- path to session logs for backup connection
info- Information about the persistent session
Returns
'true' if the information was found, otherwise - false.

◆ registerCustomStorage()

static void Engine::StorageMgr::registerCustomStorage ( StorageMgr * )
static

Register storage manager named "custom".

This function acquires ownership on the pointer to the storage manager.

Exceptions
Utils::ExceptionWhen the instance of custom storage manager is already registered.
Warning
This function is not thread safe.
Parameters
[in]Pointerto the StorageMgr object.

◆ registerStorageManager()

static void Engine::StorageMgr::registerStorageManager ( std::string const & sname,
StorageMgr * storageManager )
static

Add new storage manager.

This function acquires ownership on the pointer to the storage manager.

Exceptions
Utils::ExceptionWhen the manager with the specified name is already registered.
Warning
This function is not thread safe.
Parameters
[in]snameString identifier of the storage.
[in]storageManagerPointer to the storage instance.

◆ singleton() [1/2]

static StorageMgr * Engine::StorageMgr::singleton ( const MessageStorageType type)
static

Returns the pointer to the instance of StorageMgr.

Exceptions
Utils::ExceptionWhen the specified storage name is not registered yet.
Warning
This function is not thread safe.

◆ singleton() [2/2]

static StorageMgr * Engine::StorageMgr::singleton ( std::string const & type)
static

Returns the pointer to the instance of StorageMgr.

Exceptions
Utils::ExceptionWhen the specified storage name is not registered yet.
Warning
This function is not thread safe.

◆ storageManagersNames()

static std::vector< std::string > const & Engine::StorageMgr::storageManagersNames ( )
static

Get the list of the registered storages.

The vector contains names of storages in the order of their registration so it's possible to determine the index of the storage in the registry.

Warning
This function is not thread safe.

◆ totalStorageManagers()

static std::size_t Engine::StorageMgr::totalStorageManagers ( )
static

Get the number of registered storages.

Warning
This function can't be accessed during static initialization. Otherwise you'll get an undefined behavior. This function is not thread safe.
Returns
std::size_t Number of actually registered torages.

◆ type()

virtual MessageStorageType Engine::StorageMgr::type ( ) const
pure virtual

Return storage type.