Class FreeSpaceManager
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.FreeSpaceManager
Manages space in file
- Author:
- angele
-
Constructor Summary
ConstructorDescriptionFreeSpaceManager
(long startInFile, long offsetValidByte) FreeSpaceManager
(RandomAccessToFile file, long startInFile, long offsetValidByte) -
Method Summary
Modifier and TypeMethodDescriptionlong
alloc
(int length) allocate space with length lenboolean
compare internal free space list with fileboolean
check sanity of free space listvoid
clear()
clone()
void
void
free
(long offset, int len) free up space at offsetvoid
freeAll()
free all piecesboolean
isFreeAtPosition
(long offset) is space free at offsetboolean
isFreePiece
(long offset, int len) is piece at offset with len free?boolean
isValid()
is it valid?void
save()
store in filevoid
setFile
(RandomAccessToFile file) void
setValid
(boolean valid) mark as validvoid
shrink
(long offset, int length, int oldlength) shrink already allocated spaceint
size()
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
-