|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimpledb.tx.Transaction
public class Transaction
Provides transaction management for clients, ensuring that all transactions are serializable, recoverable, and in general satisfy the ACID properties.
| Constructor Summary | |
|---|---|
Transaction()
Creates a new transaction and its associated recovery and concurrency managers. |
|
| Method Summary | |
|---|---|
Block |
append(String filename,
PageFormatter fmtr)
Appends a new block to the end of the specified file and returns a reference to it. |
void |
commit()
Commits the current transaction. |
int |
getInt(Block blk,
int offset)
Returns the integer value stored at the specified offset of the specified block. |
String |
getString(Block blk,
int offset)
Returns the string value stored at the specified offset of the specified block. |
void |
pin(Block blk)
Pins the specified block. |
void |
recover()
Flushes all modified buffers. |
void |
rollback()
Rolls back the current transaction. |
void |
setInt(Block blk,
int offset,
int val)
Stores an integer at the specified offset of the specified block. |
void |
setString(Block blk,
int offset,
String val)
Stores a string at the specified offset of the specified block. |
int |
size(String filename)
Returns the number of blocks in the specified file. |
void |
unpin(Block blk)
Unpins the specified block. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Transaction()
SimpleDB.
Those objects are created during system initialization.
Thus this constructor cannot be called until either
SimpleDB.init(String) or
SimpleDB.initFileLogAndBufferMgr(String) or
is called first.
| Method Detail |
|---|
public void commit()
public void rollback()
public void recover()
public void pin(Block blk)
blk - a reference to the disk blockpublic void unpin(Block blk)
blk - a reference to the disk block
public int getInt(Block blk,
int offset)
blk - a reference to a disk blockoffset - the byte offset within the block
public String getString(Block blk,
int offset)
blk - a reference to a disk blockoffset - the byte offset within the block
public void setInt(Block blk,
int offset,
int val)
blk - a reference to the disk blockoffset - a byte offset within that blockval - the value to be stored
public void setString(Block blk,
int offset,
String val)
blk - a reference to the disk blockoffset - a byte offset within that blockval - the value to be storedpublic int size(String filename)
filename - the name of the file
public Block append(String filename,
PageFormatter fmtr)
filename - the name of the filefmtr - the formatter used to initialize the new page
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||