package org.apache.kafka.streams.query;
@Evolving
public final class VersionedKeyQuery<K, V> implements Query<ValueIterator<VersionedRecord<V>>> {
private final K key;
private final Optional<Long> asOfTimestamp;
private final Optional<Long> untilTimestamp;
private VersionedKeyQuery(final K key, Optional<Long> asOfTimestamp, Optional<Long> untilTimestamp);
/**
* Interactive key query that returns one record with the specified key
* * and with the latest timestamp
* @param key The key to retrieve
* @param <K> The key type
* @param <V> The value type
*/
public static <K, V> VersionedKeyQuery<K, V> withKeyLatestValue(final K key);
/**
* Interactive key query that returns one record with the specified key
* * and with the greatest timestamp <= untilTimeStamp
* @param key The key to retrieve
* @param untilTimeStamp The upperbound for timestamp
* @param <K> The key type
* @param <V> The value type
*/
public static <K, V> VersionedKeyQuery<K, V> withKeyWithTimestampBound(final K key, long untilTimeStamp);
/**
* Interactive key query that returns the records with the specified key
* * within the specified time range.
* @param key The key to retrieve
* @param <K> The key type
* @param <V> The value type
*/
public static <K, V> VersionedKeyQuery<K, V> withKeyWithTimestampRange(final K key, long asOfTimestamp, long untilTimestamp);
/**
* Interactive key query that returns all the records in the store with the specified key.
* @param key The key to retrieve
* @param <K> The key type
* @param <V> The value type
*/
public static <K, V> VersionedKeyQuery<K, V> withKeyAllVersions(final K key);
/**
* The key that was specified for this query.
*/
public K getKey();
/**
* The lower bound for timestamp of the query, if specified
*/
public Optional<Long> getAsOfTimestamp();
/**
* The upper bound for timestamp of the query, if specified
*/
public Optional<Long> getUntilTimestamp();
} |