#include <PageFileHandle.h>
Public Member Functions | |
ReturnCode | initialize (const char *fileName, FILE *file) |
Initializes the file handle. | |
ReturnCode | getFirstPage (PageHandle *pageHandle) |
Gets the first page in the file. | |
ReturnCode | getLastPage (PageHandle *pageHandle) |
Gets the last page in the file. | |
ReturnCode | getNextPage (int pageNo, PageHandle *pageHandle) |
Get the next page in the file following the one specified. | |
ReturnCode | getPrevPage (int pageNo, PageHandle *pageHandle) |
Gets the page in the file previous to the one specified. | |
ReturnCode | getThisPage (int pageNo, PageHandle *pageHandle) |
Gets the specified page in the file. | |
ReturnCode | allocatePage (PageHandle *pageHandle) |
Allocates a fresh page in the page file. | |
ReturnCode | disposePage (int pageNo) |
Frees a page in the page file. | |
ReturnCode | markDirty (int pageNo) |
Marks a page in the file as dirty. | |
ReturnCode | unpinPage (int pageNo) |
Unpins the specified page. | |
ReturnCode | forcePage (int pageNo) |
Writes a dirty page to disk. | |
ReturnCode | forceAllPages () |
Writes all dirty pages to disk. | |
const char * | getFileName () |
Gets the name of the underlying file. | |
FILE * | getFile () |
Gets the pointer to the underlying file stream. | |
int | countPages () |
Returns a count of allocated pages. | |
Static Public Member Functions | |
static ReturnCode | onCreate (const char *fileName, FILE *file) |
ReturnCode PageFileHandle::initialize | ( | const char * | fileName, | |
FILE * | file | |||
) |
Initializes the file handle.
fileName | The name of the file on disk. | |
file | The open file stream. |
ReturnCode PageFileHandle::getFirstPage | ( | PageHandle * | pageHandle | ) |
Gets the first page in the file.
pageHandle | Out pointer to page handle structure. |
ReturnCode PageFileHandle::getLastPage | ( | PageHandle * | pageHandle | ) |
Gets the last page in the file.
pageHandle | Out pointer to page handle structure. |
ReturnCode PageFileHandle::getNextPage | ( | int | pageNo, | |
PageHandle * | pageHandle | |||
) |
Get the next page in the file following the one specified.
pageNo | The number of the current page. | |
pageHandle | Out pointer to page handle structure. |
ReturnCode PageFileHandle::getPrevPage | ( | int | pageNo, | |
PageHandle * | pageHandle | |||
) |
Gets the page in the file previous to the one specified.
pageNo | The number of the current page. | |
pageHandle | Out pointer to page handle structure. |
ReturnCode PageFileHandle::getThisPage | ( | int | pageNo, | |
PageHandle * | pageHandle | |||
) |
Gets the specified page in the file.
pageNo | The number of the page to be retrieved. | |
pageHandle | Out pointer to page handle structure. |
ReturnCode PageFileHandle::allocatePage | ( | PageHandle * | pageHandle | ) |
Allocates a fresh page in the page file.
pageHandle | Out pointer to page handle structures. |
ReturnCode PageFileHandle::disposePage | ( | int | pageNo | ) |
Frees a page in the page file.
pageNo | The number of the page to free. |
ReturnCode PageFileHandle::markDirty | ( | int | pageNo | ) |
Marks a page in the file as dirty.
pageNo | The number of the page to mark. |
ReturnCode PageFileHandle::unpinPage | ( | int | pageNo | ) |
Unpins the specified page.
pageNo | The number of the page to unpin. |
ReturnCode PageFileHandle::forcePage | ( | int | pageNo | ) |
Writes a dirty page to disk.
pageNo | The number of the page to write to disk. |
ReturnCode PageFileHandle::forceAllPages | ( | ) |
Writes all dirty pages to disk.
Writes all dirty pages to disk, clearing their dirty bits. Returns RC_OK on success, and RC_UNIX if there is a file system error during the write.
FILE * PageFileHandle::getFile | ( | ) |
Gets the pointer to the underlying file stream.
Gets the pointer to the underlying file stream. This method is intended to be used only by PageFileManager, who owns the file stream.