|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdiskmgr.DiskMgr
public class DiskMgr
| 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 | |
|---|---|
DiskMgr()
|
|
| Method Summary | |
|---|---|
void |
add_file_entry(java.lang.String fname,
PageId start_pageno)
Adds a file entry to the header page(s); each entry contains the name of the file and the PageId of the file's first page. |
PageId |
allocate_page()
Allocates a single page (i.e. |
PageId |
allocate_page(int run_size)
Allocates a set of pages on disk, given the run size. |
void |
closeDB()
Closes the database file. |
void |
createDB(java.lang.String fname,
int num_pgs)
Creates and opens a new database with the given file name and specified number of pages. |
void |
deallocate_page(PageId pageno)
Deallocates a single page (i.e. |
void |
deallocate_page(PageId firstid,
int run_size)
Deallocates a set of pages on disk, given the run size. |
void |
delete_file_entry(java.lang.String fname)
Deletes a file entry from the header page(s). |
void |
destroyDB()
Destroys the database, removing the file that stores it. |
PageId |
get_file_entry(java.lang.String fname)
Looks up the entry for the given file name. |
int |
getAllocCount()
Gets the number of allocated disk pages. |
int |
getReadCount()
Gets the number of disk reads since construction. |
int |
getWriteCount()
Gets the number of disk writes since construction. |
void |
openDB(java.lang.String fname)
Open the database with the given file name. |
void |
print_space_map()
Print out the database's space map, a bitmap showing which pages are currently allocated. |
void |
read_page(PageId pageno,
Page page)
Reads the contents of the specified page from disk. |
void |
write_page(PageId pageno,
Page page)
Writes the contents of the given page to disk. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DiskMgr()
| Method Detail |
|---|
public int getReadCount()
public int getWriteCount()
public int getAllocCount()
public void createDB(java.lang.String fname,
int num_pgs)
public void openDB(java.lang.String fname)
public void closeDB()
public void destroyDB()
public PageId allocate_page()
java.lang.IllegalStateException - if the database is fullpublic PageId allocate_page(int run_size)
java.lang.IllegalArgumentException - if run_size is invalid
java.lang.IllegalStateException - if the database is fullpublic void deallocate_page(PageId pageno)
pageno - identifies the page to deallocate
java.lang.IllegalArgumentException - if firstid is invalid
public void deallocate_page(PageId firstid,
int run_size)
firstid - identifies the first page to deallocaterun_size - number of pages to deallocate
java.lang.IllegalArgumentException - if firstid or run_size is invalid
public void read_page(PageId pageno,
Page page)
pageno - identifies the page to readpage - output param to hold the contents of the page
java.lang.IllegalArgumentException - if pageno is invalid
public void write_page(PageId pageno,
Page page)
pageno - identifies the page to writepage - holds the contents of the page
java.lang.IllegalArgumentException - if pageno is invalid
public void add_file_entry(java.lang.String fname,
PageId start_pageno)
java.lang.IllegalArgumentException - if fname or start_pageno is invalidpublic void delete_file_entry(java.lang.String fname)
java.lang.IllegalArgumentException - if fname is invalidpublic PageId get_file_entry(java.lang.String fname)
public void print_space_map()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||