public abstract class AbstractIndex extends Object implements InternalIndex
Index.OperationSource
Modifier and Type | Field and Description |
---|---|
protected IndexCopyBehavior |
copyBehavior |
protected Extractors |
extractors |
protected IndexStore |
indexStore |
static ComparableIdentifiedDataSerializable |
NULL
Represents a null-like value that is equal to itself and less than any
other value except
CompositeValue.NEGATIVE_INFINITY . |
protected InternalSerializationService |
ss |
Constructor and Description |
---|
AbstractIndex(IndexDefinition definition,
InternalSerializationService ss,
Extractors extractors,
IndexCopyBehavior copyBehavior,
PerIndexStats stats) |
Modifier and Type | Method and Description |
---|---|
boolean |
canEvaluate(Class<? extends Predicate> predicateClass) |
Comparable |
canonicalizeQueryArgumentScalar(Comparable value)
Canonicalizes the given value for the purpose of a hash-based lookup.
|
void |
clear()
Clears out all entries from this index.
|
protected abstract IndexStore |
createIndexStore(IndexDefinition definition,
PerIndexStats stats) |
void |
destroy()
Releases all resources hold by this index, e.g.
|
Set<QueryableEntry> |
evaluate(Predicate predicate)
Evaluates the given predicate using this index.
|
String[] |
getComponents() |
TypeConverter |
getConverter() |
String |
getName() |
PerIndexStats |
getPerIndexStats()
Returns the index stats associated with this index.
|
Set<QueryableEntry> |
getRecords(Comparable value)
Produces a result set containing entries whose attribute values are equal
to the given value.
|
Set<QueryableEntry> |
getRecords(Comparable[] values)
Produces a result set containing entries whose attribute values are equal
to at least one of the given values.
|
Set<QueryableEntry> |
getRecords(Comparable from,
boolean fromInclusive,
Comparable to,
boolean toInclusive)
Produces a result set by performing a range query on this index with the
range defined by the passed arguments.
|
Set<QueryableEntry> |
getRecords(Comparison comparison,
Comparable value)
Produces a result set containing entries whose attribute values are
satisfy the comparison of the given type with the given value.
|
String |
getUniqueKey() |
boolean |
isEvaluateOnly() |
boolean |
isOrdered()
Tells whether this index is ordered or not.
|
void |
putEntry(QueryableEntry entry,
Object oldValue,
Index.OperationSource operationSource)
Saves the given entry into this index.
|
void |
removeEntry(Data key,
Object value,
Index.OperationSource operationSource)
Removes the entry having the given key and the value from this index.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allPartitionsIndexed, hasPartitionIndexed, markPartitionAsIndexed, markPartitionAsUnindexed
public static final ComparableIdentifiedDataSerializable NULL
CompositeValue.NEGATIVE_INFINITY
. The latter
is needed to establish the ordering of keys for composite indexes.protected final InternalSerializationService ss
protected final Extractors extractors
protected final IndexStore indexStore
protected final IndexCopyBehavior copyBehavior
public AbstractIndex(IndexDefinition definition, InternalSerializationService ss, Extractors extractors, IndexCopyBehavior copyBehavior, PerIndexStats stats)
protected abstract IndexStore createIndexStore(IndexDefinition definition, PerIndexStats stats)
public String getName()
getName
in interface Index
PredicateUtils.canonicalizeAttribute(java.lang.String)
,
PredicateUtils.constructCanonicalCompositeIndexName(java.lang.String[])
public String[] getComponents()
getComponents
in interface Index
public boolean isOrdered()
Index
Ordered indexes support the fast evaluation of range queries. Unordered indexes are still capable to execute range queries, but the performance would be about the same as the full scan performance.
isOrdered
in interface Index
true
if this index is ordered, false
otherwise.Index.getRecords(Comparison, Comparable)
,
Index.getRecords(Comparable, boolean, Comparable, boolean)
public String getUniqueKey()
getUniqueKey
in interface Index
null
if this
index is not a bitmap one.public TypeConverter getConverter()
getConverter
in interface Index
null
if the
converter is not known because there were no saves to this index and
the attribute type is not inferred yet.public void putEntry(QueryableEntry entry, Object oldValue, Index.OperationSource operationSource)
Index
public void removeEntry(Data key, Object value, Index.OperationSource operationSource)
Index
removeEntry
in interface Index
key
- the key of the entry to remove.value
- the value of the entry to remove.operationSource
- the operation source.public boolean isEvaluateOnly()
isEvaluateOnly
in interface Index
true
if this index supports querying only with Index.evaluate(com.hazelcast.query.Predicate)
method, false
otherwise.public boolean canEvaluate(Class<? extends Predicate> predicateClass)
canEvaluate
in interface Index
true
if this index can evaluate a predicate of the given
predicate class, false
otherwise.public Set<QueryableEntry> evaluate(Predicate predicate)
Index
public Set<QueryableEntry> getRecords(Comparable value)
Index
getRecords
in interface Index
value
- the value to compare against.public Set<QueryableEntry> getRecords(Comparable[] values)
Index
getRecords
in interface Index
values
- the values to compare against.public Set<QueryableEntry> getRecords(Comparable from, boolean fromInclusive, Comparable to, boolean toInclusive)
Index
getRecords
in interface Index
from
- the beginning of the range.fromInclusive
- true
if the beginning of the range is
inclusive, false
otherwise.to
- the end of the range.toInclusive
- true
if the end of the range is inclusive,
false
otherwise.public Set<QueryableEntry> getRecords(Comparison comparison, Comparable value)
Index
getRecords
in interface Index
comparison
- the type of the comparison to perform.value
- the value to compare against.public void clear()
Index
public void destroy()
Index
public final Comparable canonicalizeQueryArgumentScalar(Comparable value)
InternalIndex
The method is used while performing InPredicate queries to canonicalize the set of values in question, so additional duplicate-eliminating post-processing step can be avoided.
canonicalizeQueryArgumentScalar
in interface InternalIndex
value
- the value to canonicalize.public PerIndexStats getPerIndexStats()
InternalIndex
getPerIndexStats
in interface InternalIndex
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.