SwatDB
|
Public Member Functions | |
HashIndexFile (Catalog *catalog, BufferManager *buf_mgr, FileId relation, std::vector< std::string > field_list) | |
Constructor for IndexFile class. | |
HashIndexFile (Catalog *catalog, BufferManager *buf_mgr, FileId relation, std::vector< FieldId > field_list) | |
Constructor for IndexFile class. | |
~HashIndexFile () | |
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are deleted except for the search key format that is created in the constructor. The underlying Unix file is not deleted. | |
void | createHeader () |
Allocates and initializes the header Page of the file. | |
void | flushHeader () |
Flushes header Page to disk. | |
void | insertEntry (Key key, RecordId record_id) |
Inserts an Entry into the HashIndexFile. | |
std::vector< RecordId > | getEntries (Key key) |
Returns a list all RecordIds with the given Key. | |
void | deleteEntry (Key key, RecordId record_id) |
Method for deleting an entry of the given Key and RecordId. | |
void | deleteKey (Key key) |
Method for deleting all entires with the given key. | |
HashIndexHeader | getHeader () |
THIS METHOD IS FOR DEBUGGING ONLY. Returns the current HashIndexHeader. | |
Public Member Functions inherited from IndexFile | |
IndexFile (Catalog *catalog, BufferManager *buf_mgr, FileId relation, std::vector< std::string > field_list) | |
Constructor for IndexFile class. | |
IndexFile (Catalog *catalog, BufferManager *buf_mgr, FileId relation, std::vector< FieldId > field_list) | |
Constructor for IndexFile class. | |
virtual | ~IndexFile () |
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are deleted. The underlying Unix file is not deleted. | |
SearchKeyFormat * | getKeyFormat () |
Returns the key format of the Index. | |
Public Member Functions inherited from File | |
File (Catalog *catalog, BufferManager *buf_mgr) | |
Constructor. Initializes common state associated with every file, including catalog, buf_mgr, and schema. | |
virtual | ~File () |
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are deleted. The underlying Unix file is not deleted. | |
FileId | getFileId () |
Returns the FileId of the File. | |
virtual void | printFile () |
Prints out information and/or the contents of the file. Can be overwritten in derived classes. Useful for debugging and testing purposes. | |
PageId | getHeaderId () |
Returns Header PageId. | |
Private Member Functions | |
std::pair< SlotId, SlotId > | _findDirSlot (HashVal hash_val, Level level) |
Helper function for computing the location of the slot for PageNum of the bucket, corresponding to the given hash value and global level. | |
void | _levelUp (HashIndexHeader *file_header) |
Helper function for incrementing the global level of the hash index. | |
PageId | _splitPage (HashIndexHeader *file_header, HashBucketPage *bucket_page, PageId bucket_page_id) |
Helper function for splitting a bucket. | |
Friends | |
class | HashIndexScanner |
Additional Inherited Members | |
Protected Member Functions inherited from File | |
void | _setFileId (FileId file_id) |
Sets the file_id and the schema fields of this File. | |
Protected Attributes inherited from IndexFile | |
FileId | relation |
SearchKeyFormat * | key_format |
Protected Attributes inherited from File | |
FileId | file_id |
Catalog * | catalog |
BufferManager * | buf_mgr |
PageId | header_id |
HashIndexFile::HashIndexFile | ( | Catalog * | catalog, |
BufferManager * | buf_mgr, | ||
FileId | relation, | ||
std::vector< std::string > | field_list | ||
) |
Constructor for IndexFile class.
catalog | Pointer to the SwatDB Catalog object. |
buf_mgr | Pointer to the SwatDB BufferManager object. |
relation | FileId of the relation of which the index is created. |
field_list | The list of the attributes for which the index is created. |
HashIndexFile::HashIndexFile | ( | Catalog * | catalog, |
BufferManager * | buf_mgr, | ||
FileId | relation, | ||
std::vector< FieldId > | field_list | ||
) |
Constructor for IndexFile class.
catalog | Pointer to the SwatDB Catalog object. |
buf_mgr | Pointer to the SwatDB BufferManager object. |
relation | FileId of the relation of which the index is created. |
field_list | The list of the attributes for which the index is created. |
Helper function for computing the location of the slot for PageNum of the bucket, corresponding to the given hash value and global level.
|
private |
Helper function for incrementing the global level of the hash index.
InsufficientSpaceBufMgr | If there is not enough space in the bufferpool for getting or allocating Page. |
|
private |
Helper function for splitting a bucket.
key | Key of the entries to be retrieved. |
InsufficientSpaceBufMgr | If there is not enough space in the bufferpool for getting or allocating Page. |
|
virtual |
Allocates and initializes the header Page of the file.
InsufficientSpaceBufMgr | If there is not enough space in the bufferpool. |
Implements File.
Method for deleting an entry of the given Key and RecordId.
InvalidKeyFormatHashIndex | If the key format of the given Key does not match that of the HashIndexFile (pointer comparison). |
InvalidEntryHashIndex | If there is no matching entry. |
Implements IndexFile.
|
virtual |
Method for deleting all entires with the given key.
key | Key of the entries to be deleted. |
InvalidKeyFormatHashIndex | If the key format of the given Key does not match that of the HashIndexFile. |
Implements IndexFile.
|
virtual |
Flushes header Page to disk.
InsufficientSpaceBufMgr | If there is not enough space in the bufferpool for the header Page. |
InvalidPageIdBufMgr | If the header_id of the File is not valid. |
Implements File.
Returns a list all RecordIds with the given Key.
key | Key of the entries to be retrieved. |
InvalidKeyFormatHashIndex | If the key format of the given Key does not match that of the HashIndexFile. |
Implements IndexFile.
Inserts an Entry into the HashIndexFile.
InvalidKeyFormatHashIndex | If the key format of the given Key does not match that of the HashIndexFile (pointer comparison). |
InsufficientSpaceHashBucket | If the given Key's data exceeds the MAXIMUM_RECORD_SIZE. |
InsufficientSpaceHashIndex | If the number of pages (including the header, directory, and buckets) in the HashIndexFile exceeds MAX_PAGE_NUM or the Header Page becaomes full. |
Implements IndexFile.