Package io.aeron.driver.reports
Class LossReport
java.lang.Object
io.aeron.driver.reports.LossReport
A report of loss events on a message stream.
The provided AtomicBuffer
can wrap a memory-mapped file so logging can be out of process. This provides
the benefit that if a crash or lockup occurs then the log can be read externally without loss of data.
Note:This class is NOT threadsafe to be used from multiple logging threads.
The error records are recorded to the memory mapped buffer in the following format.
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |R| Observation Count | | | +-+-------------------------------------------------------------+ |R| Total Bytes Lost | | | +---------------------------------------------------------------+ | First Observation Timestamp | | | +---------------------------------------------------------------+ | Last Observation Timestamp | | | +---------------------------------------------------------------+ | Session ID | +---------------------------------------------------------------+ | Stream ID | +---------------------------------------------------------------+ | Channel encoded in US-ASCII ... ... | +---------------------------------------------------------------+ | Source encoded in US-ASCII ... ... | +---------------------------------------------------------------+
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Report entry for a specific stream. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Offset within an entry at which the channel field begins.static final int
Alignment to be applied for each entry offset.static final int
Offset within an entry at which the first observation field begins.static final int
Offset within an entry at which the last observation field begins.static final int
Offset within an entry at which the observation count begins.static final int
Offset within an entry at which the session id field begins.static final int
Offset within an entry at which the stream id field begins.static final int
Offset within an entry at which the total bytes field begins. -
Constructor Summary
ConstructorsConstructorDescriptionLossReport
(AtomicBuffer buffer) Create a loss report which wraps a buffer which is ideally memory mapped, so it can be read from another process. -
Method Summary
Modifier and TypeMethodDescriptioncreateEntry
(long initialBytesLost, long timestampMs, int sessionId, int streamId, String channel, String source) Create a new entry for recording loss on a given stream.toString()
-
Field Details
-
ENTRY_ALIGNMENT
public static final int ENTRY_ALIGNMENTAlignment to be applied for each entry offset.- See Also:
-
OBSERVATION_COUNT_OFFSET
public static final int OBSERVATION_COUNT_OFFSETOffset within an entry at which the observation count begins.- See Also:
-
TOTAL_BYTES_LOST_OFFSET
public static final int TOTAL_BYTES_LOST_OFFSETOffset within an entry at which the total bytes field begins.- See Also:
-
FIRST_OBSERVATION_OFFSET
public static final int FIRST_OBSERVATION_OFFSETOffset within an entry at which the first observation field begins.- See Also:
-
LAST_OBSERVATION_OFFSET
public static final int LAST_OBSERVATION_OFFSETOffset within an entry at which the last observation field begins.- See Also:
-
SESSION_ID_OFFSET
public static final int SESSION_ID_OFFSETOffset within an entry at which the session id field begins.- See Also:
-
STREAM_ID_OFFSET
public static final int STREAM_ID_OFFSETOffset within an entry at which the stream id field begins.- See Also:
-
CHANNEL_OFFSET
public static final int CHANNEL_OFFSETOffset within an entry at which the channel field begins.- See Also:
-
-
Constructor Details
-
LossReport
Create a loss report which wraps a buffer which is ideally memory mapped, so it can be read from another process.- Parameters:
buffer
- to be wrapped.
-
-
Method Details
-
createEntry
public LossReport.ReportEntry createEntry(long initialBytesLost, long timestampMs, int sessionId, int streamId, String channel, String source) Create a new entry for recording loss on a given stream.If not space is remaining in the error report then null is returned.
- Parameters:
initialBytesLost
- on the stream.timestampMs
- at which the first loss was observed.sessionId
- for the stream.streamId
- for the stream.channel
- for the stream.source
- of the stream.- Returns:
- a new record or null if the error log has insufficient space.
-
toString
-