|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbtree.IndexFile
btree.BTreeFile
btfile.java This is the main definition of class BTreeFile, which derives from abstract base class IndexFile. It provides an insert/delete interface.
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 | |
BTreeFile(java.lang.String filename)
BTreeFile class an index file with given filename should already exist; this opens it. |
|
BTreeFile(java.lang.String filename,
int keytype,
int keysize,
int delete_fashion)
if index file exists, open it; else create it. |
Method Summary | |
void |
close()
Close the B+ tree file. |
boolean |
Delete(KeyClass key,
RID rid)
delete leaf entry given its |
void |
destroyFile()
Destroy entire B+ tree file. |
static void |
destroyTrace()
Stop tracing. |
btree.BTreeHeaderPage |
getHeaderPage()
Access method to data member. |
void |
insert(KeyClass key,
RID rid)
insert record with the given key and rid |
BTFileScan |
new_scan(KeyClass lo_key,
KeyClass hi_key)
create a scan with given keys Cases: (1) lo_key = null, hi_key = null scan the whole index (2) lo_key = null, hi_key!= null range scan from min to the hi_key (3) lo_key!= null, hi_key = null range scan from the lo_key to max (4) lo_key!= null, hi_key!= null, lo_key = hi_key exact match ( might not unique) (5) lo_key!= null, hi_key!= null, lo_key < hi_key range scan from lo_key to hi_key |
static void |
traceFilename(java.lang.String filename)
It causes a structured trace to be written to a file. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BTreeFile(java.lang.String filename) throws GetFileEntryException, PinPageException, ConstructPageException
filename
- the B+ tree file name. Input parameter.
GetFileEntryException
- can not ger the file from DB
PinPageException
- failed when pin a page
ConstructPageException
- BT page constructor failedpublic BTreeFile(java.lang.String filename, int keytype, int keysize, int delete_fashion) throws GetFileEntryException, ConstructPageException, java.io.IOException, AddFileEntryException
filename
- file name. Input parameter.keytype
- the type of key. Input parameter.keysize
- the maximum size of a key. Input parameter.delete_fashion
- full delete or naive delete. Input parameter.
It is either DeleteFashion.NAIVE_DELETE or
DeleteFashion.FULL_DELETE.
GetFileEntryException
- can not get file
ConstructPageException
- page constructor failed
java.io.IOException
- error from lower layer
AddFileEntryException
- can not add file into DBMethod Detail |
public static void traceFilename(java.lang.String filename) throws java.io.IOException
filename
- input parameter. The trace file name
java.io.IOException
- error from the lower layerpublic static void destroyTrace() throws java.io.IOException
java.io.IOException
- error from the lower layerpublic btree.BTreeHeaderPage getHeaderPage()
public void close() throws PageUnpinnedException, InvalidFrameNumberException, HashEntryNotFoundException, ReplacerException
PageUnpinnedException
- error from the lower layer
InvalidFrameNumberException
- error from the lower layer
HashEntryNotFoundException
- error from the lower layer
ReplacerException
- error from the lower layerpublic void destroyFile() throws java.io.IOException, IteratorException, UnpinPageException, FreePageException, DeleteFileEntryException, ConstructPageException, PinPageException
java.io.IOException
- error from the lower layer
IteratorException
- iterator error
UnpinPageException
- error when unpin a page
FreePageException
- error when free a page
DeleteFileEntryException
- failed when delete a file from DM
ConstructPageException
- error in BT page constructor
PinPageException
- failed when pin a pagepublic void insert(KeyClass key, RID rid) throws KeyTooLongException, KeyNotMatchException, LeafInsertRecException, IndexInsertRecException, ConstructPageException, UnpinPageException, PinPageException, NodeNotMatchException, ConvertException, DeleteRecException, IndexSearchException, IteratorException, LeafDeleteException, InsertException, java.io.IOException
insert
in class IndexFile
key
- the key of the record. Input parameter.rid
- the rid of the record. Input parameter.
KeyTooLongException
- key size exceeds the max keysize.
KeyNotMatchException
- key is not integer key nor string key
java.io.IOException
- error from the lower layer
LeafInsertRecException
- insert error in leaf page
IndexInsertRecException
- insert error in index page
ConstructPageException
- error in BT page constructor
UnpinPageException
- error when unpin a page
PinPageException
- error when pin a page
NodeNotMatchException
- node not match index page nor leaf page
ConvertException
- error when convert between revord and byte
array
DeleteRecException
- error when delete in index page
IndexSearchException
- error when search
IteratorException
- iterator error
LeafDeleteException
- error when delete in leaf page
InsertException
- error when insert in index pagepublic boolean Delete(KeyClass key, RID rid) throws DeleteFashionException, LeafRedistributeException, RedistributeException, InsertRecException, KeyNotMatchException, UnpinPageException, IndexInsertRecException, FreePageException, RecordNotFoundException, PinPageException, IndexFullDeleteException, LeafDeleteException, IteratorException, ConstructPageException, DeleteRecException, IndexSearchException, java.io.IOException
Delete
in class IndexFile
key
- the key in pair rid
- the rid in pair DeleteFashionException
- neither full delete nor naive delete
LeafRedistributeException
- redistribution error in leaf pages
RedistributeException
- redistribution error in index pages
InsertRecException
- error when insert in index page
KeyNotMatchException
- key is neither integer key nor string key
UnpinPageException
- error when unpin a page
IndexInsertRecException
- error when insert in index page
FreePageException
- error in BT page constructor
RecordNotFoundException
- error delete a record in a BT page
PinPageException
- error when pin a page
IndexFullDeleteException
- fill delete error
LeafDeleteException
- delete error in leaf page
IteratorException
- iterator error
ConstructPageException
- error in BT page constructor
DeleteRecException
- error when delete in index page
IndexSearchException
- error in search in index pages
java.io.IOException
- error from the lower layerpublic BTFileScan new_scan(KeyClass lo_key, KeyClass hi_key) throws java.io.IOException, KeyNotMatchException, IteratorException, ConstructPageException, PinPageException, UnpinPageException
lo_key
- the key where we begin scanning. Input parameter.hi_key
- the key where we stop scanning. Input parameter.
java.io.IOException
- error from the lower layer
KeyNotMatchException
- key is not integer key nor string key
IteratorException
- iterator error
ConstructPageException
- error in BT page constructor
PinPageException
- error when pin a page
UnpinPageException
- error when unpin a page
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |