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
FieldsFields inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
buffer, channelLength, channelPosition, dateFormattedBuffer, DELTA, maxBufferSize, maxStorageGrowSize, storageGrowSize, timestamp, timestampsInLogs, WRITE_BUFFER_LENGTH_DEFFields inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
accessFile, channel, configuration, isForcedFlush, maskedTags, NEW_LINE, storageTimestamp -
Constructor Summary
ConstructorsConstructorDescriptionIndexedMessageStorage(com.epam.fixengine.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendMessageIndexToFile(byte[] message, int offset, int length, long msgPos, long savedRecordLen) longappendMessageInternal(byte[] timestampFormatted, byte[] message, int offset, int length) longappendMessageInternal(long timestamp, byte[] message, int offset, int length) Appends message to storageprotected longappendMessageToFile(long timestamp, byte[] message, int offset, int length) protected voidbackupStorageFile(String fullPathToStorageFile, String fullPathToDestinationBackupFile) Backups storage file.voidclose()Close the storage.protected voiddeleteStorageFile(String fullPathToStorageFile) Deletes storage file.protected intprotected voidOpens the indexed file.protected byte[]readFromStorage(FileChannel readChannel, long readFrom, int msgLen) voidretrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) Retrieves message from storage.voidsetIndexFileExtension(String indexFileExtension) Deprecated.protected voidsetPrefixFormat(String prefixFormat) Deprecated.Methods inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
appendMessage, appendMessage, getNextSequenceNumber, isEnabledTimestamp, retrieveSequenceNumberMethods 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:
getFormatLengthin classAbstractFileMessageStorage
-
retrieveMessages
public void retrieveMessages(long from, long to, MessageStorageListener listener, boolean blocking) throws IOException Retrieves message from storage.- Specified by:
retrieveMessagesin interfaceMessageStorage- Overrides:
retrieveMessagesin 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:
openStorageFilein classFlatFileMessageStorage- Throws:
IOException- - if I/O errors occurred
-
close
Close the storage.- Specified by:
closein interfaceMessageStorage- Overrides:
closein classAbstractFileMessageStorage- Throws:
IOException- - if I/O error occurred
-
appendMessageInternal
public long appendMessageInternal(byte[] timestampFormatted, byte[] message, int offset, int length) throws IOException - Overrides:
appendMessageInternalin classFlatFileMessageStorage- Throws:
IOException
-
appendMessageInternal
public long appendMessageInternal(long timestamp, byte[] message, int offset, int length) throws IOException Description copied from class:FlatFileMessageStorageAppends message to storage- Overrides:
appendMessageInternalin 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:AbstractFileMessageStorageBackups storage file.- Overrides:
backupStorageFilein classAbstractFileMessageStorage- Parameters:
fullPathToStorageFile- the path to file of in/out filefullPathToDestinationBackupFile- the destination place to backup file- Throws:
IOException
-
deleteStorageFile
Description copied from class:AbstractFileMessageStorageDeletes storage file.- Overrides:
deleteStorageFilein classAbstractFileMessageStorage- Parameters:
fullPathToStorageFile- the path to in/out file
-