public class HollowHashIndex extends java.lang.Object implements HollowTypeStateListener
The field definitions in a hash key may be hierarchical (traverse multiple record types) via dot-notation. For example, the field definition actors.element.actorId may be used to traverse a child LIST or SET type record referenced by the field actors, each elements contained therein, and finally each actors actorId field.
Modifier and Type | Class and Description |
---|---|
protected static class |
HollowHashIndex.HollowHashIndexState |
Constructor and Description |
---|
HollowHashIndex(HollowReadStateEngine stateEngine,
java.lang.String type,
java.lang.String selectField,
java.lang.String... matchFields)
Define a
HollowHashIndex . |
Modifier and Type | Method and Description |
---|---|
void |
addedOrdinal(int ordinal)
Called once for each record which is added to the registered type.
|
void |
beginUpdate()
Called immediately before a delta update is applied to the state engine
|
void |
detachFromDeltaUpdates()
Once called, this HollowHashIndex will no longer be kept up-to-date when deltas are applied to the indexed state engine.
|
void |
endUpdate()
Called immediately after a delta update is applied to the state engine.
|
HollowHashIndexResult |
findMatches(java.lang.Object... query)
Query the index.
|
java.lang.String[] |
getMatchFields() |
java.lang.String |
getSelectField() |
HollowReadStateEngine |
getStateEngine() |
java.lang.String |
getType() |
void |
listenForDeltaUpdates()
Once called, this HollowHashIndex will be kept up-to-date when deltas are applied to the indexed state engine.
|
void |
removedOrdinal(int ordinal)
Called once for each record which is removed from the registered type.
|
public HollowHashIndex(HollowReadStateEngine stateEngine, java.lang.String type, java.lang.String selectField, java.lang.String... matchFields)
HollowHashIndex
.stateEngine
- The state engine to indextype
- The query starts with the specified typeselectField
- The query will select records at this field (specify "" to select the specified type).
The selectField may span collection elements and/or map keys or values, which can result in multiple matches per record of the specified start type.matchFields
- The query will match on the specified match fields. The match fields may span collection elements and/or map keys or values.public HollowHashIndexResult findMatches(java.lang.Object... query)
query
- the querynull
value indicated no matches were
found.public void listenForDeltaUpdates()
This method should be called before any subsequent deltas occur after the index is created.
In order to prevent memory leaks, if this method is called and the index is no longer needed, call detachFromDeltaUpdates() before discarding the index.
public void detachFromDeltaUpdates()
Call this method before discarding indexes which are currently listening for delta updates.
public void beginUpdate()
HollowTypeStateListener
beginUpdate
in interface HollowTypeStateListener
public void addedOrdinal(int ordinal)
HollowTypeStateListener
addedOrdinal
in interface HollowTypeStateListener
ordinal
- the ordinal of an object that was addedpublic void removedOrdinal(int ordinal)
HollowTypeStateListener
removedOrdinal
in interface HollowTypeStateListener
ordinal
- the ordinal of an object that was removedpublic void endUpdate()
HollowTypeStateListener
endUpdate
in interface HollowTypeStateListener
public HollowReadStateEngine getStateEngine()
public java.lang.String getType()
public java.lang.String getSelectField()
public java.lang.String[] getMatchFields()