com.orientechnologies.orient.core.index.OIndexInternal Maven / Gradle / Ivy
/*
*
* * Copyright 2014 Orient Technologies LTD (info(at)orientechnologies.com)
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *
* * For more information: http://www.orientechnologies.com
*
*/
package com.orientechnologies.orient.core.index;
import java.util.Collection;
import java.util.Collections;
import java.util.Map.Entry;
import java.util.Set;
import com.orientechnologies.orient.core.db.ODatabaseListener;
import com.orientechnologies.orient.core.record.impl.ODocument;
/**
* Interface to handle index.
*
* @author Luca Garulli (l.garulli--at--orientechnologies.com)
*
*/
public interface OIndexInternal extends OIndex {
public static final String CONFIG_KEYTYPE = "keyType";
public static final String CONFIG_AUTOMATIC = "automatic";
public static final String CONFIG_TYPE = "type";
public static final String ALGORITHM = "algorithm";
public static final String VALUE_CONTAINER_ALGORITHM = "valueContainerAlgorithm";
public static final String CONFIG_NAME = "name";
public static final String INDEX_DEFINITION = "indexDefinition";
public static final String INDEX_DEFINITION_CLASS = "indexDefinitionClass";
public static final String METADATA = "metadata";
/**
* Loads the index giving the configuration.
*
* @param iConfig
* ODocument instance containing the configuration
*
*/
public boolean loadFromConfiguration(ODocument iConfig);
/**
* Saves the index configuration to disk.
*
* @return The configuration as ODocument instance
* @see #getConfiguration()
*/
public ODocument updateConfiguration();
/**
* Add given cluster to the list of clusters that should be automatically indexed.
*
* @param iClusterName
* Cluster to add.
* @return Current index instance.
*/
public OIndex addCluster(final String iClusterName);
/**
* Remove given cluster from the list of clusters that should be automatically indexed.
*
* @param iClusterName
* Cluster to remove.
* @return Current index instance.
*/
public OIndex removeCluster(final String iClusterName);
/**
* Indicates whether given index can be used to calculate result of
* {@link com.orientechnologies.orient.core.sql.operator.OQueryOperatorEquality} operators.
*
* @return {@code true} if given index can be used to calculate result of
* {@link com.orientechnologies.orient.core.sql.operator.OQueryOperatorEquality} operators.
*
*/
public boolean canBeUsedInEqualityOperators();
public boolean hasRangeQuerySupport();
/**
* Prohibit index modifications. Only index read commands are allowed after this call.
*
* @param throwException
* If true
{@link com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException}
* exception will be thrown in case of write command will be performed.
*/
public void freeze(boolean throwException);
/**
* Allow any index modifications. Is called after {@link #freeze(boolean)} command.
*/
public void release();
/**
* Is used to indicate that several index changes are going to be seen as single unit from users point of view. This command is
* used with conjunction of {@link #freeze(boolean)} command.
*/
public void acquireModificationLock();
/**
* Is used to indicate that several index changes are going to be seen as single unit from users point of view were completed.
*/
public void releaseModificationLock();
/**
* Applies exclusive lock on keys which prevents read/modification of this keys in following methods:
*
*
* - {@link #put(Object, com.orientechnologies.orient.core.db.record.OIdentifiable)}
* - {@link #checkEntry(com.orientechnologies.orient.core.db.record.OIdentifiable, Object)}
* - {@link #remove(Object, com.orientechnologies.orient.core.db.record.OIdentifiable)}
* - {@link #remove(Object)}
*
*
*
* If you want to lock several keys in single thread, you should pass all those keys in single method call. Several calls of this
* method in single thread are not allowed because it may lead to deadlocks. Lock is applied only in case if there are no
* transactions.
*
*
* This is internal method and can not be used by end users.
*
* @param key
* Keys to lock.
*/
void lockKeysForUpdateNoTx(Object... key);
/**
* Applies exclusive lock on keys which prevents read/modification of this keys in following methods:
*
*
* - {@link #put(Object, com.orientechnologies.orient.core.db.record.OIdentifiable)}
* - {@link #checkEntry(com.orientechnologies.orient.core.db.record.OIdentifiable, Object)}
* - {@link #remove(Object, com.orientechnologies.orient.core.db.record.OIdentifiable)}
* - {@link #remove(Object)}
*
*
*
* If you want to lock several keys in single thread, you should pass all those keys in single method call. Several calls of this
* method in single thread are not allowed because it may lead to deadlocks. Lock is applied only in case if there are no
* transactions.
*
*
* This is internal method and can not be used by end users.
*
* @param keys
* Keys to lock.
*/
void lockKeysForUpdateNoTx(Collection