![]() |
Quadcap Embeddable Database |
Inheritance diagram for com.quadcap.sql.index.Btree:

Most of the real work happens in the Bnode class.
Definition at line 59 of file Btree.java.
Public Member Functions | |
| Btree (BlockFile file, Comparator compare, long rootBlock, boolean create) throws IOException | |
| Open a btree index. | |
| Btree (BlockFile file, long rootBlock, boolean create) throws IOException | |
| Open a btree index. | |
| int | size () throws IOException |
| int | get (byte[] key, int klen, byte[] data) throws IOException |
| Get the data bytes for the specified key. | |
| byte[] | get (byte[] key) throws IOException |
| boolean | delete (byte[] key) throws IOException |
| Delete the specified key. | |
| boolean | deleteObs (byte[] key) throws IOException |
| void | set (byte[] key, byte[] val) throws IOException |
| void | insert (byte[] key, int klen, byte[] val, int off, int len) throws IOException |
| Add a new key. | |
| void | update (byte[] key, int klen, byte[] val, int off, int len) throws IOException |
| Update the data value for an existing key. | |
| boolean | set (byte[] key, int klen, byte[] val, int off, int len) throws IOException |
| Set the key/data pair, replacing any any value it may present in a unique index, inserting a new values, whatever. | |
| long | getRootBlock () |
| BlockFile | getFile () |
Return a reference to the underlying BlockFile</code. | |
| Comparator | getComparator () |
| Return the comparator used to collate keys. | |
| BCursor | getCursor () throws IOException |
| Get a cursor. | |
| BCursor | getCursor (boolean skipSetup) throws IOException |
| Get a cursor. | |
| void | releaseCursor (BCursor c) |
| void | notifyUpdate (BCursor notMe) |
| void | free () throws IOException |
| Destroy this tree and free all of its resources. | |
| String | toString () |
| void | display (PrintWriter w) throws IOException |
Package Functions | |
| Bnode | getNode (long ref) |
| Bnode | getRoot () |
| void | setRoot (long ref) |
Package Attributes | |
| BlockFile | file |
| Comparator | compare |
| long | rootBlock |
| Bnode | root |
| Object | lock |
| byte[] | tbuf = new byte[16] |
| Set | activeCursors = new HashSet() |
Private Member Functions | |
| final BCursor | getMyCursor () throws IOException |
|
||||||||||||||||||||
|
Open a btree index. Fetch the root block and create an empty tree if the block is zero, open the existing tree otherwise.
Definition at line 79 of file Btree.java. References com.quadcap.sql.index.Bnode.checkMagic(), com.quadcap.sql.index.Btree.compare, com.quadcap.sql.index.Btree.file, com.quadcap.sql.index.Btree.getNode(), com.quadcap.sql.index.Bnode.init(), com.quadcap.sql.index.Btree.root, and com.quadcap.sql.index.Btree.rootBlock. |
|
||||||||||||||||
|
Open a btree index. Fetch the root block and create an empty tree if the block is zero, open the existing tree otherwise.
Definition at line 112 of file Btree.java. References com.quadcap.sql.index.Btree.file, and com.quadcap.sql.index.Btree.rootBlock. |
|
|
Delete the specified key. Return true if the key was deleted. Implements com.quadcap.sql.index.BIndex. Definition at line 162 of file Btree.java. References com.quadcap.sql.index.BCursor.delete(), com.quadcap.sql.index.Btree.getMyCursor(), com.quadcap.sql.index.Btree.lock, com.quadcap.sql.index.BCursor.release(), and com.quadcap.sql.index.BCursor.seek(). Referenced by com.quadcap.sql.DeleteIndexEntry.redo(), and com.quadcap.sql.AddIndexEntry.undo(). |
|
|
Definition at line 175 of file Btree.java. References com.quadcap.sql.index.Bnode.delete(), com.quadcap.sql.index.Btree.deleteObs(), com.quadcap.sql.index.Btree.getRoot(), com.quadcap.sql.index.Btree.lock, and com.quadcap.sql.index.Btree.rootBlock. Referenced by com.quadcap.sql.index.Btree.deleteObs(). |
|
|
Definition at line 332 of file Btree.java. References com.quadcap.sql.index.Btree.display(), com.quadcap.sql.index.Btree.getCursor(), com.quadcap.sql.index.BCursor.getKey(), com.quadcap.sql.index.BCursor.getVal(), com.quadcap.sql.index.BCursor.next(), and com.quadcap.sql.index.BCursor.release(). Referenced by com.quadcap.sql.index.Btree.display(). |
|
|
Destroy this tree and free all of its resources.
Implements com.quadcap.sql.index.BIndex. Definition at line 304 of file Btree.java. References com.quadcap.sql.index.Btree.activeCursors, com.quadcap.sql.index.Bnode.free(), com.quadcap.sql.index.Btree.getRoot(), com.quadcap.sql.index.BtreeCursor.release(), and com.quadcap.sql.index.Btree.rootBlock. Referenced by com.quadcap.sql.UpdateIndex.finish(), and com.quadcap.sql.UnaryExpression.uniqueValue(). |
|
|
||||||||||||||||
|
Get the data bytes for the specified key. If the key is found, return the length of the data portion and place as many bytes as will fit in the data array. If the key isn't found, return -1. Implements com.quadcap.sql.index.BIndex. Definition at line 133 of file Btree.java. References com.quadcap.sql.index.Btree.get(), com.quadcap.sql.index.Btree.getMyCursor(), com.quadcap.sql.index.BCursor.getVal(), com.quadcap.sql.index.Btree.lock, com.quadcap.sql.index.BCursor.release(), and com.quadcap.sql.index.BCursor.seek(). Referenced by com.quadcap.sql.UpdateIndex.addEntry(), com.quadcap.sql.UniqueConstraint.checkInsert(), com.quadcap.sql.UpdateIndex.finish(), com.quadcap.sql.index.Btree.get(), com.quadcap.sql.TempTableMerge.getData(), and com.quadcap.sql.DeleteIndexEntry.prepare(). |
|
|
Return the comparator used to collate keys.
Implements com.quadcap.sql.index.BIndex. Definition at line 259 of file Btree.java. References com.quadcap.sql.index.Btree.compare. |
|
|
Get a cursor.
Implements com.quadcap.sql.index.BIndex. Definition at line 275 of file Btree.java. References com.quadcap.sql.index.Btree.activeCursors, and com.quadcap.sql.index.Btree.lock. |
|
|
|
Return a reference to the underlying
Definition at line 254 of file Btree.java. References com.quadcap.sql.index.Btree.file. Referenced by com.quadcap.sql.index.BtreeCursor.id(). |
|
|
Definition at line 122 of file Btree.java. Referenced by com.quadcap.sql.index.Btree.delete(), and com.quadcap.sql.index.Btree.get(). |
|
|
Definition at line 237 of file Btree.java. References com.quadcap.sql.index.Btree.getNode(). Referenced by com.quadcap.sql.index.Btree.Btree(), com.quadcap.sql.index.Btree.getNode(), com.quadcap.sql.index.Bnode.newLow(), and com.quadcap.sql.index.Bnode.propogateSplit(). |
|
|
|
Definition at line 243 of file Btree.java. References com.quadcap.sql.index.Btree.rootBlock. Referenced by com.quadcap.sql.index.BtreeCursor.id(). |
|
||||||||||||||||||||||||
|
Add a new key. If the index is a UNIQUE index, then the new key/data pair will only be added if the key does not already exist, otherwise, insert will do nothing and return false The existing value must not exist or an IOException will be thrown. Otherwise, the new key/data pair is added regardless. Implements com.quadcap.sql.index.BIndex. Definition at line 191 of file Btree.java. References com.quadcap.sql.index.Btree.getRoot(), com.quadcap.sql.index.Btree.insert(), com.quadcap.sql.index.Btree.lock, com.quadcap.sql.index.Btree.notifyUpdate(), com.quadcap.sql.index.Btree.rootBlock, and com.quadcap.sql.index.Bnode.set(). Referenced by com.quadcap.sql.index.Btree.insert(). |
|
|
|
Definition at line 284 of file Btree.java. References com.quadcap.sql.index.Btree.activeCursors, com.quadcap.sql.index.BCursor.close(), com.quadcap.sql.index.Btree.lock, and com.quadcap.sql.index.Btree.releaseCursor(). Referenced by com.quadcap.sql.index.BtreeCursor.release(), and com.quadcap.sql.index.Btree.releaseCursor(). |
|
||||||||||||||||||||||||
|
Set the key/data pair, replacing any any value it may present in a unique index, inserting a new values, whatever. Return true if the key already existed before this operation. Implements com.quadcap.sql.index.BIndex. Definition at line 221 of file Btree.java. References com.quadcap.sql.index.Btree.getRoot(), com.quadcap.sql.index.Btree.lock, com.quadcap.sql.index.Btree.notifyUpdate(), com.quadcap.sql.index.Btree.rootBlock, and com.quadcap.sql.index.Bnode.set(). |
|
||||||||||||
|
Definition at line 187 of file Btree.java. References com.quadcap.sql.index.Btree.set(). Referenced by com.quadcap.sql.UpdateIndex.addEntry(), com.quadcap.sql.AddIndexEntry.redo(), com.quadcap.sql.index.Btree.set(), com.quadcap.sql.DeleteIndexEntry.undo(), and com.quadcap.sql.AggregateExpression.updateAggregate(). |
|
|
Definition at line 247 of file Btree.java. References com.quadcap.sql.index.Btree.root, com.quadcap.sql.index.Btree.rootBlock, and com.quadcap.sql.index.Btree.setRoot(). Referenced by com.quadcap.sql.index.Btree.setRoot(). |
|
|
Definition at line 118 of file Btree.java. References com.quadcap.sql.index.Btree.getRoot(), and com.quadcap.sql.index.Bnode.size(). |
|
|
Definition at line 328 of file Btree.java. References com.quadcap.sql.index.Btree.rootBlock. |
|
||||||||||||||||||||||||
|
Update the data value for an existing key. This only works for UNIQUE indexes, and only if the specified key already exists.
Implements com.quadcap.sql.index.BIndex. Definition at line 206 of file Btree.java. References com.quadcap.sql.index.Btree.getRoot(), com.quadcap.sql.index.Btree.lock, com.quadcap.sql.index.Btree.notifyUpdate(), com.quadcap.sql.index.Btree.rootBlock, com.quadcap.sql.index.Bnode.set(), and com.quadcap.sql.index.Btree.update(). Referenced by com.quadcap.sql.index.Btree.update(). |
|
|
Definition at line 270 of file Btree.java. Referenced by com.quadcap.sql.index.Btree.free(), com.quadcap.sql.index.Btree.getCursor(), com.quadcap.sql.index.Btree.notifyUpdate(), and com.quadcap.sql.index.Btree.releaseCursor(). |
|
|
|
Definition at line 60 of file Btree.java. Referenced by com.quadcap.sql.index.Bnode.Bnode(), com.quadcap.sql.index.Btree.Btree(), and com.quadcap.sql.index.Btree.getFile(). |
|
|
|
Definition at line 63 of file Btree.java. Referenced by com.quadcap.sql.index.Btree.Btree(), com.quadcap.sql.index.Btree.getRoot(), and com.quadcap.sql.index.Btree.setRoot(). |
|
|
|
Definition at line 65 of file Btree.java. |