Class OffsetMapCodecManager<K,V>
java.lang.Object
io.confluent.parallelconsumer.offsets.OffsetMapCodecManager<K,V>
Uses multiple encodings to compare, when decided, can refactor other options out for analysis only -
encodeOffsetsCompressed(long, io.confluent.parallelconsumer.state.PartitionState<K, V>)
TODO: consider IO exception management - question sneaky throws usage?
TODO: enforce max uncommitted < encoding length (Short.MAX)
Bitset serialisation format:
- byte1: magic
- byte2-3: Short: bitset size
- byte4-n: serialised
BitSet
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDecoding result for encoded offsets -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Charsetstatic intMaximum size of the commit offset metadatastatic Optional<OffsetEncoding>Forces the use of a specific codec, instead of choosing the most efficient one.static final StringUsed to prevent tests running in parallel that depends on setting static state in this class. -
Constructor Summary
ConstructorsConstructorDescriptionOffsetMapCodecManager(org.apache.kafka.clients.consumer.Consumer<K, V> consumer) -
Method Summary
Modifier and TypeMethodDescriptiondeserialiseIncompleteOffsetMapFromBase64(long committedOffsetForPartition, String base64EncodedOffsetPayload) Map<org.apache.kafka.common.TopicPartition,PartitionState<K, V>> loadPartitionStateForAssignment(Collection<org.apache.kafka.common.TopicPartition> assignment) Load all the previously completed offsets that were not committedmakeOffsetMetadataPayload(long baseOffsetForPartition, PartitionState<K, V> state)
-
Field Details
-
METADATA_DATA_SIZE_RESOURCE_LOCK
Used to prevent tests running in parallel that depends on setting static state in this class. Manipulation of static state in tests needs to be removed to this isn't necessary.todo remove static state manipulation from tests (make non static)
- See Also:
-
DefaultMaxMetadataSize
public static int DefaultMaxMetadataSizeMaximum size of the commit offset metadata- See Also:
-
- OffsetConfig#DefaultMaxMetadataSize
- "kafka.coordinator.group.OffsetConfig#DefaultMaxMetadataSize"
-
CHARSET_TO_USE
-
forcedCodec
Forces the use of a specific codec, instead of choosing the most efficient one. Useful for testing.
-
-
Constructor Details
-
OffsetMapCodecManager
-
-
Method Details
-
loadPartitionStateForAssignment
public Map<org.apache.kafka.common.TopicPartition,PartitionState<K, loadPartitionStateForAssignmentV>> (Collection<org.apache.kafka.common.TopicPartition> assignment) Load all the previously completed offsets that were not committed -
deserialiseIncompleteOffsetMapFromBase64
public static OffsetMapCodecManager.HighestOffsetAndIncompletes deserialiseIncompleteOffsetMapFromBase64(long committedOffsetForPartition, String base64EncodedOffsetPayload) throws OffsetDecodingError - Throws:
OffsetDecodingError
-
makeOffsetMetadataPayload
public String makeOffsetMetadataPayload(long baseOffsetForPartition, PartitionState<K, V> state) throws NoEncodingPossibleException- Throws:
NoEncodingPossibleException
-