|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbufmgr.BufMgr
public class BufMgr
| Field Summary |
|---|
| Fields inherited from interface global.GlobalConst |
|---|
EMPTY_SLOT, FIRST_PAGEID, INVALID_PAGEID, MAX_COLSIZE, MAX_TUPSIZE, NAME_MAXLEN, PAGE_SIZE, PIN_DISKIO, PIN_MEMCPY, UNPIN_CLEAN, UNPIN_DIRTY |
| Constructor Summary | |
|---|---|
BufMgr(int numbufs)
Constructs a buffer mamanger with the given settings. |
|
| Method Summary | |
|---|---|
void |
flushAllPages()
Immediately writes all dirty pages in the buffer pool to disk. |
void |
flushPage(PageId pageno)
Immediately writes a page in the buffer pool to disk, if dirty. |
void |
freePage(PageId pageno)
Deallocates a single page from disk, freeing it from the pool if needed. |
int |
getNumBuffers()
Gets the total number of buffer frames. |
int |
getNumUnpinned()
Gets the total number of unpinned buffer frames. |
PageId |
newPage(Page firstpg,
int run_size)
Allocates a set of new pages, and pins the first one in an appropriate frame in the buffer pool. |
void |
pinPage(PageId pageno,
Page page,
boolean skipRead)
Pins a disk page into the buffer pool. |
void |
unpinPage(PageId pageno,
boolean dirty)
Unpins a disk page from the buffer pool, decreasing its pin count. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BufMgr(int numbufs)
numbufs - number of buffers in the buffer pool| Method Detail |
|---|
public PageId newPage(Page firstpg,
int run_size)
firstpg - holds the contents of the first pagerun_size - number of pages to allocate
java.lang.IllegalArgumentException - if PIN_MEMCPY and the page is pinned
java.lang.IllegalStateException - if all pages are pinned (i.e. pool exceeded)public void freePage(PageId pageno)
pageno - identifies the page to remove
java.lang.IllegalArgumentException - if the page is pinned
public void pinPage(PageId pageno,
Page page,
boolean skipRead)
pageno - identifies the page to pinpage - holds contents of the page, either an input or output paramskipRead - PIN_MEMCPY (replace in pool); PIN_DISKIO (read the page in)
java.lang.IllegalArgumentException - if PIN_MEMCPY and the page is pinned
java.lang.IllegalStateException - if all pages are pinned (i.e. pool exceeded)
public void unpinPage(PageId pageno,
boolean dirty)
pageno - identifies the page to unpindirty - UNPIN_DIRTY if the page was modified, UNPIN_CLEAN otherrwise
java.lang.IllegalArgumentException - if the page is not present or not pinnedpublic void flushPage(PageId pageno)
public void flushAllPages()
public int getNumBuffers()
public int getNumUnpinned()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||