SwatDB
|
#include <file.h>
Public Member Functions | |
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. | |
virtual void | createHeader ()=0 |
Allocates and initializes the header. Is a virtual method to be overridden at each derived class. | |
virtual void | flushHeader ()=0 |
Flushes Header Page to disk. Is a virtual method to be overridden at each derived class. | |
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. | |
Protected Member Functions | |
void | _setFileId (FileId file_id) |
Sets the file_id and the schema fields of this File. | |
Protected Attributes | |
FileId | file_id |
Catalog * | catalog |
BufferManager * | buf_mgr |
PageId | header_id |
Friends | |
class | Catalog |
class | FileManager |
SwatDB File Class. The base class for all file-type objects in the system. A File is used to represent a relation or index in the system. This base class inludes state and methods that are common to every type of file in the system.
File::File | ( | Catalog * | catalog, |
BufferManager * | buf_mgr | ||
) |
Constructor. Initializes common state associated with every file, including catalog, buf_mgr, and schema.
catalog | Pointer to the SwatDB Catalog. Needed for getting file and idex relation files and schema. |
buf_mgr | Pointer to the SwatDB Buffer Manager. Needed for de/allocating Pages, for getting and flushing Pages. |
|
protected |
Sets the file_id and the schema fields of this File.
NOTE: this is called by
file_id | The File's FileId. |
|
pure virtual |
Allocates and initializes the header. Is a virtual method to be overridden at each derived class.
Implemented in HashIndexFile, and HeapFile.
|
pure virtual |
Flushes Header Page to disk. Is a virtual method to be overridden at each derived class.
Implemented in HashIndexFile, and HeapFile.
PageId File::getHeaderId | ( | ) |
|
protected |
Pointer to the SwatDB BufferManager