|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiskmgr.Page
heap.HFPage
Class heap file page. The design assumes that records are kept compacted when deletions are performed.
Field Summary | |
static int |
CUR_PAGE
|
static int |
DPFIXED
|
static int |
EMPTY_SLOT
|
static int |
FREE_SPACE
|
static int |
INVALID_SLOT
|
static int |
NEXT_PAGE
|
static int |
PREV_PAGE
|
static int |
SIZE_OF_SLOT
|
static int |
SLOT_CNT
|
static int |
TYPE
|
static int |
USED_PTR
|
Fields inherited from interface global.GlobalConst |
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF |
Constructor Summary | |
HFPage()
Default constructor |
|
HFPage(Page page)
Constructor of class HFPage open a HFPage and make this HFpage piont to the given page |
Method Summary | |
int |
available_space()
returns the amount of available space on the page. |
void |
deleteRecord(RID rid)
delete the record with the specified rid |
void |
dumpPage()
Dump contents of a page |
boolean |
empty()
Determining if the page is empty |
RID |
firstRecord()
|
PageId |
getCurPage()
|
byte[] |
getHFpageArray()
|
PageId |
getNextPage()
|
PageId |
getPrevPage()
|
Tuple |
getRecord(RID rid)
copies out record with RID rid into record pointer. |
short |
getSlotCnt()
|
short |
getSlotLength(int slotno)
|
short |
getSlotOffset(int slotno)
|
short |
getType()
|
void |
init(PageId pageNo,
Page apage)
Constructor of class HFPage initialize a new page |
RID |
insertRecord(byte[] record)
inserts a new record onto the page, returns RID of this record |
RID |
nextRecord(RID curRid)
|
void |
openHFpage(Page apage)
Constructor of class HFPage open a existed hfpage |
Tuple |
returnRecord(RID rid)
returns a tuple in a byte array[pageSize] with given RID rid. |
void |
setCurPage(PageId pageNo)
sets value of curPage to pageNo |
void |
setNextPage(PageId pageNo)
sets value of nextPage to pageNo |
void |
setPrevPage(PageId pageNo)
sets value of prevPage to pageNo |
void |
setSlot(int slotno,
int length,
int offset)
sets slot contents |
void |
setType(short valtype)
sets value of type |
Methods inherited from class diskmgr.Page |
getpage, setpage |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int SIZE_OF_SLOT
public static final int DPFIXED
public static final int SLOT_CNT
public static final int USED_PTR
public static final int FREE_SPACE
public static final int TYPE
public static final int PREV_PAGE
public static final int NEXT_PAGE
public static final int CUR_PAGE
public static final int INVALID_SLOT
public static final int EMPTY_SLOT
Constructor Detail |
public HFPage()
public HFPage(Page page)
page
- the given page in Page typeMethod Detail |
public void openHFpage(Page apage)
apage
- a page in buffer poolpublic void init(PageId pageNo, Page apage) throws java.io.IOException
pageNo
- the page number of a new page to be initializedapage
- the Page to be initialized
java.io.IOException
- I/O errorsPage
public byte[] getHFpageArray()
public void dumpPage() throws java.io.IOException
java.io.IOException
- I/O errorspublic PageId getPrevPage() throws java.io.IOException
java.io.IOException
- I/O errorspublic void setPrevPage(PageId pageNo) throws java.io.IOException
pageNo
- page number for previous page
java.io.IOException
- I/O errorspublic PageId getNextPage() throws java.io.IOException
java.io.IOException
- I/O errorspublic void setNextPage(PageId pageNo) throws java.io.IOException
pageNo
- page number for next page
java.io.IOException
- I/O errorspublic PageId getCurPage() throws java.io.IOException
java.io.IOException
- I/O errorspublic void setCurPage(PageId pageNo) throws java.io.IOException
pageNo
- page number for current page
java.io.IOException
- I/O errorspublic short getType() throws java.io.IOException
java.io.IOException
- I/O errorspublic void setType(short valtype) throws java.io.IOException
valtype
- an arbitrary value
java.io.IOException
- I/O errorspublic short getSlotCnt() throws java.io.IOException
java.io.IOException
- I/O errorspublic void setSlot(int slotno, int length, int offset) throws java.io.IOException
slotno
- the slot numberlength
- length of record the slot containsoffset
- offset of record
java.io.IOException
- I/O errorspublic short getSlotLength(int slotno) throws java.io.IOException
slotno
- slot number
java.io.IOException
- I/O errorspublic short getSlotOffset(int slotno) throws java.io.IOException
slotno
- slot number
java.io.IOException
- I/O errorspublic RID insertRecord(byte[] record) throws java.io.IOException
record
- a record to be inserted
java.io.IOException
- I/O errors
in C++ Status insertRecord(char *recPtr, int recLen, RID& rid)public void deleteRecord(RID rid) throws java.io.IOException, InvalidSlotNumberException
rid
- the record ID
InvalidSlotNumberException
- Invalid slot number
java.io.IOException
- I/O errors
in C++ Status deleteRecord(const RID& rid)public RID firstRecord() throws java.io.IOException
java.io.IOException
- I/O errors
in C++ Status firstRecord(RID& firstRid)public RID nextRecord(RID curRid) throws java.io.IOException
curRid
- current record ID
java.io.IOException
- I/O errors
in C++ Status nextRecord (RID curRid, RID& nextRid)public Tuple getRecord(RID rid) throws java.io.IOException, InvalidSlotNumberException
rid
- the record ID
InvalidSlotNumberException
- Invalid slot number
java.io.IOException
- I/O errorsTuple
public Tuple returnRecord(RID rid) throws java.io.IOException, InvalidSlotNumberException
rid
- the record ID
InvalidSlotNumberException
- Invalid slot number
java.io.IOException
- I/O errorsTuple
public int available_space() throws java.io.IOException
java.io.IOException
- I/O errorspublic boolean empty() throws java.io.IOException
java.io.IOException
- I/O errors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |