|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimpledb.buffer.Buffer
public class Buffer
An individual buffer. A buffer wraps a page and stores information about its status, such as the disk block associated with the page, the number of times the block has been pinned, whether the contents of the page have been modified, and if so, the id of the modifying transaction and the LSN of the corresponding log record.
Constructor Summary | |
---|---|
Buffer()
Creates a new buffer, wrapping a new page . |
Method Summary | |
---|---|
Block |
block()
Returns a reference to the disk block that the buffer is pinned to. |
int |
getInt(int offset)
Returns the integer value at the specified offset of the buffer's page. |
String |
getString(int offset)
Returns the string value at the specified offset of the buffer's page. |
void |
setInt(int offset,
int val,
int txnum,
int lsn)
Writes an integer to the specified offset of the buffer's page. |
void |
setString(int offset,
String val,
int txnum,
int lsn)
Writes a string to the specified offset of the buffer's page. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Buffer()
page
.
This constructor is called exclusively by the
class BasicBufferMgr
.
It depends on the
LogMgr
object
that it gets from the class
SimpleDB
.
That object is created during system initialization.
Thus this constructor cannot be called until
SimpleDB.initFileAndLogMgr(String)
or
is called first.
Method Detail |
---|
public int getInt(int offset)
offset
- the byte offset of the page
public String getString(int offset)
offset
- the byte offset of the page
public void setInt(int offset, int val, int txnum, int lsn)
offset
- the byte offset within the pageval
- the new integer value to be writtentxnum
- the id of the transaction performing the modificationlsn
- the LSN of the corresponding log recordpublic void setString(int offset, String val, int txnum, int lsn)
offset
- the byte offset within the pageval
- the new string value to be writtentxnum
- the id of the transaction performing the modificationlsn
- the LSN of the corresponding log recordpublic Block block()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |