public final class ClusterMarkFile extends Object implements AutoCloseable
DistinctErrorLog.| Modifier and Type | Field and Description |
|---|---|
static String |
FILE_EXTENSION |
static String |
FILENAME |
static int |
HEADER_LENGTH |
static int |
MAJOR_VERSION |
static int |
MINOR_VERSION |
static int |
PATCH_VERSION |
static int |
SEMANTIC_VERSION |
static String |
SERVICE_FILENAME_PREFIX |
static int |
VERSION_FAILED |
| Constructor and Description |
|---|
ClusterMarkFile(File file,
ClusterComponentType type,
int errorBufferLength,
EpochClock epochClock,
long timeoutMs)
Create new
MarkFile for a cluster service but check if an existing service is active. |
ClusterMarkFile(File directory,
String filename,
EpochClock epochClock,
long timeoutMs,
Consumer<String> logger)
Construct to read the status of an existing
MarkFile for a cluster component. |
| Modifier and Type | Method and Description |
|---|---|
long |
activityTimestampVolatile()
Read the activity timestamp of the cluster component with volatile semantics.
|
long |
candidateTermId()
Get the current value of a candidate term id if a vote is placed in an election.
|
void |
candidateTermId(long candidateTermId,
int fileSyncLevel)
Record the fact that a node has voted in a current election for a candidate so it can survive a restart.
|
static void |
checkHeaderLength(String aeronDirectory,
String controlChannel,
String ingressChannel,
String serviceName,
String authenticator)
Check if the header length is sufficient for encoding the provided properties.
|
void |
close() |
int |
clusterId()
Identity of the cluster instance so multiple clusters can run on the same driver.
|
void |
clusterId(int clusterId)
Identity of the cluster instance so multiple clusters can run on the same driver.
|
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. |
ClusterNodeControlProperties |
loadControlProperties()
The control properties for communicating between the consensus module and the services.
|
static String |
markFilenameForService(int serviceId)
The filename to be used for the mark file given a service id.
|
int |
memberId()
Cluster member id either assigned statically or as the result of dynamic membership join.
|
void |
memberId(int memberId)
Member id assigned as part of dynamic join of a cluster.
|
static void |
saveExistingErrors(File markFile,
AtomicBuffer errorBuffer,
PrintStream logger)
Save the existing errors from a
MarkFile to a PrintStream for logging. |
void |
signalFailedStart()
Signal the cluster component has failed to conclude and cannot start.
|
void |
signalReady()
Signal the cluster component 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
public static final int HEADER_LENGTH
public static final int VERSION_FAILED
public static final String FILE_EXTENSION
public static final String FILENAME
public static final String SERVICE_FILENAME_PREFIX
public ClusterMarkFile(File file, ClusterComponentType type, int errorBufferLength, EpochClock epochClock, long timeoutMs)
MarkFile for a cluster service but check if an existing service is active.public ClusterMarkFile(File directory, String filename, EpochClock epochClock, long timeoutMs, Consumer<String> logger)
MarkFile for a cluster component.directory - in which the mark file exists.filename - for the MarkFile.epochClock - to be used for checking liveness.timeoutMs - to wait for file to exist.logger - to which debug information will be written if an issue occurs.public void close()
close in interface AutoCloseablepublic long candidateTermId()
Aeron.NULL_VALUE if
no voting phase of an election is currently active.public void candidateTermId(long candidateTermId,
int fileSyncLevel)
candidateTermId - to record that a vote has taken place.fileSyncLevel - as defined by cluster file sync level.public int memberId()
public void memberId(int memberId)
memberId - assigned as part of dynamic join of a cluster.public int clusterId()
public void clusterId(int clusterId)
clusterId - of the cluster instance so multiple clusters can run on the same driver.public void signalReady()
public void signalFailedStart()
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.public static void checkHeaderLength(String aeronDirectory, String controlChannel, String ingressChannel, String serviceName, String authenticator)
aeronDirectory - for the media driver.controlChannel - for the consensus module.ingressChannel - from the cluster clients.serviceName - for the application service.authenticator - for the application service.public static String markFilenameForService(int serviceId)
serviceId - of the service the ClusterMarkFile represents.public ClusterNodeControlProperties loadControlProperties()
Copyright © 2014-2020 Real Logic Limited. All Rights Reserved.