Package com.arcadedb.index
Class CompressedRID2RIDIndex
- java.lang.Object
-
- com.arcadedb.index.CompressedRID2RIDIndex
-
public class CompressedRID2RIDIndex extends Object
Map like optimized to avoid stressing the GC by using mechanical sympathy technique + compression of key and values. This class is not synchronized. The key is a RID and value is a RIDs. This Map implementation doesn't support the overwrite of a value. Values cannot be null.
This index is used for invert incoming edge creation.
A Binary object is used to store the hash table (the first part of it) and then keys and values. The RID key is serialized compressed in the position pointed by the hash table, then a fixed-size integer containing the next entry (with the same hash) and after that the compressed RID. Another slot is kept to point to the previous entry. The hash table always points to the last element with a linked list in the only direction of the previous.TODO support up to 4GB by using unsigned int
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CompressedRID2RIDIndex.EntryIterator
-
Field Summary
Fields Modifier and Type Field Description protected Binary
chunk
protected Database
database
protected int
keys
protected BinarySerializer
serializer
protected int
totalEntries
protected int
totalUsedSlots
-
Constructor Summary
Constructors Constructor Description CompressedRID2RIDIndex(Database database, int expectedVertices, int expectedEdges)
CompressedRID2RIDIndex(Database database, Binary buffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(RID key)
CompressedRID2RIDIndex.EntryIterator
entryIterator()
RID
get(RID key)
int
getChunkAllocated()
int
getChunkSize()
int
getKeys()
int
getTotalUsedSlots()
boolean
isEmpty()
void
put(RID key, RID valueRID)
void
setReadOnly()
int
size()
-
-
-
Field Detail
-
database
protected final Database database
-
serializer
protected final BinarySerializer serializer
-
keys
protected final int keys
-
chunk
protected Binary chunk
-
totalEntries
protected int totalEntries
-
totalUsedSlots
protected int totalUsedSlots
-
-
Constructor Detail
-
CompressedRID2RIDIndex
public CompressedRID2RIDIndex(Database database, int expectedVertices, int expectedEdges) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
CompressedRID2RIDIndex
public CompressedRID2RIDIndex(Database database, Binary buffer) throws ClassNotFoundException
- Throws:
ClassNotFoundException
-
-
Method Detail
-
size
public int size()
-
setReadOnly
public void setReadOnly()
-
isEmpty
public boolean isEmpty()
-
containsKey
public boolean containsKey(RID key)
-
getKeys
public int getKeys()
-
entryIterator
public CompressedRID2RIDIndex.EntryIterator entryIterator()
-
getChunkSize
public int getChunkSize()
-
getChunkAllocated
public int getChunkAllocated()
-
getTotalUsedSlots
public int getTotalUsedSlots()
-
-