public class TierTopicPartitionSnapshot extends Object
This class is a serialization wrapper for the TierTopicSnapshot (TTPS) FlatBuffer-generated class. It encodes the schema outlined in "Tier Topic Snapshots" (KDATA-211), with some minor modifications. Most significantly, instead of using a separate index file, the offset range per partition is stored in the header of each TTPS file.
The input to this class constructor assumes that the submitted entries are complete insofar as they would contain events from every single partition, not a subset of partitions, in order.
Constructor and Description |
---|
TierTopicPartitionSnapshot(List<org.apache.kafka.clients.consumer.ConsumerRecords<byte[],byte[]>> recordsBuffer,
List<Long> nextOffsets) |
Modifier and Type | Method and Description |
---|---|
Long |
endOffset(int partition) |
long |
endTimestampMs() |
List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]>> |
entries() |
static org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> |
makeTierTopicRecord(int partition,
long offset,
long timestamp,
byte[] key,
byte[] value,
int leaderEpoch)
Logic for making a new ConsumerRecord
|
ByteBuffer |
payloadBuffer() |
static TierTopicPartitionSnapshot |
read(FileChannel channel,
Long startTimestampMs,
Long endTimestampMs) |
static TierTopicPartitionSnapshot |
read(InputStream stream,
Long startTimestampMs,
Long endTimestampMs) |
long |
startOffset(int partition) |
long |
startTimestampMs() |
String |
toString() |
public TierTopicPartitionSnapshot(List<org.apache.kafka.clients.consumer.ConsumerRecords<byte[],byte[]>> recordsBuffer, List<Long> nextOffsets)
recordsBuffer
- List of record for the snapshotnextOffsets
- The current offset position of the consumer, to be used by the next snapshotpublic static TierTopicPartitionSnapshot read(FileChannel channel, Long startTimestampMs, Long endTimestampMs) throws IOException
IOException
public static TierTopicPartitionSnapshot read(InputStream stream, Long startTimestampMs, Long endTimestampMs) throws IOException
IOException
public ByteBuffer payloadBuffer()
public List<org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]>> entries()
public long startTimestampMs()
public long endTimestampMs()
public long startOffset(int partition)
public Long endOffset(int partition)
public static org.apache.kafka.clients.consumer.ConsumerRecord<byte[],byte[]> makeTierTopicRecord(int partition, long offset, long timestamp, byte[] key, byte[] value, int leaderEpoch)