Package com.epam.fixengine.storage.file
Class SlicedIndexedMessageStorage
java.lang.Object
com.epam.fixengine.storage.file.AbstractFileMessageStorage
com.epam.fixengine.storage.file.FlatFileMessageStorage
com.epam.fixengine.storage.file.SlicedFileMessageStorage
com.epam.fixengine.storage.file.SlicedIndexedMessageStorage
- All Implemented Interfaces:
MessageStorage
-
Field Summary
FieldsFields inherited from class com.epam.fixengine.storage.file.SlicedFileMessageStorage
fileManager, maxFileSize
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
ConstructorsConstructorDescriptionSlicedIndexedMessageStorage
(com.epam.fixengine.configuration.Configuration config) -
Method Summary
Modifier and TypeMethodDescriptionlong
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 String
protected long
Gets next sequence number.protected void
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.SlicedFileMessageStorage
getMaxFileSize, initialize, setFile, setMaxFileSize
Methods inherited from class com.epam.fixengine.storage.file.FlatFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, isEnabledTimestamp, retrieveSequenceNumber
Methods inherited from class com.epam.fixengine.storage.file.AbstractFileMessageStorage
appendMessage, appendMessage, appendMessageInternal, backupFile, backupStorage, deleteFile, getFile, getPrefixFormat, initialized, isClosed, openStorage, retrieveMessage, setBackupFileLocator, setFileLocator
-
Field Details
-
DEFAULT_EXT
- See Also:
-
-
Constructor Details
-
SlicedIndexedMessageStorage
public SlicedIndexedMessageStorage(com.epam.fixengine.configuration.Configuration config)
-
-
Method Details
-
setIndexFileExtension
Deprecated. -
setPrefixFormat
Deprecated. -
openStorageFile
Opens the indexed file.- Overrides:
openStorageFile
in classFlatFileMessageStorage
- Throws:
IOException
- - if I/O errors occurred
-
getIndexFileName
-
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
-
close
Close the storage.- Specified by:
close
in interfaceMessageStorage
- Overrides:
close
in classAbstractFileMessageStorage
- Throws:
IOException
- - if I/O error occurred
-
getNextSequenceNumber
Description copied from class:AbstractFileMessageStorage
Gets next sequence number.- Overrides:
getNextSequenceNumber
in classFlatFileMessageStorage
- Throws:
IOException
- - if I/O error occurred- See Also:
-
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 classSlicedFileMessageStorage
- Parameters:
timestamp
- the timestamp parametermessage
- the array of bytes- Throws:
IOException
- - if I/O error occurred- See Also:
-
nextChunk
- Overrides:
nextChunk
in classSlicedFileMessageStorage
- 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 classSlicedFileMessageStorage
- 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 classSlicedFileMessageStorage
- Parameters:
fullPathToStorageFile
- the path to in/out file
-