public final class BTree
extends java.lang.Object
b4 - flags b4 - length b8 - parent b8 - next tuples*Structure of a tuple:
b8 - ptr to the actual data key - the tuple's keyFor a non-leaf node, the key is the last matching entry in the subtree.
| Modifier and Type | Field and Description |
|---|---|
static long |
FAIL |
| Constructor and Description |
|---|
BTree(BlockStore store,
long rootBlockId,
int keySize,
KeyCompare keyCompare)
Creates a new BTree with the given backing.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
create()
Creates and initializes the btree.
|
static BTree |
createStringTest(Path path,
int keySize) |
static BTree |
createTest(Path path,
int keySize) |
java.util.ArrayList<java.lang.String> |
getBlockKeys(long blockIndex)
Testing: returns the keys for a block
|
long |
getBlockNext(long blockIndex)
Testing: returns the keys for a block
|
long |
getIndexRoot()
Returns the index root.
|
void |
insert(byte[] keyBuffer,
int keyOffset,
int keyLength,
long value,
boolean isOverride)
Inserts the new value for the given key.
|
long |
lookup(byte[] keyBuffer,
int keyOffset,
int keyLength) |
void |
remove(byte[] keyBuffer,
int keyOffset,
int keyLength) |
java.lang.String |
toString() |
public static final long FAIL
public BTree(BlockStore store, long rootBlockId, int keySize, KeyCompare keyCompare) throws java.io.IOException
store - the underlying store containing the btree.java.io.IOExceptionpublic long getIndexRoot()
public void create()
throws java.io.IOException
java.io.IOExceptionpublic long lookup(byte[] keyBuffer,
int keyOffset,
int keyLength)
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void insert(byte[] keyBuffer,
int keyOffset,
int keyLength,
long value,
boolean isOverride)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void remove(byte[] keyBuffer,
int keyOffset,
int keyLength)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.util.ArrayList<java.lang.String> getBlockKeys(long blockIndex)
throws java.io.IOException
java.io.IOExceptionpublic long getBlockNext(long blockIndex)
throws java.io.IOException
java.io.IOExceptionpublic static BTree createTest(Path path, int keySize) throws java.io.IOException, java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic static BTree createStringTest(Path path, int keySize) throws java.io.IOException, java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionpublic void close()
public java.lang.String toString()
toString in class java.lang.Object