Class CompressedRID2RIDsIndex


  • public class CompressedRID2RIDsIndex
    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 values are pairs of 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 RIDs pair (edge+vertex). 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

    • Field Detail

      • database

        protected final Database database
      • keys

        protected final int keys
      • chunk

        protected Binary chunk
      • totalEntries

        protected int totalEntries
      • totalUsedSlots

        protected int totalUsedSlots
    • Constructor Detail

      • CompressedRID2RIDsIndex

        public CompressedRID2RIDsIndex​(Database database,
                                       int expectedVertices,
                                       int expectedEdges)
      • CompressedRID2RIDsIndex

        public CompressedRID2RIDsIndex​(Database database,
                                       Binary buffer)
    • Method Detail

      • size

        public int size()
      • setReadOnly

        public void setReadOnly()
      • isEmpty

        public boolean isEmpty()
      • containsKey

        public boolean containsKey​(RID key)
      • put

        public void put​(RID key,
                        RID edgeRID,
                        RID vertexRID)
      • getKeys

        public int getKeys()
      • getChunkSize

        public int getChunkSize()
      • getChunkAllocated

        public int getChunkAllocated()
      • getTotalUsedSlots

        public int getTotalUsedSlots()