Package com.epam.fixengine.storage.file
Class IndexedMessageStorage
java.lang.Object
com.epam.fixengine.storage.file.AbstractFileMessageStorage
com.epam.fixengine.storage.file.FlatFileMessageStorage
com.epam.fixengine.storage.file.IndexedMessageStorage
- All Implemented Interfaces:
MessageStorage
Indexed message storage implementation.
- See Also:
-
Field Summary
Fields inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
buffer, channelLength, channelPosition, dateFormattedBuffer, DELTA, maxBufferSize, maxStorageGrowSize, storageGrowSize, timestamp, timestampsInLogs, WRITE_BUFFER_LENGTH_DEF
Fields inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
accessFile, channel, configuration, isForcedFlush, maskedTags, NEW_LINE, storageTimestamp
-
Constructor Summary
ConstructorDescriptionIndexedMessageStorage
(com.epam.fixengine.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendMessageIndexToFile
(byte[] message, int offset, int length, long msgPos, long savedRecordLen) long
appendMessageInternal
(byte[] timestampFormatted, byte[] message, int offset, int length) long
appendMessageInternal
(long timestamp, byte[] message, int offset, int length) Appends message to storageprotected long
appendMessageToFile
(long timestamp, byte[] message, int offset, int length) protected void
backupStorageFile
(String fullPathToStorageFile, String fullPathToDestinationBackupFile) Backups storage file.void
close()
Close the storage.protected void
deleteStorageFile
(String fullPathToStorageFile) Deletes storage file.protected int
protected void
Opens the indexed file.protected byte[]
readFromStorage
(FileChannel readChannel, long readFrom, int msgLen) void
retrieveMessages
(long from, long to, MessageStorageListener listener, boolean blocking) Retrieves message from storage.void
setIndexFileExtension
(String indexFileExtension) Deprecated.protected void
setPrefixFormat
(String prefixFormat) Deprecated.Methods inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
appendMessage, appendMessage, getNextSequenceNumber, isEnabledTimestamp, retrieveSequenceNumber
Methods inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, deleteFile, getFile, getPrefixFormat, initialize, initialized, isClosed, openStorage, retrieveMessage, setBackupFileLocator, setFile, setFileLocator
-
Field Details
-
DEFAULT_EXT
- See Also:
-
-
Constructor Details
-
IndexedMessageStorage
public IndexedMessageStorage(com.epam.fixengine.configuration.Configuration config)
-
-
Method Details
-
setIndexFileExtension
Deprecated. -
setPrefixFormat
Deprecated. -
getFormatLength
protected int getFormatLength()- Overrides:
getFormatLength
in classAbstractFileMessageStorage
-
retrieveMessages
public void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) throws IOException Retrieves message from storage.- Specified by:
retrieveMessages
in interfaceMessageStorage
- Overrides:
retrieveMessages
in classFlatFileMessageStorage
- Parameters:
from
- the start sequence positionto
- the end sequence positionlistener
- the callback listenerblocking
- if sets to true the method call not blocking- Throws:
IOException
- - Message retrieval is not possible for flat files- See Also:
-
readFromStorage
protected byte[] readFromStorage(FileChannel readChannel, long readFrom, int msgLen) throws IOException - Throws:
IOException
-
openStorageFile
Opens the indexed file.- Overrides:
openStorageFile
in classFlatFileMessageStorage
- Throws:
IOException
- - if I/O errors occurred
-
close
Close the storage.- Specified by:
close
in interfaceMessageStorage
- Overrides:
close
in classAbstractFileMessageStorage
- Throws:
IOException
- - if I/O error occurred
-
appendMessageInternal
public long appendMessageInternal(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException - Overrides:
appendMessageInternal
in classFlatFileMessageStorage
- Throws:
IOException
-
appendMessageInternal
public long appendMessageInternal(long timestamp, byte[] message, int offset, int length) throws IOException Description copied from class:FlatFileMessageStorage
Appends message to storage- Overrides:
appendMessageInternal
in classFlatFileMessageStorage
- Parameters:
timestamp
- the timestamp parametermessage
- the array of bytes- Throws:
IOException
- - if I/O error occurred- See Also:
-
appendMessageIndexToFile
protected void appendMessageIndexToFile(byte[] message, int offset, int length, long msgPos, long savedRecordLen) throws IOException - Throws:
IOException
-
appendMessageToFile
protected long appendMessageToFile(long timestamp, byte[] message, int offset, int length) throws IOException - Throws:
IOException
-
backupStorageFile
protected void backupStorageFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile) throws IOException Description copied from class:AbstractFileMessageStorage
Backups storage file.- Overrides:
backupStorageFile
in classAbstractFileMessageStorage
- Parameters:
fullPathToStorageFile
- the path to file of in/out filefullPathToDestinationBackupFile
- the destination place to backup file- Throws:
IOException
-
deleteStorageFile
Description copied from class:AbstractFileMessageStorage
Deletes storage file.- Overrides:
deleteStorageFile
in classAbstractFileMessageStorage
- Parameters:
fullPathToStorageFile
- the path to in/out file
-