Package com.illumon.iris.binarystore
Class RollingFileManagerBase
java.lang.Object
com.illumon.iris.binarystore.RollingFileManagerBase
- All Implemented Interfaces:
ChannelManager
,ChannelManagerStandard
- Direct Known Subclasses:
RollingFileManager
,RollingFileManagerWithDateColumnPartition
,RollingFileManagerWithSpecifiedColumnPartition
public abstract class RollingFileManagerBase extends Object implements ChannelManagerStandard
Base class for rolling files on a time interval.
Extending classes will supply logic for naming files using the expiration managers.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RollingFileManagerBase.ExistingFilePolicy
Allow different behaviors when an existing output file is seen. -
Field Summary
Fields Modifier and Type Field Description protected File
baseDir
protected RollingFileManagerBase.ExistingFilePolicy
existingFilePolicy
protected ExpirationManager<String>
expiration
protected static boolean
FORCE_BEFORE_CLOSE
protected ByteBuffer
headerBuffer
protected com.fishlib.io.logger.Logger
log
protected FileChannel
writeChannel
-
Method Summary
Modifier and Type Method Description void
close()
Close this ChannelManager.void
flush()
Flush this ChannelManager.FileChannel
getChannel()
For ChannelManager implementations that don't support dynamic column partition determination, the channel is based on pre-determined criteria.protected FileChannel
initChannel(long now)
protected boolean
isChannelValid()
protected String
makeFilename(String value)
Construct the complete filename using the changing part passed in.protected FileChannel
reopenChannel()
protected void
writeHeader()
Write the binary file header to a new file.
-
Field Details
-
FORCE_BEFORE_CLOSE
protected static final boolean FORCE_BEFORE_CLOSE -
log
protected final com.fishlib.io.logger.Logger log -
headerBuffer
-
existingFilePolicy
-
expiration
-
baseDir
-
writeChannel
-
-
Method Details
-
getChannel
Description copied from interface:ChannelManagerStandard
For ChannelManager implementations that don't support dynamic column partition determination, the channel is based on pre-determined criteria. The channel may still change, but not dynamically based on data that the ChannelManager user determines.- Specified by:
getChannel
in interfaceChannelManagerStandard
- Returns:
- a non-null, open
GatheringByteChannel
- Throws:
IOException
- if the call encounters an error
-
initChannel
- Throws:
IOException
-
reopenChannel
- Throws:
IOException
-
close
Description copied from interface:ChannelManager
Close this ChannelManager. If the implementation supports multiple channels, an attempt will be made to close all channels. If an IOException occurs on one or more channels, the first one will be rethrown, but the operation will still be attempted on all remaining channels. If an exception occurs that is not an IOException, that exception will be thrown and operations on remaining channels may not be attempted.- Specified by:
close
in interfaceChannelManager
- Throws:
IOException
- from the close operations
-
flush
Description copied from interface:ChannelManager
Flush this ChannelManager. If the implementation supports multiple channels, all channels will be flushed. If an IOException occurs on one or more channels, the first one will be rethrown, but the operation will still be attempted on all remaining channels. If an exception occurs that is not an IOException, that exception will be thrown and operations on remaining channels may not be attempted.- Specified by:
flush
in interfaceChannelManager
- Throws:
IOException
- from the close operations
-
isChannelValid
protected boolean isChannelValid() -
writeHeader
Write the binary file header to a new file.- Throws:
IOException
-
makeFilename
Construct the complete filename using the changing part passed in.- Parameters:
value
- the changing portion of the filename- Returns:
- the filename, possibly combining other data with the value
-