public interface StreamerIndexUpdater<E,K,V>
Updater is provided to index provider in configuration usually via
StreamerIndexProviderAdapter.setUpdater(StreamerIndexUpdater)
method.
Modifier and Type | Method and Description |
---|---|
K |
indexKey(E evt)
Given an event, extract index key.
|
V |
initialValue(E evt,
K key)
Gets initial value for the index or
null if event should be ignored. |
V |
onAdded(StreamerIndexEntry<E,K,V> entry,
E evt)
Callback invoked whenever an event is being added to the window.
|
V |
onRemoved(StreamerIndexEntry<E,K,V> entry,
E evt)
Callback invoked whenever an event is being removed from the window and has
index entry for given key.
|
@Nullable K indexKey(E evt)
If null
is returned then event will be ignored by the index.
evt
- Event being added or removed from the window.@Nullable V initialValue(E evt, K key)
null
if event should be ignored.
This method is called every time when an entry is added to the window in
order to get initial value for given key.evt
- Event being added to or removed from window.key
- Index key return by indexKey(Object)
method.null
then event will be
ignored and index entry will not be created.@Nullable V onAdded(StreamerIndexEntry<E,K,V> entry, E evt) throws IgniteException
null
, then current entry will
be removed from the index.
If index is sorted, then sorting happens based on the returned value.
entry
- Current index entry.evt
- New event.null
, then current
index entry will be removed the index.IgniteException
- If entry should not be added to index (e.g. if uniqueness is violated).@Nullable V onRemoved(StreamerIndexEntry<E,K,V> entry, E evt)
onRemoved()
will not be called.
Given a key and a current index value for this key, the implementation should return the new
value for this key. If returned value is null
, then current entry will
be removed from the index.
If index is sorted, then sorting happens based on the returned value.
entry
- Current index entry.evt
- Event being removed from the window.null
, then current
index entry will be removed the index.
Follow @ApacheIgnite
Apache Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 16 2015