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
-
-
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(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()
byte[]
getBinaryKeyTypes()
int
getFileId()
List<Integer>
getFileIds()
IndexInternal[]
getIndexesOnBuckets()
Type[]
getKeyTypes()
String
getName()
LSMTreeIndexAbstract.NULL_STRATEGY
getNullStrategy()
int
getPageSize()
PaginatedComponent
getPaginatedComponent()
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()
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
setMetadata(String name, String[] propertyNames, int associatedBucketId)
void
setNullStrategy(LSMTreeIndexAbstract.NULL_STRATEGY nullStrategy)
void
setTypeIndex(TypeIndex typeIndex)
boolean
supportsOrderedIterations()
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 interfaceIndex
-
scheduleCompaction
public boolean scheduleCompaction()
- Specified by:
scheduleCompaction
in interfaceIndex
-
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
-
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 interfaceIndex
-
build
public long build(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
-
getFileId
public int getFileId()
- Specified by:
getFileId
in interfaceIndexInternal
-
getPaginatedComponent
public PaginatedComponent getPaginatedComponent()
- Specified by:
getPaginatedComponent
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
-
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()
-
-