public class CncFileDescriptor extends Object
File Layout
+-----------------------------+ | Meta Data | +-----------------------------+ | to-driver Buffer | +-----------------------------+ | to-clients Buffer | +-----------------------------+ | Counters Metadata Buffer | +-----------------------------+ | Counters Values Buffer | +-----------------------------+ | Error Log | +-----------------------------+
Meta Data Layout CNC_VERSION
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Aeron CnC Version | +---------------------------------------------------------------+ | to-driver buffer length | +---------------------------------------------------------------+ | to-clients buffer length | +---------------------------------------------------------------+ | Counters Metadata buffer length | +---------------------------------------------------------------+ | Counters Values buffer length | +---------------------------------------------------------------+ | Error Log buffer length | +---------------------------------------------------------------+ | Client Liveness Timeout | | | +---------------------------------------------------------------+ | Driver Start Timestamp | | | +---------------------------------------------------------------+ | Driver PID | | | +---------------------------------------------------------------+
| Modifier and Type | Field and Description |
|---|---|
static int |
CLIENT_LIVENESS_TIMEOUT_FIELD_OFFSET |
static String |
CNC_FILE |
static int |
CNC_VERSION
Version of the CnC file using semantic versioning (
SemanticVersion) stored in an integer. |
static int |
CNC_VERSION_FIELD_OFFSET |
static int |
COUNTERS_METADATA_BUFFER_LENGTH_FIELD_OFFSET |
static int |
COUNTERS_VALUES_BUFFER_LENGTH_FIELD_OFFSET |
static int |
END_OF_METADATA_OFFSET |
static int |
ERROR_LOG_BUFFER_LENGTH_FIELD_OFFSET |
static int |
META_DATA_LENGTH |
static int |
PID_FIELD_OFFSET |
static int |
START_TIMESTAMP_FIELD_OFFSET |
static int |
TO_CLIENTS_BUFFER_LENGTH_FIELD_OFFSET |
static int |
TO_DRIVER_BUFFER_LENGTH_FIELD_OFFSET |
| Constructor and Description |
|---|
CncFileDescriptor() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkVersion(int cncVersion)
Check the version of the CnC file is compatible with application.
|
static long |
clientLivenessTimeoutNs(DirectBuffer metaDataBuffer)
Get the timeout in nanoseconds for tracking client liveness and inter-service timeout.
|
static int |
clientLivenessTimeoutOffset(int baseOffset) |
static int |
cncVersionOffset(int baseOffset) |
static int |
computeCncFileLength(int totalLengthOfBuffers,
int alignment)
Compute the length of the cnc file and return it.
|
static int |
countersMetaDataBufferLengthOffset(int baseOffset) |
static int |
countersValuesBufferLengthOffset(int baseOffset) |
static UnsafeBuffer |
createCountersMetaDataBuffer(ByteBuffer buffer,
DirectBuffer metaDataBuffer)
Create the buffer which wraps the section in the CnC file for the counters metadata.
|
static UnsafeBuffer |
createCountersValuesBuffer(ByteBuffer buffer,
DirectBuffer metaDataBuffer)
Create the buffer which wraps the section in the CnC file for the counter values.
|
static UnsafeBuffer |
createErrorLogBuffer(ByteBuffer buffer,
DirectBuffer metaDataBuffer)
Create the buffer which wraps the section in the CnC file for the error log.
|
static UnsafeBuffer |
createMetaDataBuffer(ByteBuffer buffer)
Create the buffer which wraps the area in the CnC file for the metadata about the CnC file itself.
|
static UnsafeBuffer |
createToClientsBuffer(ByteBuffer buffer,
DirectBuffer metaDataBuffer)
Create the buffer which wraps the section in the CnC file for the broadcast buffer from the driver to clients.
|
static UnsafeBuffer |
createToDriverBuffer(ByteBuffer buffer,
DirectBuffer metaDataBuffer)
Create the buffer which wraps the area in the CnC file for the command buffer from clients to the driver.
|
static int |
errorLogBufferLengthOffset(int baseOffset) |
static void |
fillMetaData(UnsafeBuffer cncMetaDataBuffer,
int toDriverBufferLength,
int toClientsBufferLength,
int counterMetaDataBufferLength,
int counterValuesBufferLength,
long clientLivenessTimeoutNs,
int errorLogBufferLength,
long startTimestampMs,
long pid)
Fill the CnC file with metadata to define its sections.
|
static long |
pid(DirectBuffer metaDataBuffer)
Get the process PID hosting the driver.
|
static int |
pidOffset(int baseOffset) |
static void |
signalCncReady(UnsafeBuffer cncMetaDataBuffer)
Signal the the CnC file is ready for use by client by writing the version into the CnC file.
|
static long |
startTimestampMs(DirectBuffer metaDataBuffer)
Get the start timestamp in milliseconds for the media driver.
|
static int |
startTimestampOffset(int baseOffset) |
static int |
toClientsBufferLengthOffset(int baseOffset) |
static int |
toDriverBufferLengthOffset(int baseOffset) |
public static final String CNC_FILE
public static final int CNC_VERSION
SemanticVersion) stored in an integer.public static final int CNC_VERSION_FIELD_OFFSET
public static final int TO_DRIVER_BUFFER_LENGTH_FIELD_OFFSET
public static final int TO_CLIENTS_BUFFER_LENGTH_FIELD_OFFSET
public static final int COUNTERS_METADATA_BUFFER_LENGTH_FIELD_OFFSET
public static final int COUNTERS_VALUES_BUFFER_LENGTH_FIELD_OFFSET
public static final int CLIENT_LIVENESS_TIMEOUT_FIELD_OFFSET
public static final int ERROR_LOG_BUFFER_LENGTH_FIELD_OFFSET
public static final int START_TIMESTAMP_FIELD_OFFSET
public static final int PID_FIELD_OFFSET
public static final int META_DATA_LENGTH
public static final int END_OF_METADATA_OFFSET
public static int computeCncFileLength(int totalLengthOfBuffers,
int alignment)
totalLengthOfBuffers - in bytesalignment - for file length to adhere topublic static int cncVersionOffset(int baseOffset)
public static int toDriverBufferLengthOffset(int baseOffset)
public static int toClientsBufferLengthOffset(int baseOffset)
public static int countersMetaDataBufferLengthOffset(int baseOffset)
public static int countersValuesBufferLengthOffset(int baseOffset)
public static int clientLivenessTimeoutOffset(int baseOffset)
public static int errorLogBufferLengthOffset(int baseOffset)
public static int startTimestampOffset(int baseOffset)
public static int pidOffset(int baseOffset)
public static void fillMetaData(UnsafeBuffer cncMetaDataBuffer, int toDriverBufferLength, int toClientsBufferLength, int counterMetaDataBufferLength, int counterValuesBufferLength, long clientLivenessTimeoutNs, int errorLogBufferLength, long startTimestampMs, long pid)
cncMetaDataBuffer - that wraps the metadata section of the CnC file.toDriverBufferLength - for sending commands to the driver.toClientsBufferLength - for broadcasting events to the clients.counterMetaDataBufferLength - buffer length for counters metadata.counterValuesBufferLength - buffer length for counter values.clientLivenessTimeoutNs - timeout value in nanoseconds for client liveness and inter-service interval.errorLogBufferLength - for recording the distinct error log.startTimestampMs - epoch at which the driver started.pid - for the process hosting the driver.public static void signalCncReady(UnsafeBuffer cncMetaDataBuffer)
cncMetaDataBuffer - for the CnC file.public static UnsafeBuffer createMetaDataBuffer(ByteBuffer buffer)
buffer - for the CnC filepublic static UnsafeBuffer createToDriverBuffer(ByteBuffer buffer, DirectBuffer metaDataBuffer)
buffer - for the CnC file.metaDataBuffer - within the CnC file.public static UnsafeBuffer createToClientsBuffer(ByteBuffer buffer, DirectBuffer metaDataBuffer)
buffer - for the CnC file.metaDataBuffer - within the CnC file.public static UnsafeBuffer createCountersMetaDataBuffer(ByteBuffer buffer, DirectBuffer metaDataBuffer)
buffer - for the CnC file.metaDataBuffer - within the CnC file.public static UnsafeBuffer createCountersValuesBuffer(ByteBuffer buffer, DirectBuffer metaDataBuffer)
buffer - for the CnC file.metaDataBuffer - within the CnC file.public static UnsafeBuffer createErrorLogBuffer(ByteBuffer buffer, DirectBuffer metaDataBuffer)
buffer - for the CnC file.metaDataBuffer - within the CnC file.public static long clientLivenessTimeoutNs(DirectBuffer metaDataBuffer)
metaDataBuffer - for the CnC file.public static long startTimestampMs(DirectBuffer metaDataBuffer)
metaDataBuffer - for the CnC file.public static long pid(DirectBuffer metaDataBuffer)
metaDataBuffer - for the CnC file.public static void checkVersion(int cncVersion)
cncVersion - of the CnC file.AeronException - if the major versions are not compatible.Copyright © 2014-2019 Real Logic Ltd. All Rights Reserved.