|
||||||||||
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()
default constructor. |
Method Summary | |
---|---|
void |
add_file_entry(java.lang.String fname,
PageId start_page_num)
Adds a file entry to the header page(s). |
PageId |
allocate_page(int run_size)
Allocates a set of pages on disk, given the run size. |
void |
allocate_page(PageId start_page_num)
Allocate a set of pages where the run size is taken to be 1 by default. |
void |
allocate_page(PageId start_page_num,
int runsize)
user specified run_size |
void |
closeDB()
Close DB file. |
java.lang.String |
db_name()
Functions to return some characteristics of the database. |
int |
db_num_pages()
|
int |
db_page_size()
|
void |
DBDestroy()
Destroy the database, removing the file that stores it. |
void |
deallocate_page(PageId start_page_num)
Deallocate a set of pages starting at the specified page number with run size = 1 |
void |
deallocate_page(PageId start_page_num,
int run_size)
Deallocate a set of pages starting at the specified page number and a run size can be specified. |
void |
delete_file_entry(java.lang.String fname)
Delete the entry corresponding to a file from the header page(s). |
void |
dump_space_map()
Print out the space map of the database. |
PageId |
get_file_entry(java.lang.String name)
Get the entry corresponding to the given file. |
void |
openDB(java.lang.String fname)
Open the database with the given name. |
void |
openDB(java.lang.String fname,
int num_pgs)
DB Constructors. |
void |
read_page(PageId pageno,
Page apage)
Read the contents of the specified page into a Page object |
void |
write_page(PageId pageno,
Page apage)
Write the contents in a page object to the specified page. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DiskMgr()
Method Detail |
---|
public void openDB(java.lang.String fname) throws java.io.IOException, InvalidPageNumberException, FileIOException, DiskMgrException
fname
- DB_name
java.io.IOException
- I/O errors
FileIOException
- file I/O error
InvalidPageNumberException
- invalid page number
DiskMgrException
- error caused by other layerspublic void openDB(java.lang.String fname, int num_pgs) throws java.io.IOException, chainexception.ChainException
fname
- DB namenum_pgs
- number of pages in DB
java.io.IOException
- I/O errors
chainexception.ChainException
public void closeDB() throws java.io.IOException
java.io.IOException
- I/O errors.public void DBDestroy() throws java.io.IOException
java.io.IOException
- I/O errors.public void read_page(PageId pageno, Page apage) throws InvalidPageNumberException, FileIOException, java.io.IOException
pageno
- pageId which will be readapage
- page object which holds the contents of page
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
java.io.IOException
- I/O errorspublic void write_page(PageId pageno, Page apage) throws InvalidPageNumberException, FileIOException, java.io.IOException
pageno
- pageId will be wrote to diskapage
- the page object will be wrote to disk
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
java.io.IOException
- I/O errorspublic PageId allocate_page(int run_size) throws chainexception.ChainException, java.io.IOException
java.io.IOException
chainexception.ChainException
java.lang.IllegalArgumentException
- if run_size is invalid
java.lang.IllegalStateException
- if the database is fullpublic void allocate_page(PageId start_page_num) throws chainexception.ChainException, java.io.IOException
start_page_num
- page number to start with
OutOfSpaceException
- database is full
InvalidRunSizeException
- invalid run size
InvalidPageNumberException
- invalid page number
FileIOException
- DB file I/O errors
java.io.IOException
- I/O errors
DiskMgrException
- error caused by other layers
chainexception.ChainException
public void allocate_page(PageId start_page_num, int runsize) throws java.io.IOException, chainexception.ChainException
start_page_num
- the starting page id of the run of pagesrunsize
- the number of page need allocated
java.io.IOException
- I/O errors
chainexception.ChainException
public void deallocate_page(PageId start_page_num, int run_size) throws java.io.IOException, chainexception.ChainException
start_page_num
- the start pageId to be deallocaterun_size
- the number of pages to be deallocated
java.io.IOException
- I/O errors
chainexception.ChainException
public void deallocate_page(PageId start_page_num) throws chainexception.ChainException
start_page_num
- the start pageId to be deallocate
InvalidRunSizeException
- invalid run size
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
java.io.IOException
- I/O errors
DiskMgrException
- error caused by other layers
chainexception.ChainException
public void add_file_entry(java.lang.String fname, PageId start_page_num) throws FileNameTooLongException, InvalidPageNumberException, InvalidRunSizeException, DuplicateEntryException, OutOfSpaceException, FileIOException, java.io.IOException, DiskMgrException
fname
- file entry namestart_page_num
- the start page number of the file entry
FileNameTooLongException
- invalid file name (too long)
InvalidPageNumberException
- invalid page number
InvalidRunSizeException
- invalid DB run size
DuplicateEntryException
- entry for DB is not unique
OutOfSpaceException
- database is full
FileIOException
- file I/O error
java.io.IOException
- I/O errors
DiskMgrException
- error caused by other layerspublic void delete_file_entry(java.lang.String fname) throws FileEntryNotFoundException, java.io.IOException, FileIOException, InvalidPageNumberException, DiskMgrException
fname
- file entry name
FileEntryNotFoundException
- file does not exist
FileIOException
- file I/O error
java.io.IOException
- I/O errors
InvalidPageNumberException
- invalid page number
DiskMgrException
- error caused by other layerspublic PageId get_file_entry(java.lang.String name) throws java.io.IOException, FileIOException, InvalidPageNumberException, DiskMgrException
name
- file entry name
java.io.IOException
- I/O errors
FileIOException
- file I/O error
InvalidPageNumberException
- invalid page number
DiskMgrException
- error caused by other layerspublic java.lang.String db_name()
public int db_num_pages()
public int db_page_size()
public void dump_space_map() throws DiskMgrException, java.io.IOException, FileIOException, InvalidPageNumberException
FileIOException
- file I/O error
java.io.IOException
- I/O errors
InvalidPageNumberException
- invalid page number
DiskMgrException
- error caused by other layers
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |