|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimpledb.buffer.BufferMgr
public class BufferMgr
The publicly-accessible buffer manager.
A buffer manager wraps a basic buffer manager, and
provides the same methods. The difference is that
the methods pin
and
pinNew
will never return null.
If no buffers are currently available, then the
calling thread will be placed on a waiting list.
The waiting threads are removed from the list when
a buffer becomes available.
If a thread has been waiting for a buffer for an
excessive amount of time (currently, 10 seconds)
then a BufferAbortException
is thrown.
Constructor Summary | |
---|---|
BufferMgr(int numbuffers)
Creates a new buffer manager having the specified number of buffers. |
Method Summary | |
---|---|
int |
available()
Returns the number of available (ie unpinned) buffers. |
void |
flushAll(int txnum)
Flushes the dirty buffers modified by the specified transaction. |
Buffer |
pin(Block blk)
Pins a buffer to the specified block, potentially waiting until a buffer becomes available. |
Buffer |
pinNew(String filename,
PageFormatter fmtr)
Pins a buffer to a new block in the specified file, potentially waiting until a buffer becomes available. |
void |
unpin(Buffer buff)
Unpins the specified buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BufferMgr(int numbuffers)
FileMgr
and
LogMgr
objects
that it gets from the class
SimpleDB
.
Those objects are created during system initialization.
Thus this constructor cannot be called until
SimpleDB.initFileAndLogMgr(String)
or
is called first.
numbuffers
- the number of buffer slots to allocateMethod Detail |
---|
public Buffer pin(Block blk)
BufferAbortException
is thrown.
blk
- a reference to a disk block
public Buffer pinNew(String filename, PageFormatter fmtr)
BufferAbortException
is thrown.
filename
- the name of the filefmtr
- the formatter used to initialize the page
public void unpin(Buffer buff)
buff
- the buffer to be unpinnedpublic void flushAll(int txnum)
txnum
- the transaction's id numberpublic int available()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |