Class PageTable
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.PageTable
handles a page table for blus files
- Author:
- angele
-
Constructor Summary
ConstructorDescriptionPageTable
(int number, long rootPosition, long sizePosition, long validPosition, long pagesPosition, long freePosition, long nodeSizePosition, int nodeSize) -
Method Summary
Modifier and TypeMethodDescriptionint
allocate
(int length) allocate a new piece with lengthvoid
allocateAddress4Index
(int index, int length) allocate a new address for indexint
append
(int length) append a slot at file endvoid
clear()
void
close()
close page table on file (does not save it)void
commit()
Commit transaction
add blocked slots to free slotsvoid
copy page tablevoid
create()
create page table (does not load it)void
flush()
flush filevoid
free
(int index) free up a slot at indexvoid
free
(gnu.trove.list.TLongList allocatedSlots) add slots to free slotslong
get
(int index) get address to indexgnu.trove.list.TLongList
get allocated slotsint
get node sizeint
getRoot()
get index of root nodelong
getSize()
get number of elementsboolean
isValid()
is page table valid?void
Load page table from filevoid
open()
open page table (does not load it)long
reallocate
(int index, int length) allocate a new slot for index
block old slotvoid
save page table in filevoid
setBplusFile
(RandomAccessToFile bplusfile) void
setNodeSize
(int size) set node sizevoid
setRoot
(int index) set index of root nodevoid
setSize
(long size) set the number of elementsvoid
setValid
(boolean b) set page table to validint
size()
number of slotstoString()
-
Constructor Details
-
PageTable
public PageTable(int number, long rootPosition, long sizePosition, long validPosition, long pagesPosition, long freePosition, long nodeSizePosition, int nodeSize)
-
-
Method Details
-
setBplusFile
-
toString
-
clear
public void clear() -
open
open page table (does not load it)- Throws:
IOException
-
create
create page table (does not load it)- Throws:
IOException
-
flush
flush file- Throws:
IOException
-
close
close page table on file (does not save it)- Throws:
IOException
-
setRoot
public void setRoot(int index) set index of root node- Parameters:
index
-
-
setNodeSize
public void setNodeSize(int size) set node size- Parameters:
index
-
-
setSize
public void setSize(long size) set the number of elements- Parameters:
size
-
-
getSize
public long getSize()get number of elements- Returns:
-
getRoot
public int getRoot()get index of root node- Returns:
-
getNodeSize
public int getNodeSize()get node size- Returns:
-
setValid
set page table to valid- Throws:
IOException
-
isValid
is page table valid?- Returns:
- Throws:
IOException
-
loadPagetable
Load page table from file- Throws:
IOException
-
savePagetable
save page table in file- Throws:
IOException
-
append
append a slot at file end- Parameters:
length
- , length to append- Returns:
- Throws:
IOException
-
allocate
allocate a new piece with length- Parameters:
length
- , length of file piece- Returns:
- Throws:
IOException
-
allocateAddress4Index
allocate a new address for index- Parameters:
index
-- Throws:
IOException
-
reallocate
allocate a new slot for index
block old slot- Parameters:
index
-- Throws:
IOException
-
commit
Commit transaction
add blocked slots to free slots- Throws:
IOException
-
getAllocatedSlots
public gnu.trove.list.TLongList getAllocatedSlots()get allocated slots- Returns:
-
free
add slots to free slots- Parameters:
allocatedSlots
-- Throws:
IOException
-
free
free up a slot at index- Parameters:
index
-- Throws:
IOException
-
size
public int size()number of slots- Returns:
-
get
public long get(int index) get address to index- Parameters:
i
-- Returns:
-
copy
copy page table- Parameters:
p
-- Throws:
IOException
-