Class OffsetCheckpoint
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.OffsetCheckpoint
-
public class OffsetCheckpoint extends java.lang.Object
This 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.
-
-
Constructor Summary
Constructors Constructor Description OffsetCheckpoint(java.io.File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long>
read()
java.lang.String
toString()
void
write(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> offsets)
-
-
-
Method Detail
-
write
public void write(java.util.Map<org.apache.kafka.common.TopicPartition,java.lang.Long> offsets) throws java.io.IOException
- 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.IOException
- 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:
toString
in classjava.lang.Object
-
-