Class FreeSpaceManager
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.FreeSpaceManager
Manages space in file
- Author:
- angele
-
Constructor Summary
ConstructorsConstructorDescriptionFreeSpaceManager(long startInFile, long offsetValidByte) FreeSpaceManager(RandomAccessToFile file, long startInFile, long offsetValidByte) -
Method Summary
Modifier and TypeMethodDescriptionlongalloc(int length) allocate space with length lenbooleancompare internal free space list with filebooleancheck sanity of free space listvoidclear()clone()voidvoidfree(long offset, int len) free up space at offsetvoidfreeAll()free all piecesbooleanisFreeAtPosition(long offset) is space free at offsetbooleanisFreePiece(long offset, int len) is piece at offset with len free?booleanisValid()is it valid?voidsave()store in filevoidsetFile(RandomAccessToFile file) voidsetValid(boolean valid) mark as validvoidshrink(long offset, int length, int oldlength) shrink already allocated spaceintsize()number of free piecestoString()
-
Constructor Details
-
FreeSpaceManager
-
FreeSpaceManager
public FreeSpaceManager(long startInFile, long offsetValidByte)
-
-
Method Details
-
clone
-
setFile
-
clear
public void clear() -
copy
-
setValid
mark as valid- Parameters:
valid-- Throws:
IOException
-
isValid
is it valid?- Returns:
- Throws:
IOException
-
isFreeAtPosition
public boolean isFreeAtPosition(long offset) is space free at offset- Parameters:
offset-- Returns:
-
free
free up space at offset- Parameters:
offset- , offset of piecelen- , length of piece- Throws:
IOException
-
freeAll
free all pieces- Throws:
IOException
-
alloc
allocate space with length len- Parameters:
length- , length of needed space- Returns:
- Throws:
IOException
-
shrink
shrink already allocated space- Parameters:
offset-length-oldlength-- Throws:
IOException
-
save
store in file- Throws:
IOException
-
checkSanity
public boolean checkSanity()check sanity of free space list- Returns:
-
checkFileSanity
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
-