#include <hashbucketpage.h>
|
| HashBucketPage ()=delete |
| Constructor.
|
|
| ~HashBucketPage () |
|
void | initializeHeader () |
| Initializes header information after the Page is allocated.
|
|
std::uint32_t | getFreeSpace () |
| Getter for the amount of free space free on the Page.
|
|
bool | isFull () |
| bool function indicating whether the Page is full.
|
|
bool | isEmpty () |
| bool function indicating whether the Page is empty.
|
|
SlotId | insertEntry (Key key, RecordId record_id) |
| Inserts given Key and RecordId to the Page.
|
|
RecordId | getEntry (SlotId slot_id, Data *data) |
| Gets the entry identified by SlotId.
|
|
void | deleteEntry (SlotId slot_id) |
| Deletes Entry identified by SlotId.
|
|
Level | getLevel () |
| Getter function for the local level of the bucket.
|
|
void | setLevel (Level new_level) |
| Setter function for the local level of the bucket.
|
|
HashBucketPageHeader | getHeader () |
| THIS METHOD IS FOR DEBUGGING ONLY. Returns this HashBucketPage's header information.
|
|
SlotInfo | getSlotInfo (SlotId slot_id) |
| THIS METHOD IS FOR DEBUGGING ONLY. Returns SlotInfo struct of the given SlotId.
|
|
std::uint32_t | getInvalidNum () |
| THIS METHOD IS FOR DEBUGGING ONLY. Returns number of invalid slots in the HashBucketPage.
|
|
void | printHashBucketPageState () |
| THIS METHOD IS FOR DEBUGGING ONLY. Prints the current state of the HashBucketPage.
|
|
| Page () |
| Constructor.
|
|
| ~Page () |
| Destructor.
|
|
char * | getData () |
| Get function for the data char array.
|
|
|
class | HashBucketPageScanner |
|
class | HashIndexScanner |
|
|
char | data [PAGE_SIZE] |
| char array that stores the page data. Derived classes could map appropriate structures on it.
|
|
SwatDB HashBucketPage Class. HashBucketPage inherits from base Page class and instantiates hash bucket, collection of which, form buckets of hash index.
◆ HashBucketPage()
HashBucketPage::HashBucketPage |
( |
| ) |
|
|
delete |
Constructor.
Constructor should never be called. It should be always the case that base class Page constructor is called by the BufferManager when initializing bufferpool. HashBucketPage Pointer is casted to whatever Page pointer returned by the BufferManager
◆ ~HashBucketPage()
HashBucketPage::~HashBucketPage |
( |
| ) |
|
|
inline |
◆ _getPageHeader()
◆ _getSlotDirectory()
SlotInfo * HashBucketPage::_getSlotDirectory |
( |
| ) |
|
|
private |
Return pointer to the where slot directory begins (first SlotInfo)
- Precondition
- None
- Postcondition
- Pointer to first SlotInfo is returned.
- Parameters
-
slot_id | SlotId of SlotInfo* that is returned. |
- Returns
- Pointer to the first SlotInfo in slot directory.
◆ deleteEntry()
void HashBucketPage::deleteEntry |
( |
SlotId |
slot_id | ) |
|
Deletes Entry identified by SlotId.
- Precondition
- A valid SlotId is provided as input.
- Postcondition
- The entry in that slot is removed from the page, and its slot directory entry is freed. The remaining entries on the page are compacted at the end of the page. Page meta data and slot directory entries are updated to reflect the deletion this entry. The total amount of freespace on the page increases. The slot directory may shrink by one or more SlotInfo entries as a result of this call.
- Parameters
-
slot_id | SlotId of the entry to be deleted. |
- Exceptions
-
◆ getEntry()
RecordId HashBucketPage::getEntry |
( |
SlotId |
slot_id, |
|
|
Data * |
data |
|
) |
| |
Gets the entry identified by SlotId.
*
- Precondition
- A valid SlotId is provided as input and a valid Data* with capacity that is greater than maximum size of any Key stored in the Page is passed.
- Postcondition
- The data contains a serialized key of the requsted entry stored in the Page.
- Parameters
-
slot_id | SlotId of the Entry to be retrieved |
- Exceptions
-
◆ getFreeSpace()
std::uint32_t HashBucketPage::getFreeSpace |
( |
| ) |
|
Getter for the amount of free space free on the Page.
- Precondition
- None.
- Postcondition
- The amount of free space in bytes on the Page is returned. If there is no free slot, sizeof(SlotInfo) is subtracted from the free space returned (accounting extra space occupied if new slot is allocated). If free space is less than sizeof(SlotInfo), 0 is returned.
- Returns
- Amount of free space in bytes on the Page.
◆ initializeHeader()
void HashBucketPage::initializeHeader |
( |
| ) |
|
Initializes header information after the Page is allocated.
- Precondition
- None
- Postcondition
- Page header is initialized such that local_level is set to 0, prev_page and next_page are set to INVALID_PAGE_NUM, free_space_begin is set to sizeof(HashBucektPageHeader), free_space_end is set to PAGE_SIZE, size and capacity are set to 0.
◆ insertEntry()
SlotId HashBucketPage::insertEntry |
( |
Key |
key, |
|
|
RecordId |
record_id |
|
) |
| |
Inserts given Key and RecordId to the Page.
If there is enough free space on the Page, and valid Key is passed (the Data value has non-zero length), then the data are inserted into the page.
- Precondition
- The slot directory has m used slots in its slot directory and all m entrie are compacted at the bottom of the page.
- Postcondition
- After a successful insert, it has m+1 used slots in its solt directory (possibly increasing the slot directory size by one entry), and all m+1 entries are compacted at the bottom of the page.
- Parameters
-
- Returns
- SlotId of the slot the Entry is inserted to.
- Exceptions
-
◆ isEmpty()
bool HashBucketPage::isEmpty |
( |
| ) |
|
bool function indicating whether the Page is empty.
- Precondition
- None.
- Postcondition
- true is returned if size is 0. Else false is returned.
- Returns
- bool indicating whether the Page is empty.
◆ isFull()
bool HashBucketPage::isFull |
( |
| ) |
|
bool function indicating whether the Page is full.
- Precondition
- None.
- Postcondition
- true is returned if used space/PAGE_SIZE exceeds MAX_HEAP_PAGE_LOAD and false is returned otherwise.
- Returns
- bool indicating whether the Page is full.
The documentation for this class was generated from the following file: