public class OChainedIndexProxy<T> extends Object implements OIndexInternal
OSQLFilterItemField.FieldChain
(which define "way" to our property), and
then process operations consequently using previously created indexes.
This class provides possibility to find optimal chain of indexes and then use it just like it was index for traversed property.
IMPORTANT: this class is only for internal usage!
ALGORITHM, CONFIG_AUTOMATIC, CONFIG_KEYTYPE, CONFIG_NAME, CONFIG_TYPE, INDEX_DEFINITION, INDEX_DEFINITION_CLASS, INDEX_VERSION, METADATA, VALUE_CONTAINER_ALGORITHM
MERGE_KEYS
Modifier and Type | Method and Description |
---|---|
boolean |
acquireAtomicExclusiveLock(Object key)
Acquires exclusive lock in the active atomic operation running on the current thread for this
index.
|
OIndex |
addCluster(String iClusterName)
Add given cluster to the list of clusters that should be automatically indexed.
|
void |
addTxOperation(OIndexAbstract.IndexTxSnapshot snapshots,
OTransactionIndexChanges changes) |
boolean |
canBeUsedInEqualityOperators()
Indicates whether given index can be used to calculate result of
OQueryOperatorEquality operators. |
OIndex |
clear()
Deprecated.
Manual indexes are deprecated and will be removed
|
void |
close() |
void |
commit(OIndexAbstract.IndexTxSnapshot snapshots) |
int |
compareTo(OIndex o) |
long |
count(Object iKey)
Counts the entries for the key.
|
OIndex |
create(String name,
OIndexDefinition indexDefinition,
String clusterIndexName,
Set<String> clustersToIndex,
boolean rebuild,
OProgressListener progressListener) |
static <T> Collection<OChainedIndexProxy<T>> |
createProxies(OClass iSchemaClass,
OSQLFilterItemField.FieldChain longChain)
Create proxies that support maximum number of different operations.
|
OIndexCursor |
cursor() |
OIndex |
delete()
Delete the index.
|
OIndexCursor |
descCursor() |
Stream<ORawPair<Object,ORID>> |
descStream() |
void |
doPut(OAbstractPaginatedStorage storage,
Object key,
ORID rid) |
boolean |
doRemove(OAbstractPaginatedStorage storage,
Object key) |
boolean |
doRemove(OAbstractPaginatedStorage storage,
Object key,
ORID rid) |
protected static OIndex |
findBestIndex(Iterable<OIndex> indexes)
Finds the index that fits better as a base index in chain.
|
void |
flush()
Flushes in-memory changes to disk.
|
T |
get(Object key)
Deprecated.
|
String |
getAlgorithm()
Returns the engine of the index as string.
|
Set<String> |
getClusters()
Returns Names of clusters that will be indexed.
|
Object |
getCollatingValue(Object key) |
ODocument |
getConfiguration()
Returns the index configuration.
|
String |
getDatabaseName() |
OIndexDefinition |
getDefinition() |
Object |
getFirstKey() |
int |
getIndexId() |
String |
getIndexNameByKey(Object key)
Returns the index name for a key.
|
List<String> |
getIndexNames() |
OIndexInternal |
getInternal()
Returns internal index of last chain index, because proxy applicable to all operations that
last index applicable.
|
long |
getKeySize() |
OType[] |
getKeyTypes()
Types of the keys that index can accept, if index contains composite key, list of types of
elements from which this index consist will be returned, otherwise single element (key type
obviously) will be returned.
|
Object |
getLastKey() |
ODocument |
getMetadata() |
String |
getName()
Returns the index name.
|
long |
getRebuildVersion() |
Stream<ORID> |
getRids(Object key) |
long |
getSize() |
String |
getType()
Returns the type of the index as string.
|
int |
getVersion()
Returns binary format version for this index.
|
boolean |
hasRangeQuerySupport() |
Iterable<OTransactionIndexChangesPerKey.OTransactionIndexEntry> |
interpretTxKeyChanges(OTransactionIndexChangesPerKey changes) |
static boolean |
isAppropriateAsBase(OIndex index)
Checks if index can be used as base index.
|
boolean |
isAutomatic()
Tells if the index is automatic.
|
boolean |
isNativeTxSupported() |
boolean |
isRebuilding() |
boolean |
isUnique() |
OIndexCursor |
iterateEntries(Collection<?> keys,
boolean ascSortOrder)
Returns cursor which presents data associated with passed in keys.
|
OIndexCursor |
iterateEntriesBetween(Object fromKey,
boolean fromInclusive,
Object toKey,
boolean toInclusive,
boolean ascOrder)
Returns cursor which presents subset of index data between passed in keys.
|
OIndexCursor |
iterateEntriesMajor(Object fromKey,
boolean fromInclusive,
boolean ascOrder)
Returns cursor which presents subset of data which associated with key which is greater than
passed in key.
|
OIndexCursor |
iterateEntriesMinor(Object toKey,
boolean toInclusive,
boolean ascOrder)
Returns cursor which presents subset of data which associated with key which is less than
passed in key.
|
Iterator<Map.Entry<Object,T>> |
iterator() |
OIndexKeyCursor |
keyCursor() |
Stream<Object> |
keyStream() |
boolean |
loadFromConfiguration(ODocument iConfig)
Loads the index giving the configuration.
|
OIndexMetadata |
loadMetadata(ODocument iConfig) |
void |
postCommit(OIndexAbstract.IndexTxSnapshot snapshots) |
void |
preCommit(OIndexAbstract.IndexTxSnapshot snapshots) |
OIndex |
put(Object key,
OIdentifiable value)
Inserts a new entry in the index.
|
long |
rebuild()
Rebuilds an automatic index.
|
long |
rebuild(OProgressListener iProgressListener)
Populate the index with all the existent records.
|
boolean |
remove(Object key)
Removes an entry by its key.
|
boolean |
remove(Object key,
OIdentifiable rid)
Removes an entry by its key and value.
|
OIndex |
removeCluster(String iClusterName)
Remove given cluster from the list of clusters that should be automatically indexed.
|
void |
setType(OType type) |
long |
size() |
Stream<ORawPair<Object,ORID>> |
stream() |
Stream<ORawPair<Object,ORID>> |
streamEntries(Collection<?> keys,
boolean ascSortOrder)
Returns stream which presents data associated with passed in keys.
|
Stream<ORawPair<Object,ORID>> |
streamEntriesBetween(Object fromKey,
boolean fromInclusive,
Object toKey,
boolean toInclusive,
boolean ascOrder)
Returns stream which presents subset of index data between passed in keys.
|
Stream<ORawPair<Object,ORID>> |
streamEntriesMajor(Object fromKey,
boolean fromInclusive,
boolean ascOrder)
Returns stream which presents subset of data which associated with key which is greater than
passed in key.
|
Stream<ORawPair<Object,ORID>> |
streamEntriesMinor(Object toKey,
boolean toInclusive,
boolean ascOrder)
Returns stream which presents subset of data which associated with key which is less than
passed in key.
|
boolean |
supportsOrderedIterations() |
ODocument |
updateConfiguration()
Saves the index configuration to disk.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isLabelSecurityDefined, isReadRestrictedBySecurityPolicy, securityFilterOnRead, securityFilterOnRead
public static <T> Collection<OChainedIndexProxy<T>> createProxies(OClass iSchemaClass, OSQLFilterItemField.FieldChain longChain)
UNIQUE
and FULLTEXT
types) are possible, the creates the only one index of each type.longChain
- - property chain from the query, which should be evaluatedprotected static OIndex findBestIndex(Iterable<OIndex> indexes)
indexes
- where searchpublic static boolean isAppropriateAsBase(OIndex index)
index
- to checkpublic String getDatabaseName()
getDatabaseName
in interface OIndex
@Deprecated public T get(Object key)
public Stream<ORID> getRids(Object key)
getRids
in interface OIndexInternal
public OIndexInternal getInternal()
getInternal
in interface OIndex
public OIndexDefinition getDefinition()
getDefinition
in interface OIndex
public OIndex create(String name, OIndexDefinition indexDefinition, String clusterIndexName, Set<String> clustersToIndex, boolean rebuild, OProgressListener progressListener)
public OType[] getKeyTypes()
OIndex
getKeyTypes
in interface OIndex
public OIndex put(Object key, OIdentifiable value)
OIndex
public boolean remove(Object key)
OIndex
public boolean remove(Object key, OIdentifiable rid)
OIndex
@Deprecated public OIndex clear()
public long getSize()
public long count(Object iKey)
OIndex
public long getKeySize()
getKeySize
in interface OIndex
public void flush()
OIndex
public long getRebuildVersion()
getRebuildVersion
in interface OIndex
public boolean isRebuilding()
isRebuilding
in interface OIndex
OIndex.getRebuildVersion()
public Object getFirstKey()
getFirstKey
in interface OIndex
public Object getLastKey()
getLastKey
in interface OIndex
public OIndexCursor cursor()
public OIndexCursor descCursor()
descCursor
in interface OIndex
public OIndexKeyCursor keyCursor()
public Object getCollatingValue(Object key)
getCollatingValue
in interface OIndexInternal
public boolean loadFromConfiguration(ODocument iConfig)
OIndexInternal
loadFromConfiguration
in interface OIndexInternal
iConfig
- ODocument instance containing the configurationpublic ODocument updateConfiguration()
OIndexInternal
updateConfiguration
in interface OIndexInternal
OIndex.getConfiguration()
public OIndex addCluster(String iClusterName)
OIndexInternal
addCluster
in interface OIndexInternal
iClusterName
- Cluster to add.public OIndex removeCluster(String iClusterName)
OIndexInternal
removeCluster
in interface OIndexInternal
iClusterName
- Cluster to remove.public boolean canBeUsedInEqualityOperators()
OIndexInternal
OQueryOperatorEquality
operators.canBeUsedInEqualityOperators
in interface OIndexInternal
true
if given index can be used to calculate result of OQueryOperatorEquality
operators.public boolean hasRangeQuerySupport()
hasRangeQuerySupport
in interface OIndexInternal
public OIndexMetadata loadMetadata(ODocument iConfig)
loadMetadata
in interface OIndexInternal
public void close()
close
in interface OIndexInternal
public void preCommit(OIndexAbstract.IndexTxSnapshot snapshots)
preCommit
in interface OIndexInternal
public void addTxOperation(OIndexAbstract.IndexTxSnapshot snapshots, OTransactionIndexChanges changes)
addTxOperation
in interface OIndexInternal
public void commit(OIndexAbstract.IndexTxSnapshot snapshots)
commit
in interface OIndexInternal
public void postCommit(OIndexAbstract.IndexTxSnapshot snapshots)
postCommit
in interface OIndexInternal
public void setType(OType type)
setType
in interface OIndexInternal
public String getIndexNameByKey(Object key)
OIndexInternal
getIndexNameByKey
in interface OIndexInternal
key
- the index key.public boolean acquireAtomicExclusiveLock(Object key)
OIndexInternal
If this index supports a more narrow locking, for example key-based sharding, it may use the
provided key
to infer a more narrow lock scope, but that is not a requirement.
acquireAtomicExclusiveLock
in interface OIndexInternal
key
- the index key to lock.true
if this index was locked entirely, false
if this index locking is
sensitive to the provided key
and only some subset of this index was locked.public long size()
size
in interface OIndexInternal
public String getType()
OIndex
public String getAlgorithm()
OIndex
getAlgorithm
in interface OIndex
public boolean isAutomatic()
OIndex
isAutomatic
in interface OIndex
public long rebuild()
OIndex
public long rebuild(OProgressListener iProgressListener)
OIndex
public ODocument getConfiguration()
OIndex
getConfiguration
in interface OIndex
public ODocument getMetadata()
getMetadata
in interface OIndex
public Set<String> getClusters()
OIndex
getClusters
in interface OIndex
public OIndexCursor iterateEntries(Collection<?> keys, boolean ascSortOrder)
OIndex
iterateEntries
in interface OIndex
keys
- Keys data of which should be returned.ascSortOrder
- Flag which determines whether data iterated by cursor should be in
ascending or descending order.public OIndexCursor iterateEntriesBetween(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive, boolean ascOrder)
OIndex
iterateEntriesBetween
in interface OIndex
fromKey
- Lower border of index data.fromInclusive
- Indicates whether lower border should be inclusive or exclusive.toKey
- Upper border of index data.toInclusive
- Indicates whether upper border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by cursor should be in ascending or
descending order.public OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder)
OIndex
iterateEntriesMajor
in interface OIndex
fromKey
- Lower border of index data.fromInclusive
- Indicates whether lower border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by cursor should be in ascending or
descending order.public OIndexCursor iterateEntriesMinor(Object toKey, boolean toInclusive, boolean ascOrder)
OIndex
iterateEntriesMinor
in interface OIndex
toKey
- Upper border of index data.toInclusive
- Indicates Indicates whether upper border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by cursor should be in ascending or
descending order.public int getIndexId()
getIndexId
in interface OIndex
public Stream<ORawPair<Object,ORID>> stream()
stream
in interface OIndexInternal
public Stream<ORawPair<Object,ORID>> descStream()
descStream
in interface OIndexInternal
public Stream<Object> keyStream()
keyStream
in interface OIndexInternal
public int getVersion()
OIndex
getVersion
in interface OIndex
public boolean supportsOrderedIterations()
supportsOrderedIterations
in interface OIndex
public Stream<ORawPair<Object,ORID>> streamEntries(Collection<?> keys, boolean ascSortOrder)
OIndexInternal
streamEntries
in interface OIndexInternal
keys
- Keys data of which should be returned.ascSortOrder
- Flag which determines whether data iterated by stream should be in
ascending or descending order.public Stream<ORawPair<Object,ORID>> streamEntriesBetween(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive, boolean ascOrder)
OIndexInternal
streamEntriesBetween
in interface OIndexInternal
fromKey
- Lower border of index data.fromInclusive
- Indicates whether lower border should be inclusive or exclusive.toKey
- Upper border of index data.toInclusive
- Indicates whether upper border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by stream should be in ascending or
descending order.public Stream<ORawPair<Object,ORID>> streamEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder)
OIndexInternal
streamEntriesMajor
in interface OIndexInternal
fromKey
- Lower border of index data.fromInclusive
- Indicates whether lower border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by stream should be in ascending or
descending order.public Stream<ORawPair<Object,ORID>> streamEntriesMinor(Object toKey, boolean toInclusive, boolean ascOrder)
OIndexInternal
streamEntriesMinor
in interface OIndexInternal
toKey
- Upper border of index data.toInclusive
- Indicates Indicates whether upper border should be inclusive or exclusive.ascOrder
- Flag which determines whether data iterated by stream should be in ascending or
descending order.public boolean isNativeTxSupported()
isNativeTxSupported
in interface OIndexInternal
public Iterable<OTransactionIndexChangesPerKey.OTransactionIndexEntry> interpretTxKeyChanges(OTransactionIndexChangesPerKey changes)
interpretTxKeyChanges
in interface OIndexInternal
public void doPut(OAbstractPaginatedStorage storage, Object key, ORID rid)
doPut
in interface OIndexInternal
public boolean doRemove(OAbstractPaginatedStorage storage, Object key, ORID rid)
doRemove
in interface OIndexInternal
public boolean doRemove(OAbstractPaginatedStorage storage, Object key)
doRemove
in interface OIndexInternal
public int compareTo(OIndex o)
compareTo
in interface Comparable<OIndex>
Copyright © 2009–2020 OrientDB. All rights reserved.