Class SessionKeySchema
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.SessionKeySchema
-
- All Implemented Interfaces:
SegmentedBytesStore.KeySchema
public class SessionKeySchema extends java.lang.Object implements SegmentedBytesStore.KeySchema
-
-
Constructor Summary
Constructors Constructor Description SessionKeySchema()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <K> Windowed<K>from(byte[] binaryKey, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, java.lang.String topic)static Windowed<org.apache.kafka.common.utils.Bytes>from(org.apache.kafka.common.utils.Bytes bytesKey)static <K> Windowed<K>from(Windowed<org.apache.kafka.common.utils.Bytes> keyBytes, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, java.lang.String topic)org.apache.kafka.streams.state.internals.HasNextConditionhasNextCondition(org.apache.kafka.common.utils.Bytes binaryKeyFrom, org.apache.kafka.common.utils.Bytes binaryKeyTo, long from, long to)Create an implementation ofHasNextConditionthat knows when to stop iterating over the KeyValueSegments.org.apache.kafka.common.utils.ByteslowerRange(org.apache.kafka.common.utils.Bytes key, long from)Given a range of record keys and a time, construct a Segmented key that represents the lower range of keys to search when performing range queries.org.apache.kafka.common.utils.ByteslowerRangeFixedSize(org.apache.kafka.common.utils.Bytes key, long from)Given a range of fixed size record keys and a time, construct a Segmented key that represents the lower range of keys to search when performing range queries.<S extends Segment>
java.util.List<S>segmentsToSearch(org.apache.kafka.streams.state.internals.Segments<S> segments, long from, long to)Used duringSegmentedBytesStore.fetch(Bytes, long, long)operations to determine which segments should be scanned.longsegmentTimestamp(org.apache.kafka.common.utils.Bytes key)Extract the timestamp of the segment from the key.static org.apache.kafka.common.utils.BytestoBinary(org.apache.kafka.common.utils.Bytes key, long startTime, long endTime)static <K> byte[]toBinary(Windowed<K> sessionKey, org.apache.kafka.common.serialization.Serializer<K> serializer, java.lang.String topic)static org.apache.kafka.common.utils.BytestoBinary(Windowed<org.apache.kafka.common.utils.Bytes> sessionKey)org.apache.kafka.common.utils.BytesupperRange(org.apache.kafka.common.utils.Bytes key, long to)Given a range of record keys and a time, construct a Segmented key that represents the upper range of keys to search when performing range queries.org.apache.kafka.common.utils.BytesupperRangeFixedSize(org.apache.kafka.common.utils.Bytes key, long to)Given a range of fixed size record keys and a time, construct a Segmented key that represents the upper range of keys to search when performing range queries.
-
-
-
Method Detail
-
upperRangeFixedSize
public org.apache.kafka.common.utils.Bytes upperRangeFixedSize(org.apache.kafka.common.utils.Bytes key, long to)Description copied from interface:SegmentedBytesStore.KeySchemaGiven a range of fixed size record keys and a time, construct a Segmented key that represents the upper range of keys to search when performing range queries.- Specified by:
upperRangeFixedSizein interfaceSegmentedBytesStore.KeySchema- Parameters:
key- the last key in the rangeto- the last timestamp in the range- Returns:
- The key that represents the upper range to search for in the store
- See Also:
upperRange(org.apache.kafka.common.utils.Bytes, long),WindowKeySchema.upperRange(org.apache.kafka.common.utils.Bytes, long)
-
lowerRangeFixedSize
public org.apache.kafka.common.utils.Bytes lowerRangeFixedSize(org.apache.kafka.common.utils.Bytes key, long from)Description copied from interface:SegmentedBytesStore.KeySchemaGiven a range of fixed size record keys and a time, construct a Segmented key that represents the lower range of keys to search when performing range queries.- Specified by:
lowerRangeFixedSizein interfaceSegmentedBytesStore.KeySchema- Parameters:
key- the first key in the rangefrom- the first timestamp in the range- Returns:
- The key that represents the lower range to search for in the store
- See Also:
lowerRange(org.apache.kafka.common.utils.Bytes, long),WindowKeySchema.lowerRange(org.apache.kafka.common.utils.Bytes, long)
-
upperRange
public org.apache.kafka.common.utils.Bytes upperRange(org.apache.kafka.common.utils.Bytes key, long to)Description copied from interface:SegmentedBytesStore.KeySchemaGiven a range of record keys and a time, construct a Segmented key that represents the upper range of keys to search when performing range queries.- Specified by:
upperRangein interfaceSegmentedBytesStore.KeySchema- Returns:
- The key that represents the upper range to search for in the store
- See Also:
upperRange(org.apache.kafka.common.utils.Bytes, long),WindowKeySchema.upperRange(org.apache.kafka.common.utils.Bytes, long)
-
lowerRange
public org.apache.kafka.common.utils.Bytes lowerRange(org.apache.kafka.common.utils.Bytes key, long from)Description copied from interface:SegmentedBytesStore.KeySchemaGiven a range of record keys and a time, construct a Segmented key that represents the lower range of keys to search when performing range queries.- Specified by:
lowerRangein interfaceSegmentedBytesStore.KeySchema- Returns:
- The key that represents the lower range to search for in the store
- See Also:
lowerRange(org.apache.kafka.common.utils.Bytes, long),WindowKeySchema.lowerRange(org.apache.kafka.common.utils.Bytes, long)
-
segmentTimestamp
public long segmentTimestamp(org.apache.kafka.common.utils.Bytes key)
Description copied from interface:SegmentedBytesStore.KeySchemaExtract the timestamp of the segment from the key. The key is a composite of the record-key, any timestamps, plus any additional information.- Specified by:
segmentTimestampin interfaceSegmentedBytesStore.KeySchema- Returns:
- See Also:
lowerRange(org.apache.kafka.common.utils.Bytes, long),WindowKeySchema.lowerRange(org.apache.kafka.common.utils.Bytes, long)
-
hasNextCondition
public org.apache.kafka.streams.state.internals.HasNextCondition hasNextCondition(org.apache.kafka.common.utils.Bytes binaryKeyFrom, org.apache.kafka.common.utils.Bytes binaryKeyTo, long from, long to)Description copied from interface:SegmentedBytesStore.KeySchemaCreate an implementation ofHasNextConditionthat knows when to stop iterating over the KeyValueSegments. Used duringSegmentedBytesStore.fetch(Bytes, Bytes, long, long)operations- Specified by:
hasNextConditionin interfaceSegmentedBytesStore.KeySchema- Parameters:
binaryKeyFrom- the first key in the rangebinaryKeyTo- the last key in the rangefrom- starting time rangeto- ending time range- Returns:
-
segmentsToSearch
public <S extends Segment> java.util.List<S> segmentsToSearch(org.apache.kafka.streams.state.internals.Segments<S> segments, long from, long to)
Description copied from interface:SegmentedBytesStore.KeySchemaUsed duringSegmentedBytesStore.fetch(Bytes, long, long)operations to determine which segments should be scanned.- Specified by:
segmentsToSearchin interfaceSegmentedBytesStore.KeySchema- Returns:
- List of segments to search
-
from
public static <K> Windowed<K> from(byte[] binaryKey, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, java.lang.String topic)
-
from
public static Windowed<org.apache.kafka.common.utils.Bytes> from(org.apache.kafka.common.utils.Bytes bytesKey)
-
from
public static <K> Windowed<K> from(Windowed<org.apache.kafka.common.utils.Bytes> keyBytes, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, java.lang.String topic)
-
toBinary
public static <K> byte[] toBinary(Windowed<K> sessionKey, org.apache.kafka.common.serialization.Serializer<K> serializer, java.lang.String topic)
-
toBinary
public static org.apache.kafka.common.utils.Bytes toBinary(Windowed<org.apache.kafka.common.utils.Bytes> sessionKey)
-
toBinary
public static org.apache.kafka.common.utils.Bytes toBinary(org.apache.kafka.common.utils.Bytes key, long startTime, long endTime)
-
-