Class BitSetEncoder

java.lang.Object
io.confluent.parallelconsumer.offsets.OffsetEncoder
io.confluent.parallelconsumer.offsets.BitSetEncoder

public class BitSetEncoder
extends OffsetEncoder
Encodes a range of offsets, from an incompletes collection into a BitSet.

Highly efficient when the completion status is random.

Highly inefficient when the completion status is in large blocks (RunLengthEncoder is much better)

Because our system works on manipulating INCOMPLETE offsets, it doesn't matter if the offset range we're encoding is Sequential or not. Because as records are always in commit order, if we've seen a range of offsets, we know we've seen all that exist (within said range). So if offset 8 is missing from the partition, we will encode it as having been completed (when in fact it doesn't exist), because we only compare against known incompletes, and assume all others are complete.

So, when we deserialize, the INCOMPLETES collection is then restored, and that's what's used to compare to see if a record should be skipped or not. So if record 8 is recorded as completed, it will be absent from the restored INCOMPLETES list, and we are assured we will never see record 8.

See Also:
RunLengthEncoder, OffsetBitSet