Quadcap Embeddable Database

com.quadcap.sql.index.Bnode Class Reference

List of all members.

Detailed Description

This class represents a node in the btree.

Things to think about:

Author:
Stan Bailes

Definition at line 80 of file Bnode.java.

Public Member Functions

 Bnode (Btree tree, long blockRef)
 Construct a node from a buffer.

int size () throws IOException
 Return the number of keys in this subtree.

int size (Block b) throws IOException
final byte[] get (byte[] key, int klen) throws IOException
 Implement the get operation.

final boolean set (byte[] key, int klen, byte[] data, int doff, int dlen, boolean insOk, boolean updOk) throws IOException
 Implement the set operation.

final boolean delete (byte[] key) throws IOException
 Implement the delete operation.

final void free () throws IOException
 Free the resources associated with this block.


Static Public Member Functions

final boolean getKeyAndData (Block b, int index, byte[] k, byte[] d, int[] lengths)
 Given a block and a key index, return the key for that index as a new byte array.

final void setBos (Block b, int bos)
 Set the value of the bos field.

final int getCount (Block b)
 Return the value of the bos field.

final void setCount (Block b, int count)
 Set the value of the count field.

final int getFlags (Block b)
 Return the value of the flags field.

final void setFlags (Block b, int flags)
 Set the value of the flags field.

final boolean getFlag (Block b, int mask)
 Return the boolean value of a specified flag.

final void setFlag (Block b, int mask, boolean val)
 Set a specified boolean flag.

final boolean isLeaf (Block b)
 Return the value of the IS_LEAF flag.

final void setLeaf (Block b, boolean v)
 Set the value of the IS_LEAF flag.

final int getGarbage (Block b)
 Return the value of the garbage field.

final void setGarbage (Block b, int g)
 Set the value of the garbage field.

final long getParent (Block b)
 Return the value of the parent field.

final void setParent (Block b, long g)
 Set the value of the parent field.

final String databytes (byte[] b)
 Represent strings as having a length other than 4, while representing integers as only of length 4 bytes.


Static Public Attributes

final int REF_SIZE = 2
 The number of octets in the representation of a reference to a byte offset in the data area of this block.


Package Functions

final byte[] get (Block b, byte[] key, int klen) throws IOException
 A helper function to perform a single-level of the recursive search.

final Block getSearchBlock (Block b, int bs) throws IOException
final void init (Block b, boolean isLeaf) throws IOException
 Initialize an empty BNode.

final void init (boolean f) throws IOException
final void checkMagic () throws IOException
final int bsearch (Block b, byte[] key, int klen) throws IOException
 Perform a binary search of the keys in the specified block, searching for the given key.

final boolean set (Block b, byte[] key, int klen, byte[] data, int doff, int dlen, boolean insOk, boolean updOk) throws IOException
 Recursive implementation of set(key, data).

final boolean delete (Block b, byte[] key) throws IOException
 Recursive implementation of delete(key).

final void checkBlock (Block b) throws IOException
final Block setKey (Block b, int index, byte[] key, int klen, byte[] data, int doff, int dlen, boolean replace) throws IOException
 Insert or replace a key in the specified block, which may or may not be a leaf block.

final void split (Block[] ba) throws IOException
 Split this block, by creaing a new block and moving half of this block's keys into the new block.

final void splitHelp (Block[] ba, long nbno) throws IOException
 Split helper:.

final void propogateSplit (Block[] ba) throws IOException
 After the split operation, propagate information up the tree to the parent block about the newly created block and the new key distribution.

final void gc (Block b) throws IOException
 Reclaim the data space occupied by deleted keys.

final boolean newLow (Block b, byte[] prevLow) throws IOException
 When an operation results in a change in the smallest key in a block, it is necessary to inform the parent block of the change, since the parent block key for this block is required to be the key of the smallest item in this block.

final int checkSpace (Block b, int index, int klen, int dlen, boolean replace)
 Determine if there is room in the block for a new key/data pair.

final int debugcheckSpace (Block b, int index, int klen, int dlen, boolean replace)
final void forgetKeyAtPos (Block b, int index)
 This function is scary.

final boolean deleteKeyAtPos (Block b, int index, boolean skipNewLow) throws IOException
 Delete the specified key.

final boolean setKeyAtPos (Block b, int index, byte[] key, int klen, byte[] data, int doff, int dlen, boolean replace) throws IOException
 Given a block and a key position, insert a new key/data pair immediately at the specified position, returning true if the key/data fit in the block.

final Block getBlock (long blockNum) throws IOException
final Block getBlock () throws IOException
final void display (PrintStream os, boolean recursive) throws IOException
 For debugging purposes, write a human readable version of this Bnode to the specified stream.

final void display (PrintStream os, PrintStream er, boolean recursive) throws IOException
final void display (Block b, PrintStream os, boolean recursive) throws IOException
final void display (Block b, PrintStream os, PrintStream er, boolean recursive) throws IOException

Static Package Functions

final int bsearch (Block b, Comparator c, byte[] key, int klen, int lo, int hi) throws IOException
 Perform a binary search of the keys in the specified block, searching for the given key.

final long blockRef (Block b, int index) throws IOException
 Return the data for a specified key as an integer.

final byte[] dataAtPos (Block b, int index)
 Given a block and a key index, return the data for that index as a new byte array.

final int dataAtPos (Block b, int index, int koff, byte[] data, int off, int len)
final long longDataAtPos (Block b, int index)
 Given a block and a key index, return the data for that index as a long.

final int existingKeyLength (Block b, int index)
 Compute the total length of an existing key data pair, including both key and data length fields.

final byte[] keyAtPos (Block b, int index)
 Given a block and a key index, return the key for that index as a new byte array.

final int getBytes (Block b, int pos, byte[] buf, int[] lenret)
final int keyCompareAtPos (Comparator c, byte[] key, int klen, Block b, int index) throws IOException
 Perform a key comparison with the specified key in the block.

final int getKeyLen (Block b, int keypos, int[] keystart)
 Find the length of the specified key, as well as the byte offset to the start of the key.

final int getKeyLen (Block b, int keypos)
 Find the length of the specified key, as well as the byte offset to the start of the key.

final int getKeyEnd (Block b, int keypos)
 Find the length of the specified key, as well as the byte offset to the start of the key.

final int totalLength (int len)
 Compute the total number of bytes that will be required to store the byte array 'b' plus its length code.

final int insertKeyData (Block b, byte[] key, int klen, byte[] data, int doff, int dlen)
 Insert a key/data pair at the bottom of the data area and return its offset.

final void moveKeys (Block b, int from, int to, int length)
 Helper function to move key indices around when adding or deleting keys.

final int writeLenLen (Block b, int bos, int len)
 Write a length code for the specified length, working backwards in the data area, and returning the new bottom of the data area.

final int capacity (Block b)
 Return the number of available bytes in the buffer, not including space that could be made available by performing a garbage collection.

final int getKeyIndex (Block b, int index)
 Return the byte offset of the specified key/data pair.

final void setKeyIndex (Block b, int index, int val)
 Set the byte offset for the specified key/data pair.

final int index (int pos)
final int getBos (Block b)
 Return the value of the count field.

final String keybytes (byte[] key)
 Since this is used for displaying the key, we attempt to return the string itself, as long as it is composed only of printable characters.

final String keybytes (byte[] key, int off, int len)

Package Attributes

Btree tree
BlockFile file
long blockRef

Static Package Attributes

final boolean paranoid = false
final int fCount = 0
 Number of key/data pairs in this node.

final int fDataBOS = 4
 Bottom of data area -- grows downward.

final int fFlags = 8
 Flags.

final int IS_LEAF = 0x0001
final int BNODE_MAGICF = 0xff00
final int BNODE_MAGICV = 0xbd00
final int fGarbage = 12
 Amount of space that could be reclaimed by repacking the node.

final int fParent = 16
final int fIndices = 24
 Start of key indices.


Private Member Functions

final void free (long blockNum) throws IOException
 Free the resources associated with the specified block.


Constructor & Destructor Documentation

com.quadcap.sql.index.Bnode.Bnode Btree  tree,
long  blockRef
 

Construct a node from a buffer.

Parameters:
tree the Btree containing this node
blockRef the block number in file of this node.

Definition at line 130 of file Bnode.java.

References com.quadcap.sql.index.Btree.file.


Member Function Documentation

final long com.quadcap.sql.index.Bnode.blockRef Block  b,
int  index
throws IOException [static, package]
 

Return the data for a specified key as an integer.

Definition at line 428 of file Bnode.java.

References com.quadcap.sql.index.Bnode.blockRef, com.quadcap.sql.index.Bnode.index(), and com.quadcap.sql.index.Bnode.longDataAtPos().

final int com.quadcap.sql.index.Bnode.bsearch Block  b,
byte[]  key,
int  klen
throws IOException [package]
 

Perform a binary search of the keys in the specified block, searching for the given key.

If the key is found in the block, return the index of the matching key. If the key isn't found, return < 0, and for the key index which is the smallest existing key greater than the given key, return 0 - (index+1).

Parameters:
b the block to be searched.
key the search key
Returns:
if found, the index of the matching key/data pair. If not found, return the index where the data would be found as an expression of the form:<p> 0 - (index + 1)

Definition at line 421 of file Bnode.java.

References com.quadcap.sql.index.Btree.compare, com.quadcap.sql.index.Bnode.getCount(), and com.quadcap.sql.index.Bnode.tree.

final int com.quadcap.sql.index.Bnode.bsearch Block  b,
Comparator  c,
byte[]  key,
int  klen,
int  lo,
int  hi
throws IOException [static, package]
 

Perform a binary search of the keys in the specified block, searching for the given key.

If the key is found in the block, return the index of the matching key. If the key isn't found, return < 0, and for the key index which is the smallest existing key greater than the given key, return 0 - (index+1).

Parameters:
b the block to be searched.
key the search key
lo index of smallest element in search region
hi index of largest element in search region
Returns:
if found, the index of the matching key/data pair. If not found, return the index where the data would be found as an expression of the form:<p> 0 - (index + 1)

Definition at line 393 of file Bnode.java.

References com.quadcap.sql.index.Bnode.bsearch(), and com.quadcap.sql.index.Bnode.keyCompareAtPos().

Referenced by com.quadcap.sql.index.Bnode.bsearch(), and com.quadcap.sql.index.Bnode.get().

final int com.quadcap.sql.index.Bnode.capacity Block  b  )  [static, package]
 

Return the number of available bytes in the buffer, not including space that could be made available by performing a garbage collection.

Definition at line 1393 of file Bnode.java.

References com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.fIndices, com.quadcap.sql.index.Bnode.getBos(), com.quadcap.sql.index.Bnode.getCount(), and com.quadcap.sql.index.Bnode.REF_SIZE.

Referenced by com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.checkSpace(), com.quadcap.sql.index.Bnode.debugcheckSpace(), com.quadcap.sql.index.Bnode.gc(), and com.quadcap.sql.index.Bnode.splitHelp().

final void com.quadcap.sql.index.Bnode.checkBlock Block  b  )  throws IOException [package]
 

Definition at line 536 of file Bnode.java.

References com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Comparator.compare, com.quadcap.sql.index.Btree.compare, com.quadcap.sql.index.Bnode.display(), com.quadcap.sql.index.Bnode.existingKeyLength(), com.quadcap.sql.index.Bnode.file, com.quadcap.sql.index.Bnode.getBos(), com.quadcap.sql.index.Bnode.getCount(), com.quadcap.sql.index.Bnode.getGarbage(), com.quadcap.sql.index.Bnode.keyAtPos(), and com.quadcap.sql.index.Bnode.tree.

Referenced by com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.delete(), com.quadcap.sql.index.Bnode.get(), and com.quadcap.sql.index.Bnode.set().

final void com.quadcap.sql.index.Bnode.checkMagic  )  throws IOException [package]
 

Definition at line 327 of file Bnode.java.

References com.quadcap.sql.index.Bnode.BNODE_MAGICF, com.quadcap.sql.index.Bnode.BNODE_MAGICV, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.getBlock(), com.quadcap.sql.index.Bnode.getFlags(), and com.quadcap.sql.file.Block.getPageNum().

Referenced by com.quadcap.sql.index.Btree.Btree().

final int com.quadcap.sql.index.Bnode.checkSpace Block  b,
int  index,
int  klen,
int  dlen,
boolean  replace
[package]
 

Determine if there is room in the block for a new key/data pair.

Parameters:
b the block to operate on
index the index of the key that is being replaced, if replace is true.
klen the search key length
dlen the length of the data associated with the key
replace true if an existing key/data pair is to be replaced by the new key, false otherwise.
Returns:
negative number if there is no room for the new data.
zero if there is room for the new data.

positive number if there would be room after a garbage collection. Included in this calculation is the deletion of the key being replaced, if replace is true.

Definition at line 1248 of file Bnode.java.

References com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.checkSpace(), com.quadcap.sql.index.Bnode.getGarbage(), and com.quadcap.sql.index.Bnode.REF_SIZE.

Referenced by com.quadcap.sql.index.Bnode.checkSpace().

final int com.quadcap.sql.index.Bnode.dataAtPos Block  b,
int  index,
int  koff,
byte[]  data,
int  off,
int  len
[static, package]
 

Definition at line 595 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getKeyIndex(), com.quadcap.sql.index.Bnode.getKeyLen(), and com.quadcap.sql.file.Block.read().

final byte [] com.quadcap.sql.index.Bnode.dataAtPos Block  b,
int  index
[static, package]
 

Given a block and a key index, return the data for that index as a new byte array.

Parameters:
b the block on which to operate.
index the index of the item for which the data is to be retrieved
Returns:
the data for the key at the specified position in the node.

Definition at line 580 of file Bnode.java.

References com.quadcap.sql.index.Bnode.dataAtPos(), com.quadcap.sql.index.Bnode.getKeyIndex(), com.quadcap.sql.index.Bnode.getKeyLen(), and com.quadcap.sql.file.Block.read().

Referenced by com.quadcap.sql.index.Bnode.dataAtPos(), and com.quadcap.sql.index.Bnode.get().

final String com.quadcap.sql.index.Bnode.databytes byte[]  b  )  [static]
 

Represent strings as having a length other than 4, while representing integers as only of length 4 bytes.

Parameters:
b the string of bytes to convert
Returns:
A string containing either a 4-byte integer conversion or a string 'keybytes' filter.

Definition at line 1568 of file Bnode.java.

References com.quadcap.sql.index.Bnode.databytes().

Referenced by com.quadcap.sql.index.Bnode.databytes().

final int com.quadcap.sql.index.Bnode.debugcheckSpace Block  b,
int  index,
int  klen,
int  dlen,
boolean  replace
[package]
 

Definition at line 1262 of file Bnode.java.

References com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.debugcheckSpace(), com.quadcap.sql.index.Bnode.getGarbage(), and com.quadcap.sql.index.Bnode.REF_SIZE.

Referenced by com.quadcap.sql.index.Bnode.debugcheckSpace(), and com.quadcap.sql.index.Bnode.set().

final boolean com.quadcap.sql.index.Bnode.delete Block  b,
byte[]  key
throws IOException [package]
 

Recursive implementation of delete(key).

Parameters:
b the block to be searched
key the search key
Returns:
true if the key already existed before the delete, false otherwise.

Definition at line 504 of file Bnode.java.

References com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.deleteKeyAtPos(), com.quadcap.sql.index.Bnode.getBlock(), com.quadcap.sql.index.Bnode.index(), com.quadcap.sql.index.Bnode.isLeaf(), and com.quadcap.sql.index.Bnode.paranoid.

final boolean com.quadcap.sql.index.Bnode.delete byte[]  key  )  throws IOException
 

Implement the delete operation.

Parameters:
key the key

Definition at line 236 of file Bnode.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), and com.quadcap.sql.index.Bnode.getBlock().

Referenced by com.quadcap.sql.index.Btree.deleteObs().

final boolean com.quadcap.sql.index.Bnode.deleteKeyAtPos Block  b,
int  index,
boolean  skipNewLow
throws IOException [package]
 

Delete the specified key.

Returns:
true if the block is now empty, has been freed, and we should avoid touching it...

Definition at line 1299 of file Bnode.java.

References com.quadcap.sql.index.Bnode.deleteKeyAtPos(), com.quadcap.sql.index.Bnode.getCount(), com.quadcap.sql.index.Bnode.getParent(), com.quadcap.sql.index.Bnode.index(), com.quadcap.sql.index.Bnode.setCount(), and com.quadcap.sql.index.Bnode.setLeaf().

Referenced by com.quadcap.sql.index.BtreeCursor.delete(), com.quadcap.sql.index.Bnode.delete(), com.quadcap.sql.index.Bnode.deleteKeyAtPos(), com.quadcap.sql.index.Bnode.newLow(), and com.quadcap.sql.index.Bnode.setKey().

final void com.quadcap.sql.index.Bnode.display Block  b,
PrintStream  os,
PrintStream  er,
boolean  recursive
throws IOException [package]
 

Definition at line 1576 of file Bnode.java.

References com.quadcap.sql.index.Comparator.compare, com.quadcap.sql.index.Btree.compare, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.getBlock(), com.quadcap.sql.file.Block.getPageNum(), com.quadcap.sql.index.Comparator.toString(), and com.quadcap.sql.index.Bnode.tree.

final void com.quadcap.sql.index.Bnode.display Block  b,
PrintStream  os,
boolean  recursive
throws IOException [package]
 

Definition at line 1526 of file Bnode.java.

final void com.quadcap.sql.index.Bnode.display PrintStream  os,
PrintStream  er,
boolean  recursive
throws IOException [package]
 

Definition at line 1515 of file Bnode.java.

References com.quadcap.sql.file.Cacheable.decrRefCount(), and com.quadcap.sql.index.Bnode.getBlock().

final void com.quadcap.sql.index.Bnode.display PrintStream  os,
boolean  recursive
throws IOException [package]
 

For debugging purposes, write a human readable version of this Bnode to the specified stream.

Definition at line 1511 of file Bnode.java.

References com.quadcap.sql.index.Bnode.display().

Referenced by com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.display(), com.quadcap.sql.index.Bnode.free(), com.quadcap.sql.index.Bnode.newLow(), com.quadcap.sql.index.Bnode.set(), com.quadcap.sql.index.Bnode.setKey(), com.quadcap.sql.index.Bnode.setKeyAtPos(), and com.quadcap.sql.index.Bnode.splitHelp().

final int com.quadcap.sql.index.Bnode.existingKeyLength Block  b,
int  index
[static, package]
 

Compute the total length of an existing key data pair, including both key and data length fields.

Parameters:
b the block on which to operate.
index the index of the item for which the data is to be retrieved
Returns:
the total number of data area bytes consumed by this item.

Definition at line 634 of file Bnode.java.

References com.quadcap.sql.index.Bnode.existingKeyLength(), com.quadcap.sql.index.Bnode.getKeyIndex(), and com.quadcap.sql.index.Bnode.getKeyLen().

Referenced by com.quadcap.sql.index.Bnode.checkBlock(), and com.quadcap.sql.index.Bnode.existingKeyLength().

final void com.quadcap.sql.index.Bnode.forgetKeyAtPos Block  b,
int  index
[package]
 

This function is scary.

It accounts for the fact that we're about to delete a key, by including the size of the key/data in the node's garbage field, but it doesn't actually delete the key. Be careful.

Definition at line 1289 of file Bnode.java.

References com.quadcap.sql.index.Bnode.forgetKeyAtPos(), com.quadcap.sql.index.Bnode.getGarbage(), and com.quadcap.sql.index.Bnode.setGarbage().

Referenced by com.quadcap.sql.index.Bnode.forgetKeyAtPos(), and com.quadcap.sql.index.Bnode.splitHelp().

final void com.quadcap.sql.index.Bnode.free long  blockNum  )  throws IOException [private]
 

Free the resources associated with the specified block.

If the block is a non-leaf node, free the entire subtree.

Definition at line 351 of file Bnode.java.

References com.quadcap.sql.index.Bnode.blockRef, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.display(), com.quadcap.sql.index.Bnode.file, com.quadcap.sql.index.Bnode.free(), com.quadcap.sql.index.Bnode.getBlock(), com.quadcap.sql.index.Bnode.getCount(), com.quadcap.sql.file.Block.getPageNum(), and com.quadcap.sql.index.Bnode.isLeaf().

final void com.quadcap.sql.index.Bnode.free  )  throws IOException
 

Free the resources associated with this block.

If the block is a non-leaf node, free the entire subtree.

Definition at line 343 of file Bnode.java.

References com.quadcap.sql.index.Bnode.blockRef.

Referenced by com.quadcap.sql.index.Btree.free(), and com.quadcap.sql.index.Bnode.free().

final void com.quadcap.sql.index.Bnode.gc Block  b  )  throws IOException [package]
 

Reclaim the data space occupied by deleted keys.

Definition at line 1120 of file Bnode.java.

References com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.file, com.quadcap.sql.index.Bnode.gc(), com.quadcap.sql.index.Bnode.getCount(), com.quadcap.sql.index.Bnode.getGarbage(), com.quadcap.sql.index.Bnode.paranoid, com.quadcap.sql.index.Bnode.setBos(), com.quadcap.sql.index.Bnode.setGarbage(), and com.quadcap.sql.index.Bnode.setKeyIndex().

Referenced by com.quadcap.sql.index.Bnode.gc(), and com.quadcap.sql.index.Bnode.splitHelp().

final byte [] com.quadcap.sql.index.Bnode.get Block  b,
byte[]  key,
int  klen
throws IOException [package]
 

A helper function to perform a single-level of the recursive search.

Parameters:
b the block to be searched.
key the search key
Returns:
if found, the data, else null

Definition at line 251 of file Bnode.java.

References com.quadcap.sql.index.Bnode.bsearch(), com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.dataAtPos(), com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.getSearchBlock(), com.quadcap.sql.index.Bnode.isLeaf(), and com.quadcap.sql.index.Bnode.paranoid.

final byte [] com.quadcap.sql.index.Bnode.get byte[]  key,
int  klen
throws IOException
 

Implement the get operation.

Parameters:
key the search key
Returns:
if the get succeeds, the data is returned as a byte array; if the get fails, null is returned.

Definition at line 179 of file Bnode.java.

References com.quadcap.sql.index.Bnode.blockRef, com.quadcap.sql.file.Cacheable.decrRefCount(), com.quadcap.sql.index.Bnode.get(), and com.quadcap.sql.index.Bnode.getBlock().

Referenced by com.quadcap.sql.index.Bnode.get().

final Block com.quadcap.sql.index.Bnode.getBlock  )  throws IOException [package]
 

Definition at line 1402 of file Bnode.java.

Referenced by com.quadcap.sql.index.Bnode.checkMagic(), com.quadcap.sql.index.Bnode.delete(), com.quadcap.sql.index.Bnode.display(), com.quadcap.sql.index.Bnode.free(), com.quadcap.sql.index.Bnode.get(), com.quadcap.sql.index.Bnode.getSearchBlock(), com.quadcap.sql.index.Bnode.init(), com.quadcap.sql.index.Bnode.propogateSplit(), com.quadcap.sql.index.Bnode.set(), and com.quadcap.sql.index.Bnode.size().

final Block com.quadcap.sql.index.Bnode.getBlock long  blockNum  )  throws IOException [package]
 

Definition at line 1397 of file Bnode.java.

References com.quadcap.sql.index.Bnode.file.

Referenced by com.quadcap.sql.index.BtreeCursor.afterLast(), com.quadcap.sql.index.BtreeCursor.beforeFirst(), com.quadcap.sql.index.BtreeCursor.getNextBlock(), com.quadcap.sql.index.BtreeCursor.getPrevBlock(), com.quadcap.sql.index.Bnode.newLow(), com.quadcap.sql.index.BtreeCursor.position(), com.quadcap.sql.index.Bnode.propogateSplit(), com.quadcap.sql.index.BtreeCursor.seek(), com.quadcap.sql.index.BtreeCursor.seek1(), com.quadcap.sql.index.BtreeCursor.size(), com.quadcap.sql.index.Bnode.split(), com.quadcap.sql.index.Bnode.splitHelp(), and com.quadcap.sql.index.BtreeCursor.subtreeSize().

final int com.quadcap.sql.index.Bnode.getBos Block  b  )  [static, package]
 

Return the value of the count field.

Definition at line 1432 of file Bnode.java.

References com.quadcap.sql.index.Bnode.fDataBOS, com.quadcap.sql.index.Bnode.getBos(), and com.quadcap.sql.file.Block.readInt().

Referenced by com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.getBos(), and com.quadcap.sql.index.Bnode.insertKeyData().

final int com.quadcap.sql.index.Bnode.getBytes Block  b,
int  pos,
byte[]  buf,
int[]  lenret
[static, package]
 

Definition at line 666 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getBytes(), com.quadcap.sql.file.Block.read(), and com.quadcap.sql.file.Block.readByte().

Referenced by com.quadcap.sql.index.Bnode.getBytes().

final int com.quadcap.sql.index.Bnode.getCount Block  b  )  [static]
 

Return the value of the bos field.

Definition at line 1442 of file Bnode.java.

References com.quadcap.sql.index.Bnode.fCount, com.quadcap.sql.index.Bnode.getCount(), and com.quadcap.sql.file.Block.readInt().

Referenced by com.quadcap.sql.index.Bnode.bsearch(), com.quadcap.sql.index.Bnode.capacity(), com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.deleteKeyAtPos(), com.quadcap.sql.index.Bnode.free(), com.quadcap.sql.index.Bnode.gc(), com.quadcap.sql.index.Bnode.getCount(), com.quadcap.sql.index.Bnode.newLow(), com.quadcap.sql.index.Bnode.propogateSplit(), com.quadcap.sql.index.Bnode.setKey(), com.quadcap.sql.index.Bnode.setKeyAtPos(), com.quadcap.sql.index.Bnode.size(), and com.quadcap.sql.index.Bnode.splitHelp().

final boolean com.quadcap.sql.index.Bnode.getFlag Block  b,
int  mask
[static]
 

Return the boolean value of a specified flag.

Definition at line 1462 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getFlag().

Referenced by com.quadcap.sql.index.Bnode.getFlag().

final int com.quadcap.sql.index.Bnode.getFlags Block  b  )  [static]
 

Return the value of the flags field.

Definition at line 1452 of file Bnode.java.

References com.quadcap.sql.index.Bnode.fFlags, com.quadcap.sql.index.Bnode.getFlags(), and com.quadcap.sql.file.Block.readInt().

Referenced by com.quadcap.sql.index.Bnode.checkMagic(), and com.quadcap.sql.index.Bnode.getFlags().

final int com.quadcap.sql.index.Bnode.getGarbage Block  b  )  [static]
 

Return the value of the garbage field.

Definition at line 1485 of file Bnode.java.

References com.quadcap.sql.index.Bnode.fGarbage, com.quadcap.sql.index.Bnode.getGarbage(), and com.quadcap.sql.file.Block.readInt().

Referenced by com.quadcap.sql.index.Bnode.checkBlock(), com.quadcap.sql.index.Bnode.checkSpace(), com.quadcap.sql.index.Bnode.debugcheckSpace(), com.quadcap.sql.index.Bnode.forgetKeyAtPos(), com.quadcap.sql.index.Bnode.gc(), com.quadcap.sql.index.Bnode.getGarbage(), and com.quadcap.sql.index.Bnode.splitHelp().

final boolean com.quadcap.sql.index.Bnode.getKeyAndData Block  b,
int  index,
byte[]  k,
byte[]  d,
int[]  lengths
[static]
 

Given a block and a key index, return the key for that index as a new byte array.

Parameters:
b the block on which to operate.
index the index of the item for which the key is to be retrieved
buf the buffer into which the key bytes should be places
off the offset into the buffer
len the maximum number of bytes to write to the buffer
Returns:
the number of bytes returned, if sucessful. If the buffer isn't big enough, we return a negative number '0 - k', where 'k' is the actual key length.

Definition at line 695 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getKeyAndData(), and com.quadcap.sql.index.Bnode.getKeyIndex().

Referenced by com.quadcap.sql.index.Bnode.getKeyAndData().

final int com.quadcap.sql.index.Bnode.getKeyEnd Block  b,
int  keypos
[static, package]
 

Find the length of the specified key, as well as the byte offset to the start of the key.

Parameters:
b the B-node
keypos the buffer offset where the key/data pair starts.
Returns:
two 16-bit integers {start, len} encoded in a 32 bit int.

Definition at line 779 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getKeyEnd(), and com.quadcap.sql.file.Block.readByte().

Referenced by com.quadcap.sql.index.Bnode.getKeyEnd(), and com.quadcap.sql.index.Bnode.longDataAtPos().

final int com.quadcap.sql.index.Bnode.getKeyIndex Block  b,
int  index
[static, package]
 

Return the byte offset of the specified key/data pair.

Parameters:
b the Bnode containing the key
index the index of the specified key/data pair.

Definition at line 1412 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getKeyIndex(), and com.quadcap.sql.file.Block.readShort().

Referenced by com.quadcap.sql.index.Bnode.dataAtPos(), com.quadcap.sql.index.Bnode.existingKeyLength(), com.quadcap.sql.index.Bnode.getKeyAndData(), com.quadcap.sql.index.Bnode.getKeyIndex(), com.quadcap.sql.index.Bnode.keyAtPos(), com.quadcap.sql.index.Bnode.keyCompareAtPos(), and com.quadcap.sql.index.Bnode.longDataAtPos().

final int com.quadcap.sql.index.Bnode.getKeyLen Block  b,
int  keypos
[static, package]
 

Find the length of the specified key, as well as the byte offset to the start of the key.

Parameters:
b the B-node
keypos the buffer offset where the key/data pair starts.
Returns:
the key length

Definition at line 759 of file Bnode.java.

References com.quadcap.sql.file.Block.readByte().

final int com.quadcap.sql.index.Bnode.getKeyLen Block  b,
int  keypos,
int[]  keystart
[static, package]
 

Find the length of the specified key, as well as the byte offset to the start of the key.

Parameters:
b the B-node
keypos the buffer offset where the key/data pair starts.
keystart an out parameter, used to return the buffer offset where the actual key begins.

Definition at line 738 of file Bnode.java.

References com.quadcap.sql.index.Bnode.getKeyLen(), and com.quadcap.sql.file.Block.readByte().

Referenced by com.quadcap.sql.index.Bnode.dataAtPos(), <