The directory in which log segments are created.
The log configuration settings
The offset at which to begin recovery--i.e. the first offset which has not been flushed to disk
The thread pool scheduler used for background actions
The time instance used for checking the clock
Struct to hold various quantities we compute about each message set before appending to the log
Struct to hold various quantities we compute about each message set before appending to the log
The first offset in the message set
The last offset in the message set
The codec used in the message set
The number of shallow messages
The number of valid bytes
Are the offsets in this message set monotonically increasing
The active segment that is currently taking appends
Add the given segment to the segments in this log.
Add the given segment to the segments in this log. If this segment replaces an existing segment, delete it.
The segment to add
Append this message set to the active segment of the log, rolling over to a fresh segment if necessary.
Append this message set to the active segment of the log, rolling over to a fresh segment if necessary.
This method will generally be responsible for assigning offsets to the messages, however if the assignOffsets=false flag is passed we will only check that the existing offsets are valid.
The message set to append
Should the log assign offsets to this message set or blindly apply what it is given
Information about the appended messages including the first and last offset.
If the append fails due to an I/O error.
Close this log
The log configuration settings
Given a message offset, find its corresponding offset metadata in the log.
Given a message offset, find its corresponding offset metadata in the log. If the message offset is out of range, return unknown offset metadata
Delete any log segments matching the given predicate function, starting with the oldest segment and moving forward until a segment doesn't match.
Delete any log segments matching the given predicate function, starting with the oldest segment and moving forward until a segment doesn't match.
A function that takes in a single log segment and returns true iff it is deletable
The number of segments deleted
The directory in which log segments are created.
Flush log segments for all offsets up to offset-1
Flush log segments for all offsets up to offset-1
The offset to flush up to (non-inclusive); the new recovery point
Flush all log segments
The time this log is last known to have been fully flushed to disk
The offset of the next message that will be appended to the log
The offset metadata of the next message that will be appended to the log
Get all segments beginning with the segment that includes "from" and ending with the segment that includes up to "to-1" or the end of the log (if to > logEndOffset)
All the log segments in this log ordered from oldest to newest
The earliest message offset in the log
The name of this log
The number of segments in the log.
The number of segments in the log. Take care! this is an O(n) operation.
Read messages from the log
Read messages from the log
The offset to begin reading at
The maximum number of bytes to read
-The offset to read up to, exclusive. (i.e. the first offset NOT included in the resulting message set).
The fetch data information including fetch starting offset metadata and messages read
If startOffset is beyond the log end offset or before the base offset of the first segment.
The offset at which to begin recovery--i.
The offset at which to begin recovery--i.e. the first offset which has not been flushed to disk
Roll the log over to a new active segment starting with the current logEndOffset.
Roll the log over to a new active segment starting with the current logEndOffset. This will trim the index to the exact size of the number of entries it currently contains.
The newly rolled segment
The size of the log in bytes
The number of messages appended to the log since the last flush
An append-only log for storing messages.
The log is a sequence of LogSegments, each with a base offset denoting the first message in the segment.
New log segments are created according to a configurable policy that controls the size in bytes or time interval for a given segment.