Versions Compared

Key

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

Table of Contents

Status

Current state: Under DiscussionImplemented (for 3.1.0)

Discussion thread: here 

JIRA: KAFKA-4063

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

...

Code Block
linenumberstrue
  //return an iterator for all the records with a key greater (or equal) than "key-x"
  //starting with the smallest record
  KeyValueIterator<String, String> iter = store.range("key-x", null);

  //return an iterator for all the records with a key less (or equal) than "key-x"
  //starting with the smallest record
  KeyValueIterator<String, String> iter = store.range(null, "key-x");

  //return an iterator for all the records with a key greater (or equal) than "key-x"
  //starting with the largest record
  KeyValueIterator<String, String> iter = store.reverseRange("key-x", null);

  //return all the records in the store, equivalent to store.all()
  KeyValueIterator<String, String> iter = store.range(null, null);


Public Interfaces

  • JavaDoc description of org.apache.kafka.streams.state.ReadOnlyKeyValueStore::range

...

While a solution like this would be the cleanest, it would require that we deprecate the old range interface and migrate existing code to the new interface. Compared to the solution proposed in this KIP, which does not require modifications to the interface and no migration is needed, we felt that making bigger changes to the range interface is not necessary at this point.

Expanding idea of open endpoint range interfaces to other stores (e.g., SessionStore, WindowStore)

There are several other APIs that offer similar range based interfaces. Examples are the findSession interface in ReadOnlySessionStore or the fetch interface in ReadOnlyWindowStore. One could apply similar ideas of applying open endpoint semantics to those interfaces. At this point, however, we decided not to expand the scope of this KIP and leave it to follow-up KIPs to propose changes to those interfaces.