CLASS SortedPage

#include <sortedpage.h>

SortedPage is a special kind of HeapPage that arrange the records in page in sorted order according to a specified key. Records and slots directory on the page are compact. Therefore it is unsafe to retrieve a record on a SortedPage based on RecordID after a deletion.

There is a private member in HeapPage that is unused in the previous assignment. The member type in HeapPage is used to indicate the type of a SortedPage. In this assignment, the member type can take value INDEX_NODE or LEAF_NODE, which corresponds to an internal node of B+-tree and a leaf node of B+-tree, respectively.

Class Heirarchy

HeapPage

SortedPage

Methods

Status InsertRecord(AttrType keyType, char * recPtr, int recLen, RecordID& rid)
Insert a record, pointed to by pointer recPtr, of length recLen, with a key of type keyType, into this page. Output the record id of the inserted record as rid.
Status DeleteRecord(const RecordID& rid)
Delete a record with record id rid from the page,
void SetType(short t)
Set the type of the page to t.
short GetType()
Return the type of the page.
int GetNumOfRecords()

Return the number of records on this page.