Class NodeHash.PagedGrowableHash

  • Enclosing class:
    NodeHash<T>

    class NodeHash.PagedGrowableHash
    extends java.lang.Object
    Inner class because it needs access to hash function and FST bytes.
    • Constructor Detail

      • PagedGrowableHash

        public PagedGrowableHash()
      • PagedGrowableHash

        public PagedGrowableHash​(long lastNodeAddress,
                                 long size)
    • Method Detail

      • getBytes

        public byte[] getBytes​(long hashSlot,
                               int length)
        Get the copied bytes at the provided hash slot
        Parameters:
        hashSlot - the hash slot to read from
        length - the number of bytes to read
        Returns:
        the copied byte array
      • getNodeAddress

        public long getNodeAddress​(long hashSlot)
        Get the node address from the provided hash slot
        Parameters:
        hashSlot - the hash slot to read
        Returns:
        the node address
      • setNodeAddress

        public void setNodeAddress​(long hashSlot,
                                   long nodeAddress)
        Set the node address from the provided hash slot
        Parameters:
        hashSlot - the hash slot to write to
        nodeAddress - the node address
      • copyNodeBytes

        void copyNodeBytes​(long hashSlot,
                           byte[] bytes,
                           int length)
        copy the node bytes from the FST
      • copyFallbackNodeBytes

        void copyFallbackNodeBytes​(long hashSlot,
                                   NodeHash.PagedGrowableHash fallbackTable,
                                   long fallbackHashSlot,
                                   int nodeLength)
        promote the node bytes from the fallback table
      • rehash

        private void rehash​(long lastNodeAddress)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • hash

        private long hash​(long nodeAddress,
                          long hashSlot)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • nodesEqual

        private int nodesEqual​(FSTCompiler.UnCompiledNode<T> node,
                               long address,
                               long hashSlot)
                        throws java.io.IOException
        Compares an unfrozen node (UnCompiledNode) with a frozen node at byte location address (long), returning the node length if the two nodes are equals, or -1 otherwise

        The node length will be used to promote the node from the fallback table to the primary table

        Throws:
        java.io.IOException
      • getBytesReader

        private FST.BytesReader getBytesReader​(long nodeAddress,
                                               long hashSlot)