Main class for record manager component of DavisDB. More...
#include <RecordManager.h>
Public Member Functions | |
ReturnCode | createFile (const char *fileName, uint recordSize) |
Create a new record file. | |
ReturnCode | removeFile (const char *fileName) |
Removes (deletes) a record file. | |
ReturnCode | openFile (const char *fileName, RecordFileHandle **fileHandle) |
Opens an existing record file. | |
ReturnCode | closeFile (RecordFileHandle *fileHandle) |
Closes an open record file. | |
Static Public Member Functions | |
static RecordManager * | getInstance () |
Gets the singleton instance of this class. |
Main class for record manager component of DavisDB.
The main class for the record manager component of DavisDB. It handles creation, deletion, opening, and closing of record files. This is intended to be a singleton class. Use RecordManager::getInstance to obtain a pointer to the singleton instance.
ReturnCode RecordManager::closeFile | ( | RecordFileHandle * | fileHandle | ) |
Closes an open record file.
fileHandle | The record file handle for the open file |
Closes an open record file and deallocates its file handle. Returns RC_OK on success, or an error code as described in PageFileManager::closeFile otherwise.
ReturnCode RecordManager::createFile | ( | const char * | fileName, | |
uint | recordSize | |||
) |
Create a new record file.
fileName | The name of the file to create | |
recordSize | The size in bytes of the file's records |
Creates a new record file. Returns RC_OK on success, RC_RECORD_TOO_LARGE if the specified record size is too large (e.g., greater than PF_PAGE_SIZE), RC_FILE_ALREADY_EXISTS if a file of the same name already exists, and RC_UNIX if there is an underlying file system error.
RecordManager * RecordManager::getInstance | ( | ) | [static] |
Gets the singleton instance of this class.
This method is already implemented for you.
ReturnCode RecordManager::openFile | ( | const char * | fileName, | |
RecordFileHandle ** | fileHandle | |||
) |
Opens an existing record file.
fileName | The name of the file to open | |
fileHandle | Out parameter used to return the record file handle |
Opens an existing record file and returns a new record file handle. Returns RC_OK on success, RC_FILE_NOT_FOUND if the file is not found, RC_UNIX if there is an underlying file system error, and RC_CORRUPT_FILE if the file appears to be corrupt. The file must eventually be closed by a matching call to RecordManager::closeFile.
ReturnCode RecordManager::removeFile | ( | const char * | fileName | ) |
Removes (deletes) a record file.
fileName | The name of the file to delete |
Deletes a record file. Returns RC_OK on success, and RC_FILE_NOT_FOUND if the file is not found or cannot be deleted.