Class PageFile

  • All Implemented Interfaces:
    MemoryObject

    public class PageFile
    extends Object
    implements MemoryObject
    A B-tree page (leaf, or inner node). An inner node contains one more value than keys. A leaf page has the same number of keys and values.
    • Constructor Detail

      • PageFile

        public PageFile​(boolean innerNode,
                        long maxFileSizeBytes)
    • Method Detail

      • estimatedMemory

        public long estimatedMemory()
        Description copied from interface: MemoryObject
        Get the estimate memory size. The value must not change afterwards, otherwise the memory calculation is wrong.
        Specified by:
        estimatedMemory in interface MemoryObject
        Returns:
        the memory in bytes
      • setFileName

        public void setFileName​(String fileName)
      • getFileName

        public String getFileName()
      • setUpdate

        public void setUpdate​(long update)
      • fromBytes

        public static PageFile fromBytes​(byte[] data,
                                         long maxFileSizeBytes)
      • toBytes

        public byte[] toBytes()
      • addChild

        public void addChild​(int index,
                             String childKey,
                             String newChildFileName)
      • setValue

        public void setValue​(int index,
                             String value)
      • removeRecord

        public void removeRecord​(int index)
      • appendRecord

        public void appendRecord​(String k,
                                 String v)
      • insertRecord

        public void insertRecord​(int index,
                                 String key,
                                 String value)
      • getUpdate

        public long getUpdate()
      • sizeInBytes

        public int sizeInBytes()
      • canSplit

        public boolean canSplit()
      • getKeyIndex

        public int getKeyIndex​(String key)
      • getValue

        public String getValue​(int index)
      • getChildValue

        public String getChildValue​(int index)
      • getNextKey

        public String getNextKey​(String largerThan)
      • getNextRoot

        public String getNextRoot()
      • setNextRoot

        public void setNextRoot​(String nextRoot)
      • removeKey

        public void removeKey​(int index)
      • removeValue

        public void removeValue​(int index)
      • isInnerNode

        public boolean isInnerNode()
      • getValueCount

        public int getValueCount()
      • getKey

        public String getKey​(int index)
      • setModified

        public void setModified​(boolean modified)
      • isModified

        public boolean isModified()