public class GridStreamerTreeIndexProvider<E,K,V> extends GridStreamerIndexProviderAdapter<E,K,V>
GridStreamerIndexProvider.
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 GridStreamerHashIndexProvider
instead, which is more efficient (O(1) vs. O(log(n))) and does not require
comparability.
GridStreamerHashIndexProviderGridStreamerIndexProviderAdapter.DedupTrackingEntry<E,K,V>, GridStreamerIndexProviderAdapter.Entry<E,K,V>, GridStreamerIndexProviderAdapter.EventTrackingEntry<E,K,V>, GridStreamerIndexProviderAdapter.IndexKey<V>, GridStreamerIndexProviderAdapter.NonTrackingEntry<E,K,V>entryToKey, entryToVal| Constructor and Description |
|---|
GridStreamerTreeIndexProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(E evt,
K key,
GridStreamerIndexUpdateSync sync)
Add event to the index.
|
protected void |
endUpdate0(GridStreamerIndexUpdateSync sync,
E evt,
K key,
boolean rollback) |
protected GridStreamerIndex<E,K,V> |
index0() |
void |
initialize()
Initializes the index.
|
protected GridStreamerIndexProviderAdapter.IndexKey<V> |
nextKey(V val) |
protected void |
remove(E evt,
K key,
GridStreamerIndexUpdateSync 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, writeUnlockpublic void setComparator(Comparator<V> cmp)
cmp - Comparator.protected GridStreamerIndex<E,K,V> index0()
index0 in class GridStreamerIndexProviderAdapter<E,K,V>public void initialize()
public void reset0()
reset0 in class GridStreamerIndexProviderAdapter<E,K,V>protected void add(E evt, K key, GridStreamerIndexUpdateSync sync) throws GridException
add in class GridStreamerIndexProviderAdapter<E,K,V>evt - Event.key - key.sync - Sync.GridException - If failed.protected void remove(E evt, K key, GridStreamerIndexUpdateSync sync) throws GridException
remove in class GridStreamerIndexProviderAdapter<E,K,V>evt - Event.key - Key.sync - Sync.GridException - If failed.protected void endUpdate0(GridStreamerIndexUpdateSync sync, E evt, K key, boolean rollback)
endUpdate0 in class GridStreamerIndexProviderAdapter<E,K,V>sync - Sync.evt - Event.key - Key.rollback - Rollback flag.protected GridStreamerIndexProviderAdapter.IndexKey<V> nextKey(V val)
val - Value.public boolean sorted()
true if index supports sorting and therefore can perform range operations.Copyright © 2014. All rights reserved.