Class AbstractFileMessageStorage
Abstract file storage implementation. The base functionality of this class.
Inheritance
Inherited Members
Namespace: FixAntenna.FixEngine.Storage.File
Assembly: FixAntenna.Core.dll
Syntax
public abstract class AbstractFileMessageStorage : IMessageStorage, IDisposable
Constructors
AbstractFileMessageStorage(Config)
Declaration
public AbstractFileMessageStorage(Config configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| Config | configuration |
Fields
AccessFile
Declaration
protected FileStream AccessFile
Field Value
| Type | Description |
|---|---|
| System.IO.FileStream |
Configuration
Declaration
protected Config Configuration
Field Value
| Type | Description |
|---|---|
| Config |
Disposed
Declaration
protected volatile bool Disposed
Field Value
| Type | Description |
|---|---|
| System.Boolean |
FormatLength
Declaration
protected int FormatLength
Field Value
| Type | Description |
|---|---|
| System.Int32 |
StorageTimestamp
Declaration
protected IStorageTimestamp StorageTimestamp
Field Value
| Type | Description |
|---|---|
| IStorageTimestamp |
Methods
AppendMessage(Byte[])
Appends message to storage.
Declaration
public virtual void AppendMessage(byte[] message)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | message | the message |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
AppendMessage(Byte[], Byte[])
Appends message to storage with the given formatted timestampFormatted.
Declaration
public virtual void AppendMessage(byte[] timestampFormatted, byte[] message)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | timestampFormatted | the message timestampFormatted |
| System.Byte[] | message | the message |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
AppendMessage(Byte[], Byte[], Int32, Int32)
Appends message to storage with the given formatted timestamp.
Declaration
public virtual void AppendMessage(byte[] timestampFormatted, byte[] message, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | timestampFormatted | the message timestamp |
| System.Byte[] | message | the message |
| System.Int32 | offset | the initial offset |
| System.Int32 | length | the length |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
AppendMessage(Byte[], Int32, Int32)
Appends message to storage.
Declaration
public virtual void AppendMessage(byte[] message, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | message | the message |
| System.Int32 | offset | the initial offset |
| System.Int32 | length | the length |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
AppendMessageInternal(Int64, Byte[], Int32, Int32)
Appends message to storage
Declaration
protected abstract long AppendMessageInternal(long ticks, byte[] message, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | ticks | the timestamp parameter |
| System.Byte[] | message | the array of bytes |
| System.Int32 | offset | |
| System.Int32 | length |
Returns
| Type | Description |
|---|---|
| System.Int64 |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if I/O error occurred |
BackupFile(String, String)
Declaration
public virtual void BackupFile(string fullPathToStorageFile, string fullPathToDestinationBackupFile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fullPathToStorageFile | |
| System.String | fullPathToDestinationBackupFile |
BackupStorage(SessionParameters)
Backup the storage.
Declaration
public virtual void BackupStorage(SessionParameters sessionParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| SessionParameters | sessionParameters | the session parameters |
BackupStorageFile(String, String)
Backups storage file.
Declaration
public virtual void BackupStorageFile(string fullPathToStorageFile, string fullPathToDestinationBackupFile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fullPathToStorageFile | the path to file of in/out file |
| System.String | fullPathToDestinationBackupFile | the destination place to backup file |
CalculateFormatLength()
This method is used to calculate FormatLength. Override it to change how FormatLength is calculated.
Declaration
protected virtual int CalculateFormatLength()
Returns
| Type | Description |
|---|---|
| System.Int32 |
Close()
Close the storage.
Declaration
public virtual void Close()
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
DeleteFile(String)
Declaration
public virtual void DeleteFile(string fullPathToStorageFile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fullPathToStorageFile |
DeleteStorageFile(String)
Deletes storage file.
Declaration
public virtual void DeleteStorageFile(string fullPathToStorageFile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fullPathToStorageFile | the path to in/out file |
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing |
GetFile()
Gets the file.
Declaration
public virtual string GetFile()
Returns
| Type | Description |
|---|---|
| System.String |
GetNextSequenceNumber()
Gets next sequence number.
Declaration
public abstract long GetNextSequenceNumber()
Returns
| Type | Description |
|---|---|
| System.Int64 |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if I/O error occurred |
GetPrefixFormat(Int64)
Declaration
public virtual byte[] GetPrefixFormat(long ticks)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | ticks |
Returns
| Type | Description |
|---|---|
| System.Byte[] |
Initialize()
Initialize the storage.
This method should be called before file storage is used.
Storage file and some variable (like FormatLength) are initialized in it.
Declaration
public virtual long Initialize()
Returns
| Type | Description |
|---|---|
| System.Int64 | the last sequence number |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if I/O error occurred |
Initialized()
Declaration
public virtual bool Initialized()
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsClosed()
Returns true if storage is closed.
Declaration
public virtual bool IsClosed()
Returns
| Type | Description |
|---|---|
| System.Boolean |
NotifyListener(IMessageStorageListener, Boolean, Byte[])
Declaration
protected void NotifyListener(IMessageStorageListener listener, bool blocking, byte[] message)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessageStorageListener | listener | |
| System.Boolean | blocking | |
| System.Byte[] | message |
OpenStorage()
Declaration
public virtual void OpenStorage()
OpenStorageFile()
Declaration
public virtual void OpenStorageFile()
RetrieveMessage(Int64)
Retrieves message from storage.
Declaration
public virtual byte[] RetrieveMessage(long num)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | num |
Returns
| Type | Description |
|---|---|
| System.Byte[] | the retrieved message |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
RetrieveMessages(Int64, Int64, IMessageStorageListener, Boolean)
Retrieves message from storage.
Declaration
public virtual void RetrieveMessages(long from, long to, IMessageStorageListener listener, bool blocking)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | from | |
| System.Int64 | to | |
| IMessageStorageListener | listener | the callback listener |
| System.Boolean | blocking | if parameter is true, the execution start in current thread context, otherwise in the new thread context. |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if error occurred. |
RetrieveMessagesImplementation(Int64, Int64, IMessageStorageListener, Boolean)
Declaration
protected abstract void RetrieveMessagesImplementation(long from, long to, IMessageStorageListener listener, bool blocking)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | from | |
| System.Int64 | to | |
| IMessageStorageListener | listener | |
| System.Boolean | blocking |
SetBackupFileLocator(ILogFileLocator)
Declaration
public virtual void SetBackupFileLocator(ILogFileLocator fileLocator)
Parameters
| Type | Name | Description |
|---|---|---|
| ILogFileLocator | fileLocator |
SetFile(String)
Sets the file.
Declaration
public virtual void SetFile(string file)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | file | the file |
VerifyNotDisposed()
Declaration
protected void VerifyNotDisposed()