Class for accessing and updating the contents of a B+ tree index. More...
#include <IndexHandle.h>
Public Member Functions | |
ReturnCode | insertEntry (void *data, const RecordID *rid) |
Inserts a new entry into the index. | |
ReturnCode | deleteEntry (void *data, const RecordID *rid) |
Deletes an entry from the index. | |
ReturnCode | forcePage (int pageNo) |
Flushes the specified page to disk. | |
ReturnCode | forceAllPages () |
Flushes all dirty pages to disk. |
Class for accessing and updating the contents of a B+ tree index.
The IndexHandle class is used to insert and delete index entries, and to force pages of an index's files to disk. Index handles are obtained by calling IndexManager::openIndex, and freed by calling IndexManager::closeIndex.
ReturnCode IndexHandle::deleteEntry | ( | void * | data, | |
const RecordID * | rid | |||
) |
Deletes an entry from the index.
data | The key of the entry | |
rid | The record id of the entry |
Deletes the entry with record id rid and key value data from the index associated with the index handle. Returns RC_OK on success, RC_RECORD_NOT_FOUND if the specified record is not in the index, and other RC error codes otherwise.
ReturnCode IndexHandle::forceAllPages | ( | ) |
Flushes all dirty pages to disk.
Flushes all dirty pages to disk. Returns RC_OK on success, or other ReturnCode values as specified in FileHandle::forceAllPages otherwise.
ReturnCode IndexHandle::forcePage | ( | int | pageNo | ) |
Flushes the specified page to disk.
pageNo | The number of the page to flush |
Flushes the specified page to disk. Returns RC_OK on success, or other ReturnCode values as specified in FileHandle::forcePage otherwise.
ReturnCode IndexHandle::insertEntry | ( | void * | data, | |
const RecordID * | rid | |||
) |
Inserts a new entry into the index.
data | The key of the new entry | |
rid | The record id of the new entry |
Inserts a new entry into the index associated with the index handle. The data parameter points to the key attribute value to be inserted into the index, and the rid parameter indentifies the record with that key to be added to the index. (The index should contain only the record's id, not the record itself.) If the indexed attribute is a character string of length n, then data may be assumed to be exactly n bytes long (but may not be null-terminated). Returns RC_OK on success, RC_RECORD_ALREADY_IN_INDEX if the record is already in the index, and other RC error codes otherwise.