|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectBufferManager
public class BufferManager
Buffer manager. Manages a memory-based buffer pool of pages.
| Nested Class Summary | |
|---|---|
static class |
BufferManager.PageNotPinnedException
|
static class |
BufferManager.PagePinnedException
|
| Field Summary | |
|---|---|
static int |
INVALID_PAGE
Value to use for an invalid page id. |
| Constructor Summary | |
|---|---|
BufferManager(int poolSize)
Creates a buffer manager with the specified size. |
|
| Method Summary | |
|---|---|
int |
findFrame(int pageId,
java.lang.String fileName)
Returns buffer pool location for a particular pageId. |
void |
flushAllPages()
Flushes all dirty pages from the buffer pool to the underlying databases. |
void |
flushPage(int pageId,
java.lang.String fileName)
Flushes page from the buffer pool to the underlying database if it is dirty. |
void |
freePage(int pageId,
java.lang.String fileName)
Deallocates a page from the underlying database. |
Pair<java.lang.Integer,Page> |
newPage(int numPages,
java.lang.String fileName)
Requests a run of pages from the underlying database, then finds a frame in the buffer pool for the first page and pins it. |
Page |
pinPage(int pinPageId,
java.lang.String fileName,
boolean emptyPage)
Checks if this page is in buffer pool. |
int |
poolSize()
Returns the pool size. |
void |
unpinPage(int unpinPageId,
java.lang.String fileName,
boolean dirty)
If the pin count for this page is greater than 0, it is decremented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int INVALID_PAGE
| Constructor Detail |
|---|
public BufferManager(int poolSize)
poolSize - the number of pages that the buffer pool can hold.| Method Detail |
|---|
public int poolSize()
public Page pinPage(int pinPageId,
java.lang.String fileName,
boolean emptyPage)
throws java.io.IOException
pinPageId - the page id for the page to be pinnedfileName - the name of the database that contains the page
to be pinnedemptyPage - determines if the page is known to be
empty. If true, then the page is not actually read from disk
since it is assumed to be empty.
java.io.IOException - passed through from underlying file system.
public void unpinPage(int unpinPageId,
java.lang.String fileName,
boolean dirty)
throws java.io.IOException
unpinPageId - the page id for the page to be unpinnedfileName - the name of the database that contains the page
to be unpinneddirty - if false, then the page does not actually need to
be written back to disk.
BufferManager.PageNotPinnedException - if the page is not pinned, or if
the page id is invalid in some other way.
java.io.IOException - passed through from underlying file system.
public Pair<java.lang.Integer,Page> newPage(int numPages,
java.lang.String fileName)
throws java.io.IOException
numPages - the number of pages in the run to be allocated.fileName - the name of the database from where pages are
to be allocated.
DBFile.FileFullException - if there are not enough free pages.
java.io.IOException - passed through from underlying file system.
public void freePage(int pageId,
java.lang.String fileName)
throws java.io.IOException
pageId - the page id to be deallocated.fileName - the name of the database from where the page is
to be deallocated.
BufferManager.PagePinnedException - if the page is pinned
java.io.IOException - passed through from underlying file system.
public void flushPage(int pageId,
java.lang.String fileName)
throws java.io.IOException
pageId - the page id to be flushed.fileName - the name of the database where the page should
be flushed.
java.io.IOException - passed through from underlying file system.
public void flushAllPages()
throws java.io.IOException
java.io.IOException - passed through from underlying file system.
public int findFrame(int pageId,
java.lang.String fileName)
pageId - the page id to be looked up.fileName - the file name to be looked up.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||