Class OffsetCheckpoint
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.OffsetCheckpoint
-
public class OffsetCheckpoint extends java.lang.ObjectThis class saves out a map of topic/partition=>offsets to a file. The format of the file is UTF-8 text containing the following:<version> <n> <topic_name_1> <partition_1> <offset_1> . . . <topic_name_n> <partition_n> <offset_n>
The first line contains a number designating the format version (currently 0), the get line contains a number giving the total number of offsets. Each successive line gives a topic/partition/offset triple separated by spaces.
-
-
Field Summary
Fields Modifier and Type Field Description static longOFFSET_UNKNOWN
-
Constructor Summary
Constructors Constructor Description OffsetCheckpoint(java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>read()Reads the offsets from the local checkpoint file, skipping any negative offsets it finds.java.lang.StringtoString()voidwrite(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> offsets)Write the given offsets to the checkpoint file.
-
-
-
Field Detail
-
OFFSET_UNKNOWN
public static final long OFFSET_UNKNOWN
- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public void write(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> offsets) throws java.io.IOExceptionWrite the given offsets to the checkpoint file. All offsets should be non-negative.- Throws:
java.io.IOException- if any file operation fails with an IO exception
-
read
public java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> read() throws java.io.IOExceptionReads the offsets from the local checkpoint file, skipping any negative offsets it finds.- Throws:
java.io.IOException- if any file operation fails with an IO exceptionjava.lang.IllegalArgumentException- if the offset checkpoint version is unknown
-
delete
public void delete() throws java.io.IOException- Throws:
java.io.IOException- if there is any IO exception during delete
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-