public abstract class OIndexAbstract extends Object implements OIndexInternal
OPartitionedLockManager
, the default one, or the OOneEntryPerKeyLockManager
in case of
distributed. This is to avoid deadlock situation between nodes where keys have the same hash
code.Modifier and Type | Class and Description |
---|---|
protected static class |
OIndexAbstract.IndexConfiguration |
static class |
OIndexAbstract.IndexTxSnapshot |
Modifier and Type | Field and Description |
---|---|
protected int |
apiVersion |
protected int |
binaryFormatVersion |
protected Set<String> |
clustersToIndex |
protected static String |
CONFIG_MAP_RID |
protected OIndexAbstract.IndexConfiguration |
configuration |
protected int |
indexId |
protected ODocument |
metadata |
protected OAbstractPaginatedStorage |
storage |
protected String |
type |
protected String |
valueContainerAlgorithm |
ALGORITHM, CONFIG_AUTOMATIC, CONFIG_KEYTYPE, CONFIG_NAME, CONFIG_TYPE, INDEX_DEFINITION, INDEX_DEFINITION_CLASS, INDEX_VERSION, METADATA, VALUE_CONTAINER_ALGORITHM
MERGE_KEYS
Constructor and Description |
---|
OIndexAbstract(String name,
String type,
String algorithm,
String valueContainerAlgorithm,
ODocument metadata,
int version,
OStorage storage,
int binaryFormatVersion) |
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.
|
protected void |
acquireExclusiveLock() |
protected void |
acquireSharedLock() |
OIndexAbstract |
addCluster(String clusterName)
Add given cluster to the list of clusters that should be automatically indexed.
|
void |
addTxOperation(OIndexAbstract.IndexTxSnapshot snapshots,
OTransactionIndexChanges changes) |
OIndex |
clear()
Deprecated.
Manual indexes are deprecated and will be removed
|
protected void |
clearSnapshot(OIndexAbstract.IndexTxSnapshot indexTxSnapshot) |
void |
close() |
void |
commit(OIndexAbstract.IndexTxSnapshot snapshots) |
protected void |
commitSnapshot(Map<Object,Object> snapshot) |
int |
compareTo(OIndex index) |
long |
count(Object iKey)
Deprecated.
|
OIndexInternal |
create(OIndexDefinition indexDefinition,
String clusterIndexName,
Set<String> clustersToIndex,
boolean rebuild,
OProgressListener progressListener,
OBinarySerializer valueSerializer)
Creates the index.
|
OIndexCursor |
cursor()
Deprecated.
|
OIndexInternal |
delete()
Delete the index.
|
OIndexCursor |
descCursor()
Deprecated.
|
protected abstract OBinarySerializer |
determineValueSerializer() |
protected void |
doReloadIndexEngine() |
boolean |
doRemove(OAbstractPaginatedStorage storage,
Object key) |
boolean |
doRemove(OAbstractPaginatedStorage storage,
Object key,
ORID rid) |
boolean |
equals(Object o) |
void |
flush()
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.
|
protected static ODatabaseDocumentInternal |
getDatabase() |
String |
getDatabaseName() |
OIndexDefinition |
getDefinition() |
Object |
getFirstKey()
Deprecated.
|
int |
getIndexId() |
String |
getIndexNameByKey(Object key)
Returns the index name for a key.
|
OIndexInternal |
getInternal()
Returns the internal index used.
|
long |
getKeySize()
Deprecated.
|
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()
Deprecated.
|
ODocument |
getMetadata() |
String |
getName()
Returns the index name.
|
long |
getRebuildVersion()
Deprecated.
|
long |
getSize()
Deprecated.
|
String |
getType()
Returns the type of the index as string.
|
int |
getVersion()
Returns binary format version for this index.
|
int |
hashCode() |
boolean |
hasRangeQuerySupport() |
Iterable<OTransactionIndexChangesPerKey.OTransactionIndexEntry> |
interpretTxKeyChanges(OTransactionIndexChangesPerKey changes)
Interprets transaction index changes for a certain key.
|
boolean |
isAutomatic()
Tells if the index is automatic.
|
boolean |
isRebuilding()
Deprecated.
|
boolean |
isUnique() |
OIndexCursor |
iterateEntries(Collection<?> keys,
boolean ascSortOrder)
Deprecated.
|
OIndexCursor |
iterateEntriesBetween(Object fromKey,
boolean fromInclusive,
Object toKey,
boolean toInclusive,
boolean ascOrder)
Deprecated.
|
OIndexCursor |
iterateEntriesMajor(Object fromKey,
boolean fromInclusive,
boolean ascOrder)
Deprecated.
|
OIndexCursor |
iterateEntriesMinor(Object toKey,
boolean toInclusive,
boolean ascOrder)
Deprecated.
|
OIndexKeyCursor |
keyCursor()
Deprecated.
|
Stream<Object> |
keyStream() |
boolean |
loadFromConfiguration(ODocument config)
Loads the index giving the configuration.
|
OIndexMetadata |
loadMetadata(ODocument config) |
static OIndexMetadata |
loadMetadataInternal(ODocument config,
String type,
String algorithm,
String valueContainerAlgorithm) |
static void |
manualIndexesWarning() |
protected void |
onIndexEngineChange(int indexId) |
void |
postCommit(OIndexAbstract.IndexTxSnapshot snapshots) |
void |
preCommit(OIndexAbstract.IndexTxSnapshot snapshots) |
protected void |
putInSnapshot(Object key,
OIdentifiable value,
Map<Object,Object> snapshot) |
long |
rebuild()
Rebuilds an automatic index.
|
long |
rebuild(OProgressListener iProgressListener)
Populate the index with all the existent records.
|
protected void |
releaseExclusiveLock() |
protected void |
releaseSharedLock() |
boolean |
remove(Object key)
Removes an entry by its key.
|
boolean |
remove(Object key,
OIdentifiable rid)
Removes an entry by its key and value.
|
OIndexAbstract |
removeCluster(String iClusterName)
Remove given cluster from the list of clusters that should be automatically indexed.
|
protected void |
removeFromSnapshot(Object key,
OIdentifiable value,
Map<Object,Object> snapshot) |
void |
setType(OType type) |
String |
toString() |
ODocument |
updateConfiguration()
Saves the index configuration to disk.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
canBeUsedInEqualityOperators, descStream, doPut, getRids, isLabelSecurityDefined, isNativeTxSupported, isReadRestrictedBySecurityPolicy, securityFilterOnRead, securityFilterOnRead, size, stream, streamEntries, streamEntriesBetween, streamEntriesMajor, streamEntriesMinor
create, get, put, supportsOrderedIterations
protected static final String CONFIG_MAP_RID
protected final String type
protected final ODocument metadata
protected final OAbstractPaginatedStorage storage
protected volatile OIndexAbstract.IndexConfiguration configuration
protected volatile String valueContainerAlgorithm
protected volatile int indexId
protected volatile int apiVersion
protected final int binaryFormatVersion
public static OIndexMetadata loadMetadataInternal(ODocument config, String type, String algorithm, String valueContainerAlgorithm)
public boolean hasRangeQuerySupport()
hasRangeQuerySupport
in interface OIndexInternal
public OIndexInternal create(OIndexDefinition indexDefinition, String clusterIndexName, Set<String> clustersToIndex, boolean rebuild, OProgressListener progressListener, OBinarySerializer valueSerializer)
clusterIndexName
- Cluster name where to place the TreeMapprotected void doReloadIndexEngine()
public boolean loadFromConfiguration(ODocument config)
OIndexInternal
loadFromConfiguration
in interface OIndexInternal
config
- ODocument instance containing the configurationpublic OIndexMetadata loadMetadata(ODocument config)
loadMetadata
in interface OIndexInternal
public long rebuild()
public void close()
close
in interface OIndexInternal
@Deprecated public long getSize()
@Deprecated public long count(Object iKey)
@Deprecated public long getKeySize()
getKeySize
in interface OIndex
@Deprecated public void flush()
@Deprecated public long getRebuildVersion()
getRebuildVersion
in interface OIndex
@Deprecated public boolean isRebuilding()
isRebuilding
in interface OIndex
getRebuildVersion()
@Deprecated public Object getFirstKey()
getFirstKey
in interface OIndex
@Deprecated public Object getLastKey()
getLastKey
in interface OIndex
@Deprecated public OIndexCursor cursor()
@Deprecated public OIndexCursor descCursor()
descCursor
in interface OIndex
@Deprecated public OIndexKeyCursor keyCursor()
@Deprecated 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.@Deprecated 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.@Deprecated 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.@Deprecated 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 long rebuild(OProgressListener iProgressListener)
public boolean doRemove(OAbstractPaginatedStorage storage, Object key, ORID rid) throws OInvalidIndexEngineIdException
doRemove
in interface OIndexInternal
OInvalidIndexEngineIdException
public boolean remove(Object key, OIdentifiable rid)
OIndex
public boolean remove(Object key)
OIndex
public boolean doRemove(OAbstractPaginatedStorage storage, Object key) throws OInvalidIndexEngineIdException
doRemove
in interface OIndexInternal
OInvalidIndexEngineIdException
@Deprecated public OIndex clear()
public OIndexInternal delete()
OIndex
public String getType()
OIndex
public void setType(OType type)
setType
in interface OIndexInternal
public String getAlgorithm()
OIndex
getAlgorithm
in interface OIndex
public OIndexInternal getInternal()
OIndex
getInternal
in interface OIndex
public Set<String> getClusters()
OIndex
getClusters
in interface OIndex
public OIndexAbstract addCluster(String clusterName)
OIndexInternal
addCluster
in interface OIndexInternal
clusterName
- Cluster to add.public OIndexAbstract removeCluster(String iClusterName)
OIndexInternal
removeCluster
in interface OIndexInternal
iClusterName
- Cluster to remove.public int getVersion()
OIndex
getVersion
in interface OIndex
public ODocument updateConfiguration()
OIndexInternal
updateConfiguration
in interface OIndexInternal
OIndex.getConfiguration()
public void addTxOperation(OIndexAbstract.IndexTxSnapshot snapshots, OTransactionIndexChanges changes)
addTxOperation
in interface OIndexInternal
public Iterable<OTransactionIndexChangesPerKey.OTransactionIndexEntry> interpretTxKeyChanges(OTransactionIndexChangesPerKey changes)
ORecordDuplicatedException
while applying index
changes.interpretTxKeyChanges
in interface OIndexInternal
changes
- the changes to interpret.public void commit(OIndexAbstract.IndexTxSnapshot snapshots)
commit
in interface OIndexInternal
public void preCommit(OIndexAbstract.IndexTxSnapshot snapshots)
preCommit
in interface OIndexInternal
public void postCommit(OIndexAbstract.IndexTxSnapshot snapshots)
postCommit
in interface OIndexInternal
public ODocument getConfiguration()
OIndex
getConfiguration
in interface OIndex
public ODocument getMetadata()
getMetadata
in interface OIndex
public boolean isAutomatic()
OIndex
isAutomatic
in interface OIndex
public OType[] getKeyTypes()
OIndex
getKeyTypes
in interface OIndex
public Stream<Object> keyStream()
keyStream
in interface OIndexInternal
public OIndexDefinition getDefinition()
getDefinition
in interface OIndex
public int getIndexId()
getIndexId
in interface OIndex
public String getDatabaseName()
getDatabaseName
in interface OIndex
protected abstract OBinarySerializer determineValueSerializer()
public Object getCollatingValue(Object key)
getCollatingValue
in interface OIndexInternal
protected void putInSnapshot(Object key, OIdentifiable value, Map<Object,Object> snapshot)
protected void removeFromSnapshot(Object key, OIdentifiable value, Map<Object,Object> snapshot)
protected void clearSnapshot(OIndexAbstract.IndexTxSnapshot indexTxSnapshot)
public int compareTo(OIndex index)
compareTo
in interface Comparable<OIndex>
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.protected static ODatabaseDocumentInternal getDatabase()
protected void releaseExclusiveLock()
protected void acquireExclusiveLock()
protected void releaseSharedLock()
protected void acquireSharedLock()
protected void onIndexEngineChange(int indexId)
public static void manualIndexesWarning()
Copyright © 2009–2020 OrientDB. All rights reserved.