public class HollowPrimaryKeyIndex extends java.lang.Object implements HollowTypeStateListener
A primary key index can be used to index and query a type by a PrimaryKey
. The provided PrimaryKey
does
not have to be the same as declared as the default in the data model.
Constructor and Description |
---|
HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine,
ArraySegmentRecycler memoryRecycler,
java.lang.String type,
java.lang.String... fieldPaths) |
HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine,
PrimaryKey primaryKey) |
HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine,
PrimaryKey primaryKey,
ArraySegmentRecycler memoryRecycler) |
HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine,
PrimaryKey primaryKey,
ArraySegmentRecycler memoryRecycler,
java.util.BitSet specificOrdinalsToIndex)
This initializer can be used to create a HollowPrimaryKeyIndex which will only index a subset of the records in the specified type.
|
HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine,
java.lang.String type,
java.lang.String... fieldPaths) |
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
|
boolean |
containsDuplicates()
Returns whether or not this index contains duplicate records (two or more records mapping to a single primary key).
|
void |
destroy() |
void |
detachFromDeltaUpdates()
Once called, this HollowPrimaryKeyIndex 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.
|
java.util.Collection<java.lang.Object[]> |
getDuplicateKeys()
Returns any keys which are mapped to two or more records.
|
java.util.List<HollowObjectSchema.FieldType> |
getFieldTypes() |
int |
getMatchingOrdinal(java.lang.Object... keys)
Query an index with four or more specified fields.
|
int |
getMatchingOrdinal(java.lang.Object key)
Query an index with a single specified field.
|
int |
getMatchingOrdinal(java.lang.Object key1,
java.lang.Object key2)
Query an index with two specified fields.
|
int |
getMatchingOrdinal(java.lang.Object key1,
java.lang.Object key2,
java.lang.Object key3)
Query an index with three specified fields.
|
PrimaryKey |
getPrimaryKey() |
java.lang.Object[] |
getRecordKey(int ordinal) |
HollowObjectTypeReadState |
getTypeState() |
void |
listenForDeltaUpdates()
Once called, this HollowPrimaryKeyIndex 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 HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, java.lang.String type, java.lang.String... fieldPaths)
public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, PrimaryKey primaryKey)
public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, ArraySegmentRecycler memoryRecycler, java.lang.String type, java.lang.String... fieldPaths)
public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, PrimaryKey primaryKey, ArraySegmentRecycler memoryRecycler)
public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, PrimaryKey primaryKey, ArraySegmentRecycler memoryRecycler, java.util.BitSet specificOrdinalsToIndex)
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 HollowObjectTypeReadState getTypeState()
public PrimaryKey getPrimaryKey()
public java.util.List<HollowObjectSchema.FieldType> getFieldTypes()
public int getMatchingOrdinal(java.lang.Object key)
Use a generated API or the Generic Object API to use the returned ordinal.
public int getMatchingOrdinal(java.lang.Object key1, java.lang.Object key2)
Use a generated API or the Generic Object API to use the returned ordinal.
public int getMatchingOrdinal(java.lang.Object key1, java.lang.Object key2, java.lang.Object key3)
Use a generated API or the Generic Object API to use the returned ordinal.
public int getMatchingOrdinal(java.lang.Object... keys)
Use a generated API or the Generic Object API to use the returned ordinal.
public boolean containsDuplicates()
public java.util.Collection<java.lang.Object[]> getDuplicateKeys()
public void beginUpdate()
HollowTypeStateListener
beginUpdate
in interface HollowTypeStateListener
public void addedOrdinal(int ordinal)
HollowTypeStateListener
addedOrdinal
in interface HollowTypeStateListener
public void removedOrdinal(int ordinal)
HollowTypeStateListener
removedOrdinal
in interface HollowTypeStateListener
public void endUpdate()
HollowTypeStateListener
endUpdate
in interface HollowTypeStateListener
public void destroy()
public java.lang.Object[] getRecordKey(int ordinal)