Class FreeSpaceManager

java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.FreeSpaceManager

public class FreeSpaceManager extends Object
Manages space in file
Author:
angele
  • Constructor Details

    • FreeSpaceManager

      public FreeSpaceManager(RandomAccessToFile file, long startInFile, long offsetValidByte)
    • FreeSpaceManager

      public FreeSpaceManager(long startInFile, long offsetValidByte)
  • Method Details

    • clone

      public FreeSpaceManager clone()
    • setFile

      public void setFile(RandomAccessToFile file)
    • clear

      public void clear()
    • copy

      public void copy(FreeSpaceManager p)
    • setValid

      public void setValid(boolean valid) throws IOException
      mark as valid
      Parameters:
      valid -
      Throws:
      IOException
    • isValid

      public boolean isValid() throws IOException
      is it valid?
      Returns:
      Throws:
      IOException
    • isFreeAtPosition

      public boolean isFreeAtPosition(long offset)
      is space free at offset
      Parameters:
      offset -
      Returns:
    • free

      public void free(long offset, int len) throws IOException
      free up space at offset
      Parameters:
      offset - , offset of piece
      len - , length of piece
      Throws:
      IOException
    • freeAll

      public void freeAll() throws IOException
      free all pieces
      Throws:
      IOException
    • alloc

      public long alloc(int length) throws IOException
      allocate space with length len
      Parameters:
      length - , length of needed space
      Returns:
      Throws:
      IOException
    • shrink

      public void shrink(long offset, int length, int oldlength) throws IOException
      shrink already allocated space
      Parameters:
      offset -
      length -
      oldlength -
      Throws:
      IOException
    • save

      public void save() throws IOException
      store in file
      Throws:
      IOException
    • checkSanity

      public boolean checkSanity()
      check sanity of free space list
      Returns:
    • checkFileSanity

      public boolean checkFileSanity() throws IOException
      compare internal free space list with file
      Returns:
      Throws:
      IOException
    • isFreePiece

      public boolean isFreePiece(long offset, int len)
      is piece at offset with len free?
      Parameters:
      offset -
      len -
      Returns:
    • size

      public int size()
      number of free pieces
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object