public abstract class GridStreamerIndexProviderAdapter<E,K,V> extends Object implements GridStreamerIndexProvider<E,K,V>
GridStreamerIndexProvider adapter implementing base configuration methods.| Modifier and Type | Class and Description |
|---|---|
protected static class |
GridStreamerIndexProviderAdapter.DedupTrackingEntry<E,K,V>
Entry with index policy
GridStreamerIndexPolicy.EVENT_TRACKING_ON_DEDUP. |
protected static class |
GridStreamerIndexProviderAdapter.Entry<E,K,V>
Streamer window index entry.
|
protected static class |
GridStreamerIndexProviderAdapter.EventTrackingEntry<E,K,V>
Entry with index policy
GridStreamerIndexPolicy.EVENT_TRACKING_ON. |
protected static interface |
GridStreamerIndexProviderAdapter.IndexKey<V>
Streamer window index key.
|
protected static class |
GridStreamerIndexProviderAdapter.NonTrackingEntry<E,K,V>
Entry with index policy
GridStreamerIndexPolicy.EVENT_TRACKING_OFF. |
| Modifier and Type | Field and Description |
|---|---|
protected GridClosure<GridStreamerIndexEntry<E,K,V>,K> |
entryToKey |
protected GridClosure<GridStreamerIndexEntry<E,K,V>,V> |
entryToVal |
| Constructor and Description |
|---|
GridStreamerIndexProviderAdapter() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
add(E evt,
K key,
GridStreamerIndexUpdateSync sync)
Add event to the index.
|
void |
add(GridStreamerIndexUpdateSync sync,
E evt)
Add event to the index.
|
protected GridStreamerIndexProviderAdapter.Entry<E,K,V> |
addEvent(GridStreamerIndexEntry<E,K,V> oldEntry,
K key,
V val,
GridStreamerIndexProviderAdapter.IndexKey<V> idxKey,
E evt) |
protected static <E> Collection<E> |
addToCollection(Collection<E> col,
E evt) |
protected static <E> Map<E,Integer> |
addToMap(Map<E,Integer> map,
E evt) |
void |
dispose()
Disposes the index.
|
void |
endUpdate(GridStreamerIndexUpdateSync sync,
E evt,
boolean rollback,
boolean rmv)
Finalizes an update operation.
|
protected abstract void |
endUpdate0(GridStreamerIndexUpdateSync sync,
E evt,
K key,
boolean rollback) |
protected int |
eventsCount() |
String |
getName()
Gets index name.
|
GridStreamerIndexPolicy |
getPolicy()
Gets event indexing policy, which defines how events
are tracked within an index.
|
GridStreamerIndexUpdater<E,K,V> |
getUpdater()
Gets index updater.
|
GridStreamerIndex<E,K,V> |
index()
Gets user view for this index.
|
protected abstract GridStreamerIndex<E,K,V> |
index0() |
boolean |
isUnique()
Checks whether this index is unique or not.
|
protected void |
lockIndexKey(GridStreamerIndexProviderAdapter.IndexKey<V> key,
GridStreamerIndexUpdateSync sync)
Lock updates on particular key.
|
String |
name()
Index name.
|
protected GridStreamerIndexProviderAdapter.Entry<E,K,V> |
newEntry(K key,
V val,
GridStreamerIndexProviderAdapter.IndexKey<V> idxKey,
E evt) |
GridStreamerIndexPolicy |
policy()
Gets index policy.
|
protected void |
readLock() |
protected void |
readUnlock() |
protected abstract void |
remove(E evt,
K key,
GridStreamerIndexUpdateSync sync)
Remove event from the index.
|
void |
remove(GridStreamerIndexUpdateSync sync,
E evt)
Remove event from the index.
|
protected GridStreamerIndexProviderAdapter.Entry<E,K,V> |
removeEvent(GridStreamerIndexEntry<E,K,V> oldEntry,
K key,
V val,
GridStreamerIndexProviderAdapter.IndexKey<V> idxKey,
E evt) |
protected static <E> Collection<E> |
removeFromCollection(Collection<E> col,
E evt) |
protected static <E> Map<E,Integer> |
removeFromMap(Map<E,Integer> map,
E evt) |
void |
reset()
Resets the index to an initial empty state.
|
protected abstract void |
reset0()
Called on reset.
|
void |
setName(String name)
Sets index name.
|
void |
setPolicy(GridStreamerIndexPolicy plc)
Sets index policy.
|
void |
setUnique(boolean unique)
Sets unique flag.
|
void |
setUpdater(GridStreamerIndexUpdater<E,K,V> updater)
Sets index updater.
|
int |
size()
Gets current index size.
|
String |
toString() |
protected static <K,V> V |
trieGet(K key,
TrieMap<K,V> map)
Utility method to safely get values from TrieMap.
|
boolean |
unique()
Gets index unique flag.
|
protected void |
unlockIndexKey(GridStreamerIndexProviderAdapter.IndexKey<V> key,
GridStreamerIndexUpdateSync sync)
Unlock updates on particular key.
|
String |
updaterClass()
Gets index updater class name.
|
protected void |
writeLock() |
protected void |
writeUnlock() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinitializesortedprotected final GridClosure<GridStreamerIndexEntry<E,K,V>,V> entryToVal
protected final GridClosure<GridStreamerIndexEntry<E,K,V>,K> entryToKey
public void setName(String name)
name - Index name.public String getName()
getName in interface GridStreamerIndexProvider<E,K,V>public void setPolicy(GridStreamerIndexPolicy plc)
plc - Policy.public GridStreamerIndexPolicy getPolicy()
getPolicy in interface GridStreamerIndexProvider<E,K,V>public void setUnique(boolean unique)
unique - True for unique index.public boolean isUnique()
Object.equals(Object) returns true), an exception
is thrown.isUnique in interface GridStreamerIndexProvider<E,K,V>True for unique index.public void setUpdater(GridStreamerIndexUpdater<E,K,V> updater)
updater - Updater.public GridStreamerIndexUpdater<E,K,V> getUpdater()
public void dispose()
dispose in interface GridStreamerIndexProvider<E,K,V>public void add(GridStreamerIndexUpdateSync sync, E evt) throws GridException
add in interface GridStreamerIndexProvider<E,K,V>sync - Sync.evt - Event.GridException - If failed to add event to an index.public void remove(GridStreamerIndexUpdateSync sync, E evt) throws GridException
remove in interface GridStreamerIndexProvider<E,K,V>sync - Sync.evt - Event.GridException - If failed to add event to an index.public void endUpdate(GridStreamerIndexUpdateSync sync, E evt, boolean rollback, boolean rmv)
endUpdate in interface GridStreamerIndexProvider<E,K,V>sync - Index update synchronizer.evt - Updated event.rollback - Rollback flag. If true, a rollback was made.rmv - Remove flag. If true, the event was removed from index.protected abstract void endUpdate0(GridStreamerIndexUpdateSync sync, E evt, K key, boolean rollback)
sync - Sync.evt - Event.key - Key.rollback - Rollback flag.public void reset()
reset in interface GridStreamerIndexProvider<E,K,V>public GridStreamerIndex<E,K,V> index()
index in interface GridStreamerIndexProvider<E,K,V>protected abstract void reset0()
protected abstract GridStreamerIndex<E,K,V> index0()
protected void readLock()
protected void readUnlock()
protected void writeLock()
protected void writeUnlock()
protected int eventsCount()
protected abstract void add(E evt, K key, GridStreamerIndexUpdateSync sync) throws GridException
evt - Event.key - key.sync - Sync.GridException - If failed.protected abstract void remove(E evt, K key, GridStreamerIndexUpdateSync sync) throws GridException
evt - Event.key - Key.sync - Sync.GridException - If failed.protected void lockIndexKey(GridStreamerIndexProviderAdapter.IndexKey<V> key, GridStreamerIndexUpdateSync sync) throws GridException
key - Key.sync - Sync.GridException - If failed.protected void unlockIndexKey(GridStreamerIndexProviderAdapter.IndexKey<V> key, GridStreamerIndexUpdateSync sync)
key - Key.sync - Sync.protected GridStreamerIndexProviderAdapter.Entry<E,K,V> newEntry(K key, V val, @Nullable GridStreamerIndexProviderAdapter.IndexKey<V> idxKey, E evt)
key - Key,val - Value.idxKey - Index key.evt - Event.protected GridStreamerIndexProviderAdapter.Entry<E,K,V> addEvent(GridStreamerIndexEntry<E,K,V> oldEntry, K key, V val, @Nullable GridStreamerIndexProviderAdapter.IndexKey<V> idxKey, E evt)
oldEntry - Old entry.key - Key,val - Value.idxKey - Index key.evt - Event.protected GridStreamerIndexProviderAdapter.Entry<E,K,V> removeEvent(GridStreamerIndexEntry<E,K,V> oldEntry, K key, V val, @Nullable GridStreamerIndexProviderAdapter.IndexKey<V> idxKey, E evt)
oldEntry - Old entry.key - Key,val - Value.idxKey - Index key.evt - Event.protected static <E> Collection<E> addToCollection(@Nullable Collection<E> col, E evt)
col - Collection.evt - Event.protected static <E> Map<E,Integer> addToMap(@Nullable Map<E,Integer> map, E evt)
map - Collection.evt - Event.@Nullable protected static <E> Collection<E> removeFromCollection(@Nullable Collection<E> col, E evt)
col - Collection.evt - Event.@Nullable protected static <E> Map<E,Integer> removeFromMap(@Nullable Map<E,Integer> map, E evt)
map - Collection.evt - Event.public String name()
name in interface GridStreamerIndexProviderMBeanpublic String updaterClass()
updaterClass in interface GridStreamerIndexProviderMBeanpublic boolean unique()
unique in interface GridStreamerIndexProviderMBeanpublic GridStreamerIndexPolicy policy()
policy in interface GridStreamerIndexProviderMBeanpublic int size()
size in interface GridStreamerIndexProviderMBeanprotected static <K,V> V trieGet(K key,
TrieMap<K,V> map)
key - Key.map - Trie map.Copyright © 2014. All rights reserved.