public class ArchiveMarkFile extends Object implements AutoCloseable
Archive in a directory to guard it.| Modifier and Type | Field and Description |
|---|---|
static String |
FILENAME
Name for the archive
MarkFile stored in the Archive.Configuration.ARCHIVE_DIR_PROP_NAME. |
static int |
HEADER_LENGTH
Header length for the
MarkFile containing the metadata. |
static int |
MAJOR_VERSION
Major version for the archive files stored on disk.
|
static int |
MINOR_VERSION
Minor version for the archive files stored on disk.
|
static int |
PATCH_VERSION
Patch version for the archive files stored on disk.
|
static int |
SEMANTIC_VERSION
Combined semantic version for the stored files.
|
| Constructor and Description |
|---|
ArchiveMarkFile(File directory,
String filename,
EpochClock epochClock,
long timeoutMs,
Consumer<String> logger)
Construct the
MarkFile based on an existing directory containing a mark file of a running archive. |
ArchiveMarkFile(File directory,
String filename,
EpochClock epochClock,
long timeoutMs,
IntConsumer versionCheck,
Consumer<String> logger)
Open an existing
MarkFile or create a new one to be used in migration. |
| Modifier and Type | Method and Description |
|---|---|
long |
activityTimestampVolatile()
Read the activity timestamp of the archive with volatile semantics.
|
void |
close() |
MarkFileHeaderDecoder |
decoder()
The decoder for reading the
MarkFile header. |
MarkFileHeaderEncoder |
encoder()
The encoder for writing the
MarkFile header. |
AtomicBuffer |
errorBuffer()
The direct buffer which wraps the region of the
MarkFile which contains the error log. |
static void |
saveExistingErrors(File markFile,
AtomicBuffer errorBuffer,
PrintStream logger)
Save the existing errors from a
MarkFile to a PrintStream for logging. |
void |
signalReady()
Signal the archive has concluded successfully and ready to start.
|
void |
updateActivityTimestamp(long nowMs)
Update the activity timestamp as a proof of life.
|
public static final int MAJOR_VERSION
public static final int MINOR_VERSION
public static final int PATCH_VERSION
public static final int SEMANTIC_VERSION
SemanticVersionpublic static final int HEADER_LENGTH
MarkFile containing the metadata.public static final String FILENAME
MarkFile stored in the Archive.Configuration.ARCHIVE_DIR_PROP_NAME.public ArchiveMarkFile(File directory, String filename, EpochClock epochClock, long timeoutMs, Consumer<String> logger)
MarkFile based on an existing directory containing a mark file of a running archive.directory - containing the archive files.filename - for the mark file.epochClock - to be used for checking liveness.timeoutMs - after which the opening will be aborted if no archive starts.logger - to detail any discoveries.public ArchiveMarkFile(File directory, String filename, EpochClock epochClock, long timeoutMs, IntConsumer versionCheck, Consumer<String> logger)
MarkFile or create a new one to be used in migration.directory - containing the archive files.filename - for the mark file.epochClock - to be used for checking liveness.timeoutMs - after which the opening will be aborted if no archive starts.versionCheck - for confirming the correct version.logger - to detail any discoveries.public void close()
close in interface AutoCloseablepublic void signalReady()
public void updateActivityTimestamp(long nowMs)
nowMs - activity timestamp as a proof of life.public long activityTimestampVolatile()
public MarkFileHeaderEncoder encoder()
MarkFile header.MarkFile header.public MarkFileHeaderDecoder decoder()
MarkFile header.MarkFile header.public AtomicBuffer errorBuffer()
MarkFile which contains the error log.MarkFile which contains the error log.public static void saveExistingErrors(File markFile, AtomicBuffer errorBuffer, PrintStream logger)
MarkFile to a PrintStream for logging.markFile - which contains the error buffer.errorBuffer - which wraps the error log.logger - to which the existing errors will be printed.Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.