Package com.illumon.iris.binarystore
Class RollingFileWriterBase<ExpirationType,ExtraType>
java.lang.Object
com.illumon.iris.binarystore.RollingFileWriterBase<ExpirationType,ExtraType>
- Type Parameters:
ExpirationType- the type of expiration object used by our expiration managerExtraType- the type of the extra object our child class users to construct the filename
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
RollingFileManagerBase
@InternalUseOnly
public abstract class RollingFileWriterBase<ExpirationType,ExtraType>
extends Object
implements Closeable
Base class for rolling files on a time interval. Extending classes will supply logic for naming files using the
expiration managers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Pathprotected final ExpirationManager<ExpirationType>protected final ByteBufferprotected FileChannel -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRollingFileWriterBase(@NotNull ByteBuffer header, @NotNull Path baseDir, @NotNull Clock clock, FileWriterConfig.ForceBehavior headerBehavior, FileWriterConfig.ForceBehavior closeBehavior, ExpirationManager<ExpirationType> expiration) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidforce(boolean metaData) protected FileChannelgetChannelNow(ExtraType extra) protected FileChannelinitChannel(long now, ExtraType extra) protected booleanprotected abstract StringmakeFilename(ExpirationType value, ExtraType extra) Construct the complete filename using the changing part passed in.protected FileChannelreopenChannel(ExtraType extra)
-
Field Details
-
headerBuffer
-
expiration
-
baseDir
-
writeChannel
-
-
Constructor Details
-
RollingFileWriterBase
protected RollingFileWriterBase(@NotNull @NotNull ByteBuffer header, @NotNull @NotNull Path baseDir, @NotNull @NotNull Clock clock, @NotNull FileWriterConfig.ForceBehavior headerBehavior, @NotNull FileWriterConfig.ForceBehavior closeBehavior, ExpirationManager<ExpirationType> expiration)
-
-
Method Details
-
getChannelNow
- Throws:
IOException
-
initChannel
- Throws:
IOException
-
reopenChannel
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
force
- Throws:
IOException
-
isChannelValid
protected boolean isChannelValid() -
makeFilename
Construct the complete filename using the changing part passed in.- Parameters:
value- the changing portion of the filename based on our expirationextra- the changing portion of the filename based on our caller- Returns:
- the filename, possibly combining other data with the value
-