Status
Current state: Discarded (covered via KIP-258)
Discussion thread: here
JIRA: KAFKA-4304
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Taken from related issue:
Currently, when querying state store, it is not clear when the key was updated last. The ides of this JIRA is to make the latest update timestamp for each key-value-pair of the state store accessible.
For example, this might be useful to
- check if a value was update but did not changed (just compare the update TS)
- if you want to consider only recently updated keys
Public Interfaces
ReadOnlyKeyValueStoreWithKeyContext
public interface ReadOnlyKeyValueStoreWithKeyContext<K, V> extends ReadOnlyKeyValueStore<K, V> { KeyContext<K, V> getWithKeyContext(K key); KeyValueIterator<KeyContext<K, V>, V> rangeWithKeyContext(K from, K to); KeyValueIterator<KeyContext<K, V>, V> allWithKeyContext(); }
Proposed Changes
We propose add a new interface KeyContext
which will keep info about key. We can include more methods inside this context as well.
public interface KeyContext<K, V> { // more key/value context can be added here as well. K key(); V value(); long lastUpdated(); }
Compatibility, Deprecation, and Migration Plan
Not yet
Rejected Alternatives
Not yet