Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Gaps pointed out during PR review.

...

Code Block
/**
  * The response object for interactive queries.
  * It wraps the individual results, as well as providing a
  * vehicle to deliver metadata relating to the result as a whole.
  * <p>
  * @param <R> The type of the query result. 
  */
@Evolving 
public class StateQueryResult<R> {


  /**
    * Constructor Set the result for a global store query. Used by Kafka Streams, and may be useful for and available for tests.
    */
  public void setGlobalResult(final QueryResult<R> r);

  /**
    * The query's result for global store queries. Is {@code null} for non-global (partitioned)
    * testsstore as wellqueries.
    */
  public QueryResult<R> StateQueryResult(Map<Integer /*partition*/, QueryResult<R>> partitionResultsgetGlobalResult();

  /**
    * Set the result for a partitioned store query. Used by Kafka Streams and available for tests.
    */
  public void addResult(final int partition, final QueryResult<R> r);

   /**
    * The query's result for each partition that executed the query.
    */
  public Map<Integer /*partition*/, QueryResult<R>> getPartitionResults();

  /**
    * Asserts that only one partition returns a result and extract the result.
    * Useful with queries that expect a single result.
    */
  public QueryResult<R> getOnlyPartitionResult()


  /**
    * The position of the state store at the moment it executed the
    * query. In conjunction
    * with {@link StateQueryRequest#withPartitionBound}, this can be
    * used to achieve a good balance between consistency and
    * availability in which repeated queries are guaranteed to
    * advance in time while allowing reads to be served from any
    * replica that is caught up to that caller's prior observations.
    */ 
  public Position getPosition();
}

...

Code Block
@Evolving
public interfaceclass Position {

  // Create a new Position from a map of topic -> partition -> offset
  static Position fromMap(Map<String, Map<Integer, Long>> map);

  // Create a new, empty Position
  static Position emptyPosition();

  // Return a new position based on the current one, with the given component added
  Position withComponent(String topic, int partition, long offset);

  // Merge all the components of this position with all the components of the other
  // position and return the result in a new Position
  Position merge(Position other);

  // Get the set of topics included in this Position
  Set<String> getTopics();

  // Given a topic, get the partition -> offset pairs included in this Position
  Map<Integer, Long> getBound(String topic);
}

...

Code Block
@Evolving
public interfaceclass PositionBound {

  // Create a new Position bound representing "no bound"
  static PositionBound unbounded();

  // Create a new, empty Position
  static PositionBound at(Position position);

  // Check whether this is an "unbounded" Position bound
  boolean isUnbounded();

  // Get the Position (if it's not unbounded or latest)
  Position position();
}

...