|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsimpledb.file.FileMgr
public class FileMgr
The SimpleDB file manager.
The database system stores its data as files within a specified directory.
The file manager provides methods for reading the contents of
a file block to a Java byte buffer,
writing the contents of a byte buffer to a file block,
and appending the contents of a byte buffer to the end of a file.
These methods are called exclusively by the class Page,
and are thus package-private.
The class also contains two public methods:
Method isNew is called during system initialization by SimpleDB.init(java.lang.String).
Method size is called by the log manager and transaction manager to
determine the end of the file.
| Constructor Summary | |
|---|---|
FileMgr(java.lang.String dbname)
Creates a file manager for the specified database. |
|
| Method Summary | |
|---|---|
(package private) Block |
append(java.lang.String filename,
java.nio.ByteBuffer bb)
Appends the contents of a bytebuffer to the end of the specified file. |
void |
close()
|
boolean |
isNew()
Returns a boolean indicating whether the file manager had to create a new database directory. |
(package private) void |
read(Block blk,
java.nio.ByteBuffer bb)
Reads the contents of a disk block into a bytebuffer. |
int |
size(java.lang.String filename)
Returns the number of blocks in the specified file. |
(package private) void |
write(Block blk,
java.nio.ByteBuffer bb)
Writes the contents of a bytebuffer into a disk block. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileMgr(java.lang.String dbname)
dbname - the name of the directory that holds the database| Method Detail |
|---|
void read(Block blk,
java.nio.ByteBuffer bb)
blk - a reference to a disk blockbb - the bytebuffer
void write(Block blk,
java.nio.ByteBuffer bb)
blk - a reference to a disk blockbb - the bytebuffer
Block append(java.lang.String filename,
java.nio.ByteBuffer bb)
filename - the name of the filebb - the bytebuffer
public int size(java.lang.String filename)
filename - the name of the file
public boolean isNew()
public void close()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||