Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
firstline1
titleValueIterator.java
linenumberstrue
collapsetrue
package org.apache.kafka.streams.state;

/**
 * Iterator interface of {@link Value}.
 * <p>
 * Users must call its {@code close} method explicitly upon completeness to release resources,
 * or use try-with-resources statement (available since JDK7) for this {@link Closeable} class.
 * Note that {@code remove()} is not supported.
 *
 * @param <V> Type of values
 */
public interface ValueIterator<V> extends Iterator<V>, Closeable {

    @Override
    void close();

    /**
     * Peek at the next keyvalue without advancing the iterator
     * @return the key of the next value that would be returned from the next call to next
     */
    V peekNextRecordpeekNextValue();
}


Code Block
languagejava
firstline1
titleVersionedKeyQuery.java
linenumberstrue
collapsetrue
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();
}

...