Class PageTable
java.lang.Object
com.semedy.reasoner.edb.persistentstore.bplustree.PageTable
handles a page table for blus files
- Author:
- angele
-
Constructor Summary
ConstructorsConstructorDescriptionPageTable(int number, long rootPosition, long sizePosition, long validPosition, long pagesPosition, long freePosition, long nodeSizePosition, int nodeSize) -
Method Summary
Modifier and TypeMethodDescriptionintallocate(int length) allocate a new piece with lengthvoidallocateAddress4Index(int index, int length) allocate a new address for indexintappend(int length) append a slot at file endvoidclear()voidclose()close page table on file (does not save it)voidcommit()Commit transaction
add blocked slots to free slotsvoidcopy page tablevoidcreate()create page table (does not load it)voidflush()flush filevoidfree(int index) free up a slot at indexvoidfree(gnu.trove.list.TLongList allocatedSlots) add slots to free slotslongget(int index) get address to indexgnu.trove.list.TLongListget allocated slotsintget node sizeintgetRoot()get index of root nodelonggetSize()get number of elementsbooleanisValid()is page table valid?voidLoad page table from filevoidopen()open page table (does not load it)longreallocate(int index, int length) allocate a new slot for index
block old slotvoidsave page table in filevoidsetBplusFile(RandomAccessToFile bplusfile) voidsetNodeSize(int size) set node sizevoidsetRoot(int index) set index of root nodevoidsetSize(long size) set the number of elementsvoidsetValid(boolean b) set page table to validintsize()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
-