public class StreamerTreeIndexProvider<E,K,V> extends StreamerIndexProviderAdapter<E,K,V>
StreamerIndexProvider
.
The advantage of a tree index is that it maintains entries in a
sorted order, which is invaluable for many kinds of tasks, where
event ordering makes sense (like GridStreamingPopularNumbersExample
).
The drawback is that the index entry values should be comparable to each other,
and you'll are likely to need to implement a custom comparator for values in
place of a default one.
If ordering is not required, consider using StreamerHashIndexProvider
instead, which is more efficient (O(1) vs. O(log(n))) and does not require
comparability.
StreamerHashIndexProvider
StreamerIndexProviderAdapter.DedupTrackingEntry<E,K,V>, StreamerIndexProviderAdapter.Entry<E,K,V>, StreamerIndexProviderAdapter.EventTrackingEntry<E,K,V>, StreamerIndexProviderAdapter.IndexKey<V>, StreamerIndexProviderAdapter.NonTrackingEntry<E,K,V>
entryToKey, entryToVal
Constructor and Description |
---|
StreamerTreeIndexProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
add(E evt,
K key,
StreamerIndexUpdateSync sync)
Add event to the index.
|
protected void |
endUpdate0(StreamerIndexUpdateSync sync,
E evt,
K key,
boolean rollback) |
protected StreamerIndex<E,K,V> |
index0() |
void |
initialize()
Initializes the index.
|
protected StreamerIndexProviderAdapter.IndexKey<V> |
nextKey(V val) |
protected void |
remove(E evt,
K key,
StreamerIndexUpdateSync sync)
Remove event from the index.
|
void |
reset0()
Called on reset.
|
void |
setComparator(Comparator<V> cmp)
Sets comparator.
|
boolean |
sorted()
Returns
true if index supports sorting and therefore can perform range operations. |
add, addEvent, addToCollection, addToMap, dispose, endUpdate, eventsCount, getName, getPolicy, getUpdater, index, isUnique, lockIndexKey, name, newEntry, policy, readLock, readUnlock, remove, removeEvent, removeFromCollection, removeFromMap, reset, setName, setPolicy, setUnique, setUpdater, size, toString, trieGet, unique, unlockIndexKey, updaterClass, writeLock, writeUnlock
public void setComparator(Comparator<V> cmp)
cmp
- Comparator.protected StreamerIndex<E,K,V> index0()
index0
in class StreamerIndexProviderAdapter<E,K,V>
public void initialize()
public void reset0()
reset0
in class StreamerIndexProviderAdapter<E,K,V>
protected void add(E evt, K key, StreamerIndexUpdateSync sync)
add
in class StreamerIndexProviderAdapter<E,K,V>
evt
- Event.key
- key.sync
- Sync.protected void remove(E evt, K key, StreamerIndexUpdateSync sync)
remove
in class StreamerIndexProviderAdapter<E,K,V>
evt
- Event.key
- Key.sync
- Sync.protected void endUpdate0(StreamerIndexUpdateSync sync, E evt, K key, boolean rollback)
endUpdate0
in class StreamerIndexProviderAdapter<E,K,V>
sync
- Sync.evt
- Event.key
- Key.rollback
- Rollback flag.protected StreamerIndexProviderAdapter.IndexKey<V> nextKey(V val)
val
- Value.public boolean sorted()
true
if index supports sorting and therefore can perform range operations.
Follow @ApacheIgnite
Apache Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015