Class CompositeReadOnlyWindowStore<K,V>
- java.lang.Object
-
- org.apache.kafka.streams.state.internals.CompositeReadOnlyWindowStore<K,V>
-
- All Implemented Interfaces:
ReadOnlyWindowStore<K,V>
public class CompositeReadOnlyWindowStore<K,V> extends Object implements ReadOnlyWindowStore<K,V>
Wrapper over the underlyingReadOnlyWindowStore
s found in aProcessorTopology
-
-
Constructor Summary
Constructors Constructor Description CompositeReadOnlyWindowStore(StateStoreProvider provider, QueryableStoreType<ReadOnlyWindowStore<K,V>> windowStoreType, String storeName)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description KeyValueIterator<Windowed<K>,V>
all()
Gets all the key-value pairs in the existing windows.V
fetch(K key, long time)
Get the value of key from a window.WindowStoreIterator<V>
fetch(K key, long timeFrom, long timeTo)
Deprecated.WindowStoreIterator<V>
fetch(K key, Instant from, Instant to)
Get all the key-value pairs with the given key and the time range from all the existing windows.KeyValueIterator<Windowed<K>,V>
fetch(K from, K to, long timeFrom, long timeTo)
Get all the key-value pairs in the given key range and time range from all the existing windows.KeyValueIterator<Windowed<K>,V>
fetch(K from, K to, Instant fromTime, Instant toTime)
Get all the key-value pairs in the given key range and time range from all the existing windows.KeyValueIterator<Windowed<K>,V>
fetchAll(long timeFrom, long timeTo)
Deprecated.KeyValueIterator<Windowed<K>,V>
fetchAll(Instant from, Instant to)
Gets all the key-value pairs that belong to the windows within in the given time range.
-
-
-
Constructor Detail
-
CompositeReadOnlyWindowStore
public CompositeReadOnlyWindowStore(StateStoreProvider provider, QueryableStoreType<ReadOnlyWindowStore<K,V>> windowStoreType, String storeName)
-
-
Method Detail
-
fetch
public V fetch(K key, long time)
Description copied from interface:ReadOnlyWindowStore
Get the value of key from a window.- Specified by:
fetch
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
key
- the key to fetchtime
- start timestamp (inclusive) of the window- Returns:
- The value or
null
if no value is found in the window
-
fetch
@Deprecated public WindowStoreIterator<V> fetch(K key, long timeFrom, long timeTo)
Deprecated.Description copied from interface:ReadOnlyWindowStore
Get all the key-value pairs with the given key and the time range from all the existing windows.This iterator must be closed after use.
The time range is inclusive and applies to the starting timestamp of the window. For example, if we have the following windows:
+-------------------------------+ | key | start time | end time | +-------+------------+----------+ | A | 10 | 20 | +-------+------------+----------+ | A | 15 | 25 | +-------+------------+----------+ | A | 20 | 30 | +-------+------------+----------+ | A | 25 | 35 | +--------------------------------
And we callstore.fetch("A", 10, 20)
then the results will contain the first three windows from the table above, i.e., all those where 10 <= start time <= 20.For each key, the iterator guarantees ordering of windows, starting from the oldest/earliest available window to the newest/latest window.
- Specified by:
fetch
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
key
- the key to fetchtimeFrom
- time range start (inclusive)timeTo
- time range end (inclusive)- Returns:
- an iterator over key-value pairs
<timestamp, value>
-
fetch
public WindowStoreIterator<V> fetch(K key, Instant from, Instant to) throws IllegalArgumentException
Description copied from interface:ReadOnlyWindowStore
Get all the key-value pairs with the given key and the time range from all the existing windows.This iterator must be closed after use.
The time range is inclusive and applies to the starting timestamp of the window. For example, if we have the following windows:
+-------------------------------+ | key | start time | end time | +-------+------------+----------+ | A | 10 | 20 | +-------+------------+----------+ | A | 15 | 25 | +-------+------------+----------+ | A | 20 | 30 | +-------+------------+----------+ | A | 25 | 35 | +--------------------------------
And we callstore.fetch("A", Instant.ofEpochMilli(10), Instant.ofEpochMilli(20))
then the results will contain the first three windows from the table above, i.e., all those where 10 <= start time <= 20.For each key, the iterator guarantees ordering of windows, starting from the oldest/earliest available window to the newest/latest window.
- Specified by:
fetch
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
key
- the key to fetchfrom
- time range start (inclusive)to
- time range end (inclusive)- Returns:
- an iterator over key-value pairs
<timestamp, value>
- Throws:
IllegalArgumentException
- if duration is negative or can't be represented aslong milliseconds
-
fetch
public KeyValueIterator<Windowed<K>,V> fetch(K from, K to, long timeFrom, long timeTo)
Description copied from interface:ReadOnlyWindowStore
Get all the key-value pairs in the given key range and time range from all the existing windows.This iterator must be closed after use.
- Specified by:
fetch
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
from
- the first key in the rangeto
- the last key in the rangetimeFrom
- time range start (inclusive)timeTo
- time range end (inclusive)- Returns:
- an iterator over windowed key-value pairs
<Windowed<K>, value>
-
fetch
public KeyValueIterator<Windowed<K>,V> fetch(K from, K to, Instant fromTime, Instant toTime) throws IllegalArgumentException
Description copied from interface:ReadOnlyWindowStore
Get all the key-value pairs in the given key range and time range from all the existing windows.This iterator must be closed after use.
- Specified by:
fetch
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
from
- the first key in the rangeto
- the last key in the rangefromTime
- time range start (inclusive)toTime
- time range end (inclusive)- Returns:
- an iterator over windowed key-value pairs
<Windowed<K>, value>
- Throws:
IllegalArgumentException
- if duration is negative or can't be represented aslong milliseconds
-
all
public KeyValueIterator<Windowed<K>,V> all()
Description copied from interface:ReadOnlyWindowStore
Gets all the key-value pairs in the existing windows.- Specified by:
all
in interfaceReadOnlyWindowStore<K,V>
- Returns:
- an iterator over windowed key-value pairs
<Windowed<K>, value>
-
fetchAll
@Deprecated public KeyValueIterator<Windowed<K>,V> fetchAll(long timeFrom, long timeTo)
Deprecated.Description copied from interface:ReadOnlyWindowStore
Gets all the key-value pairs that belong to the windows within in the given time range.- Specified by:
fetchAll
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
timeFrom
- the beginning of the time slot from which to search (inclusive)timeTo
- the end of the time slot from which to search (inclusive)- Returns:
- an iterator over windowed key-value pairs
<Windowed<K>, value>
-
fetchAll
public KeyValueIterator<Windowed<K>,V> fetchAll(Instant from, Instant to) throws IllegalArgumentException
Description copied from interface:ReadOnlyWindowStore
Gets all the key-value pairs that belong to the windows within in the given time range.- Specified by:
fetchAll
in interfaceReadOnlyWindowStore<K,V>
- Parameters:
from
- the beginning of the time slot from which to search (inclusive)to
- the end of the time slot from which to search (inclusive)- Returns:
- an iterator over windowed key-value pairs
<Windowed<K>, value>
- Throws:
IllegalArgumentException
- if duration is negative or can't be represented aslong milliseconds
-
-