|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiskmgr.DB
Field Summary |
Fields inherited from interface global.GlobalConst |
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF |
Constructor Summary | |
DB()
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). |
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 DB()
Method Detail |
public void openDB(java.lang.String fname) throws java.io.IOException, InvalidPageNumberException, FileIOException, DiskMgrException
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, InvalidPageNumberException, FileIOException, DiskMgrException
java.io.IOException
- I/O errors
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
DiskMgrException
- error caused by other layerspublic 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 void allocate_page(PageId start_page_num) throws OutOfSpaceException, InvalidRunSizeException, InvalidPageNumberException, FileIOException, DiskMgrException, 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 layerspublic void allocate_page(PageId start_page_num, int runsize) throws OutOfSpaceException, InvalidRunSizeException, InvalidPageNumberException, FileIOException, DiskMgrException, java.io.IOException
start_page_num
- the starting page id of the run of pages
OutOfSpaceException
- No space left
InvalidRunSizeException
- invalid run size
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
java.io.IOException
- I/O errors
DiskMgrException
- error caused by other layerspublic void deallocate_page(PageId start_page_num, int run_size) throws InvalidRunSizeException, InvalidPageNumberException, java.io.IOException, FileIOException, DiskMgrException
start_page_num
- the start pageId to be deallocaterun_size
- the number of pages to be deallocated
InvalidRunSizeException
- invalid run size
InvalidPageNumberException
- invalid page number
FileIOException
- file I/O error
java.io.IOException
- I/O errors
DiskMgrException
- error caused by other layerspublic void deallocate_page(PageId start_page_num) throws InvalidRunSizeException, InvalidPageNumberException, java.io.IOException, FileIOException, DiskMgrException
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 layerspublic 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 |