Package com.arcadedb.index
Class TypeIndex
- java.lang.Object
-
- com.arcadedb.index.TypeIndex
-
- All Implemented Interfaces:
Index
,IndexInternal
,RangeIndex
public class TypeIndex extends Object implements RangeIndex, IndexInternal
It represent an index on a type. It's backed by one or multiple underlying indexes, one per bucket. By using multiple buckets, the read/write operation can work concurrently and lock-free.- Author:
- Luca Garulli
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.arcadedb.index.Index
Index.BuildIndexCallback
-
Nested classes/interfaces inherited from interface com.arcadedb.index.IndexInternal
IndexInternal.INDEX_STATUS
-
-
Constructor Summary
Constructors Constructor Description TypeIndex(String logicName, DocumentType type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIndexOnBucket(IndexInternal index)
long
build(int buildIndexBatchSize, Index.BuildIndexCallback callback)
void
close()
boolean
compact()
long
countEntries()
void
drop()
boolean
equals(Object obj)
IndexCursor
get(Object[] keys)
Retrieves the set of RIDs associated to a key.IndexCursor
get(Object[] keys, int limit)
Retrieves the set of RIDs associated to a key with a limit for the result.int
getAssociatedBucketId()
IndexInternal
getAssociatedIndex()
byte[]
getBinaryKeyTypes()
PaginatedComponent
getComponent()
int
getFileId()
List<Integer>
getFileIds()
List<? extends Index>
getIndexesByKeys(Object[] keys)
IndexInternal[]
getIndexesOnBuckets()
Type[]
getKeyTypes()
String
getMostRecentFileName()
String
getName()
LSMTreeIndexAbstract.NULL_STRATEGY
getNullStrategy()
int
getPageSize()
List<String>
getPropertyNames()
Map<String,Long>
getStats()
List<IndexInternal>
getSubIndexes()
Internal Only.Schema.INDEX_TYPE
getType()
TypeIndex
getTypeIndex()
String
getTypeName()
int
hashCode()
boolean
isAutomatic()
boolean
isCompacting()
boolean
isUnique()
boolean
isValid()
IndexCursor
iterator(boolean ascendingOrder)
The returning iterator does not skip deleted entries and it might contains duplicated entries.IndexCursor
iterator(boolean ascendingOrder, Object[] fromKeys, boolean inclusive)
The returning iterator does not skip deleted entries and it might contains duplicated entries.void
put(Object[] keys, RID[] rid)
Add multiple values for one key in the index.IndexCursor
range(boolean ascending, Object[] beginKeys, boolean beginKeysInclusive, Object[] endKeys, boolean endKeysInclusive)
The returning iterator does not skip deleted entries and it might contains duplicated entries.void
remove(Object[] keys)
Removes the keys from the index.void
remove(Object[] keys, Identifiable rid)
Removes an entry keys/record entry from the index.void
removeIndexOnBucket(IndexInternal index)
boolean
scheduleCompaction()
void
setAssociatedIndex(IndexInternal associatedIndex)
void
setMetadata(String name, String[] propertyNames, int associatedBucketId)
void
setNullStrategy(LSMTreeIndexAbstract.NULL_STRATEGY nullStrategy)
boolean
setStatus(IndexInternal.INDEX_STATUS[] expectedStatuses, IndexInternal.INDEX_STATUS newStatus)
void
setTypeIndex(TypeIndex typeIndex)
boolean
supportsOrderedIterations()
JSONObject
toJSON()
String
toString()
-
-
-
Constructor Detail
-
TypeIndex
public TypeIndex(String logicName, DocumentType type)
-
-
Method Detail
-
countEntries
public long countEntries()
- Specified by:
countEntries
in interfaceIndex
-
iterator
public IndexCursor iterator(boolean ascendingOrder)
Description copied from interface:RangeIndex
The returning iterator does not skip deleted entries and it might contains duplicated entries. WARNING: this method does not read pending changes in transaction.- Specified by:
iterator
in interfaceRangeIndex
-
iterator
public IndexCursor iterator(boolean ascendingOrder, Object[] fromKeys, boolean inclusive)
Description copied from interface:RangeIndex
The returning iterator does not skip deleted entries and it might contains duplicated entries. WARNING: this method does not read pending changes in transaction.- Specified by:
iterator
in interfaceRangeIndex
-
range
public IndexCursor range(boolean ascending, Object[] beginKeys, boolean beginKeysInclusive, Object[] endKeys, boolean endKeysInclusive)
Description copied from interface:RangeIndex
The returning iterator does not skip deleted entries and it might contains duplicated entries. WARNING: this method does not read pending changes in transaction.- Specified by:
range
in interfaceRangeIndex
-
get
public IndexCursor get(Object[] keys)
Description copied from interface:Index
Retrieves the set of RIDs associated to a key.
-
get
public IndexCursor get(Object[] keys, int limit)
Description copied from interface:Index
Retrieves the set of RIDs associated to a key with a limit for the result.
-
put
public void put(Object[] keys, RID[] rid)
Description copied from interface:Index
Add multiple values for one key in the index.
-
remove
public void remove(Object[] keys)
Description copied from interface:Index
Removes the keys from the index.
-
remove
public void remove(Object[] keys, Identifiable rid)
Description copied from interface:Index
Removes an entry keys/record entry from the index.
-
compact
public boolean compact() throws IOException, InterruptedException
- Specified by:
compact
in interfaceIndexInternal
- Throws:
IOException
InterruptedException
-
isCompacting
public boolean isCompacting()
- Specified by:
isCompacting
in interfaceIndexInternal
-
scheduleCompaction
public boolean scheduleCompaction()
- Specified by:
scheduleCompaction
in interfaceIndexInternal
-
getMostRecentFileName
public String getMostRecentFileName()
- Specified by:
getMostRecentFileName
in interfaceIndexInternal
-
getType
public Schema.INDEX_TYPE getType()
-
getTypeName
public String getTypeName()
- Specified by:
getTypeName
in interfaceIndex
-
getPropertyNames
public List<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfaceIndex
-
close
public void close()
- Specified by:
close
in interfaceIndexInternal
-
toJSON
public JSONObject toJSON()
- Specified by:
toJSON
in interfaceIndexInternal
-
drop
public void drop()
- Specified by:
drop
in interfaceIndexInternal
-
getStats
public Map<String,Long> getStats()
- Specified by:
getStats
in interfaceIndexInternal
-
getNullStrategy
public LSMTreeIndexAbstract.NULL_STRATEGY getNullStrategy()
- Specified by:
getNullStrategy
in interfaceIndex
-
setNullStrategy
public void setNullStrategy(LSMTreeIndexAbstract.NULL_STRATEGY nullStrategy)
- Specified by:
setNullStrategy
in interfaceIndex
-
supportsOrderedIterations
public boolean supportsOrderedIterations()
- Specified by:
supportsOrderedIterations
in interfaceIndex
-
isAutomatic
public boolean isAutomatic()
- Specified by:
isAutomatic
in interfaceIndex
-
getPageSize
public int getPageSize()
- Specified by:
getPageSize
in interfaceIndexInternal
-
build
public long build(int buildIndexBatchSize, Index.BuildIndexCallback callback)
- Specified by:
build
in interfaceIndexInternal
-
getSubIndexes
public List<IndexInternal> getSubIndexes()
Internal Only. Retrieved the underlying indexes.
-
setMetadata
public void setMetadata(String name, String[] propertyNames, int associatedBucketId)
- Specified by:
setMetadata
in interfaceIndexInternal
-
setStatus
public boolean setStatus(IndexInternal.INDEX_STATUS[] expectedStatuses, IndexInternal.INDEX_STATUS newStatus)
- Specified by:
setStatus
in interfaceIndexInternal
-
getFileId
public int getFileId()
- Specified by:
getFileId
in interfaceIndexInternal
-
getComponent
public PaginatedComponent getComponent()
- Specified by:
getComponent
in interfaceIndexInternal
-
getKeyTypes
public Type[] getKeyTypes()
- Specified by:
getKeyTypes
in interfaceIndexInternal
-
getBinaryKeyTypes
public byte[] getBinaryKeyTypes()
- Specified by:
getBinaryKeyTypes
in interfaceIndexInternal
-
getFileIds
public List<Integer> getFileIds()
- Specified by:
getFileIds
in interfaceIndexInternal
-
setTypeIndex
public void setTypeIndex(TypeIndex typeIndex)
- Specified by:
setTypeIndex
in interfaceIndexInternal
-
getTypeIndex
public TypeIndex getTypeIndex()
- Specified by:
getTypeIndex
in interfaceIndexInternal
-
getAssociatedIndex
public IndexInternal getAssociatedIndex()
- Specified by:
getAssociatedIndex
in interfaceIndexInternal
-
setAssociatedIndex
public void setAssociatedIndex(IndexInternal associatedIndex)
-
getAssociatedBucketId
public int getAssociatedBucketId()
- Specified by:
getAssociatedBucketId
in interfaceIndex
-
addIndexOnBucket
public void addIndexOnBucket(IndexInternal index)
-
removeIndexOnBucket
public void removeIndexOnBucket(IndexInternal index)
-
getIndexesOnBuckets
public IndexInternal[] getIndexesOnBuckets()
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceIndexInternal
-
-