The central class which manages the buffer pool including frame allocation and deallocation to pages in the file.
More...
#include <buffer.h>
The central class which manages the buffer pool including frame allocation and deallocation to pages in the file.
Definition at line 131 of file buffer.h.
wiscdb::BufferManager::BufferManager |
( |
std::uint32_t |
bufs | ) |
|
wiscdb::BufferManager::~BufferManager |
( |
| ) |
|
void wiscdb::BufferManager::allocatePage |
( |
File * |
file, |
|
|
PageId & |
PageNo, |
|
|
Page *& |
page |
|
) |
| |
Allocates a new, empty page in the file and returns the Page object. The newly allocated page is also assigned a frame in the buffer pool.
- Parameters
-
file | File object |
PageNo | Page number. The number assigned to the page in the file is returned via this reference. |
page | Reference to page pointer. The newly allocated in-memory Page object is returned via this reference. |
void wiscdb::BufferManager::clearBufferStats |
( |
| ) |
|
|
inline |
Clear buffer pool usage statistics
Definition at line 271 of file buffer.h.
void wiscdb::BufferManager::disposePage |
( |
File * |
file, |
|
|
const PageId |
PageNo |
|
) |
| |
Delete page from file and also from buffer pool if present. Since the page is entirely deleted from file, its unnecessary to see if the page is dirty.
- Parameters
-
void wiscdb::BufferManager::flushFile |
( |
const File * |
file | ) |
|
Writes out all dirty pages of the file to disk. All the frames assigned to the file need to be unpinned from buffer pool before this function can be successfully called. Otherwise an exception is thrown.
- Parameters
-
file | File object to flush to disk |
- Exceptions
-
Get buffer pool usage statistics
Definition at line 263 of file buffer.h.
void wiscdb::BufferManager::printSelf |
( |
| ) |
|
Print member variable values.
void wiscdb::BufferManager::readPage |
( |
File * |
file, |
|
|
const PageId |
PageNo, |
|
|
Page *& |
page |
|
) |
| |
Reads the given page from the file into a frame and returns the pointer to page. If the requested page is already present in the buffer pool, its pin count is increased and a pointer to that frame is returned; otherwise a new frame is allocated from the buffer pool for reading the page.
- Parameters
-
file | File object |
PageNo | Page number in the file to be read |
page | Reference to page pointer. Used to fetch the Page object in which requested page from file is read in. |
void wiscdb::BufferManager::unPinPage |
( |
File * |
file, |
|
|
const PageId |
PageNo, |
|
|
const bool |
dirty |
|
) |
| |
Unpin a page from memory when one requesting application no longer requires it to remain in memory.
- Parameters
-
file | File object |
PageNo | Page number |
dirty | True if the page to be unpinned needs to be marked dirty |
- Exceptions
-
Page* wiscdb::BufferManager::bufPool |
Actual buffer pool of Pages. A table of Page objects, with each index corresponding to Frame at the same index of frameTable.
Definition at line 182 of file buffer.h.
The documentation for this class was generated from the following file: