File-Based Session Storage keeps incoming and outgoing messages and session's state data in files in the OnixS::CME::iLink3::SessionSettings::storageDirectory folder.
For each iLink 3 session the following files are created:
SESSION_NAME.statecontains session state data (OnixS::CME::iLink3::Session::uuid, OnixS::CME::iLink3::Session::negotiated, OnixS::CME::iLink3::Session::inSeqNum, OnixS::CME::iLink3::Session::outSeqNum, OnixS::CME::iLink3::Session::previousSeqNo, OnixS::CME::iLink3::Session::previousUuid, etc.).
SESSION_NAME.summarycontains Base64 encoded binary SBE messages. To decode these messages, use the "SbeLogDecoder" sample from the Handler distribution package.
SESSION_NAME is formed on the base of OnixS::CME::iLink3::Session::id, OnixS::CME::iLink3::SessionSettings::firmId,
MarketSegmentId and a timestamp. It is available via the OnixS::CME::iLink3::Session::storageId method.
Sometimes it is needed to save space on disk, and there is no need to keep the whole history of incoming and outgoing messages. File-Based Storage could be configured to store messages in a set of
.summary files, instead of a single one. The entire collection of logged messages is split through several files called "segments", and older segments could be archived.
The Segmented mode of the File-based Storage is activated when the OnixS::CME::iLink3::SessionSettings::fileBasedStorageSegmentSize(Messaging::UInt64 value) is set to a positive value.
Segments are named as
StorageID- the generic ID of storage (available via the OnixS::CME::iLink3::Session::storageId method);
-part-N- the segment suffix. The
Nis the 1-based number of segments. One segment does not have this suffix - it is the segment where the newest messages are stored.
During the session lifetime, new segment files are created per the following algorithm:
StorageID.summaryfile size is compared to the SessionSettings::fileBasedStorageSegmentSize value, and if the actual file size exceeds this value, a new segment is created;
StorageID-part-N.summaryand creates a new empty
StorageID.summaryfile to store subsequent messages. The
Nis a sequential number of parts starting from
So during a long session, a set of files could be created:
StorageID-part-2.summary, etc. . Oldest messages are stored in the
StorageID-part-1.summary file, and newer ones - in the
StorageID-part-N.summary files, where
N is the maximum value.
The number of segments is recorded in the
StorageID.state file after the
FilePartCount key. For instance, if there are
5 segments, (
StorageID-part-1.summary, ... ,
StorageID-part-4.summary) the following line will be stored in the