Status
Current state: Under Discussion
Discussion thread: here
JIRA: KAFKA-4499
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Currently, both KTable and windowed-KTable stores can be queried via IQ feature. While ReadOnlyKeyValueStore(for KTable stores) provide method all() to scan the whole store (ie, returns an iterator over all stored key-value pairs), there is no similar API for ReadOnlyWindowStore (for windowed-KTable stores).
This limits the usage of a windowed store, because the user needs to know what keys are stored in order the query it.
Public Interfaces
Methods similar to the ones found in ReadOnlyKeyValueStore
will be introduced into the ReadOnlyWindowStore
interface. They are the following:
Collection<Windowed<K>> range(long timeFrom, long timeTo);
KeyValueIterator<Windowed<K>, V> allLatest();
and Collection<Windowed<K>> keys();
Proposed Changes
With the need to test the implementation of these methods in mind, the ReadOnlyWindowStoreStub
class will implement these additions (i.e. @Override public Collection<Windowed<K>> range(long timeFrom, long timeTo){...}
). The corresponding test will also be modified. (e.g. @Test public void testRange(){...
})
Following the changes in ReadOnlyWindowStore
, CachingWindowStore
and other WindowStore
API will implement these changes accordingly.
Compatibility, Deprecation, and Migration Plan