|
smollerGraph 0.20.2
A small graph database, from scratch
|
Keeps some of a file's pages in memory, in frames, so reading or changing a page there needs no system call. More...
#include <buffer_pool.h>
Public Member Functions | |
| BufferPool (Pager &pager, size_t frames) | |
A pool of up to frames pages of the file pager has open. | |
| ~BufferPool () | |
| Writes the changed pages back. | |
| BufferPool (const BufferPool &)=delete | |
| BufferPool & | operator= (const BufferPool &)=delete |
| PageHandle | Fetch (PageId id) |
Pins page id, reading it from the file when it isn't in a frame. | |
| void | Flush () |
| Writes the changed pages back to the file, and keeps them. | |
| void | Clear () |
| Writes the changed pages back, and forgets them all, before the pager opens another file. | |
Friends | |
| class | PageHandle |
Keeps some of a file's pages in memory, in frames, so reading or changing a page there needs no system call.
The file is read when a page comes into a frame, and written when a changed page leaves one, or when it's flushed.
Definition at line 37 of file buffer_pool.h.
| smollergraph::BufferPool::BufferPool | ( | Pager & | pager, |
| size_t | frames | ||
| ) |
A pool of up to frames pages of the file pager has open.
Definition at line 19 of file buffer_pool.cc.
| smollergraph::BufferPool::~BufferPool | ( | ) |
Writes the changed pages back.
Definition at line 26 of file buffer_pool.cc.
|
delete |
| void smollergraph::BufferPool::Clear | ( | ) |
Writes the changed pages back, and forgets them all, before the pager opens another file.
Definition at line 97 of file buffer_pool.cc.
| PageHandle smollergraph::BufferPool::Fetch | ( | PageId | id | ) |
Pins page id, reading it from the file when it isn't in a frame.
A page past the end of the file starts out as zeros.
Definition at line 28 of file buffer_pool.cc.
| void smollergraph::BufferPool::Flush | ( | ) |
Writes the changed pages back to the file, and keeps them.
Definition at line 88 of file buffer_pool.cc.
|
delete |
|
friend |
Definition at line 56 of file buffer_pool.h.