...
ReadOnlyWindowStore
interface
Code Block |
---|
WindowStoreIterator<KeyValue<KKeyValueIterator<Windowed<K>, V>> fetch(K from, K to, long timeFrom, long timeTo) |
...
- Users implementing their own state stores would be affected by the interface changes.
Rejected Alternatives
Arguably, the The existing return type in ReadOnlyWindowStore.fetch((K key, long timeFrom, long timeTo)
is not ideal, since WindowStoreIterator
is already a KeyValueIterator KeyValueIterator<Long, V>
, which abuses the key as a timestamp and the value as the object of interest. However , given that the existing API already abuses the iterator in a similar way, and barring more invasive changes to the API, or the introduction of type that embeds all of timestamp, key, and value – which would probably be a much larger discussion in itself – we want to be able to return the keys as part of range scans, so we considered using WindowStoreIterator<KeyValue<K, V>>
as the return type for windowed stores for consistency between single key and range scan methods.
It was pointed out that doing so would limit the usefulness of peekNextKey()
on the iterator, while also being somewhat confusing, since the iterator key doesn't actually contain the keys. As a result, it seemed simpler to follow the existing model. model already used in ReadOnlySessionStore
to return use a KeyValueIterator
with a Windowed<K>
as the key.