Home » activemq-parent-5.3.1-source-release » org.apache.kahadb.index » [javadoc | source]
org.apache.kahadb.index
public class: BTreeIndex [javadoc | source]
java.lang.Object
   org.apache.kahadb.index.BTreeIndex

All Implemented Interfaces:
    Index

BTreeIndex represents a Variable Magnitude B+Tree in a Page File. A BTree is a bit flexible in that it can be used for set or map-based indexing. Leaf nodes are linked together for faster iteration of the values.
The Variable Magnitude attribute means that the BTree attempts to store as many values and pointers on one page as is possible.
The implementation can optionally a be Simple-Prefix B+Tree.
For those who don't know how a Simple-Prefix B+Tree works, the primary distinction is that instead of promoting actual keys to branch pages, when leaves are split, a shortest-possible separator is generated at the pivot. That separator is what is promoted to the parent branch (and continuing up the list). As a result, actual keys and pointers can only be found at the leaf level. This also affords the index the ability to ignore costly merging and redistribution of pages when deletions occur. Deletions only affect leaf pages in this implementation, and so it is entirely possible for a leaf page to be completely empty after all of its keys have been removed.
Nested Class Summary:
public static interface  BTreeIndex.Prefixer  Interface used to determine the simple prefix of two keys. 
public static class  BTreeIndex.StringPrefixer  StringPrefixer is a Prefixer implementation that works on strings. 
Constructor:
 public BTreeIndex() 
 public BTreeIndex(long rootPageId) 
 public BTreeIndex(Page page) 
 public BTreeIndex(PageFile pageFile,
    long rootPageId) 
 public BTreeIndex(PageFile pageFile,
    Page page) 
Method from org.apache.kahadb.index.BTreeIndex Summary:
clear,   containsKey,   createNode,   createNode,   get,   getFirst,   getKeyMarshaller,   getLast,   getMaxLeafDepth,   getMinLeafDepth,   getPageFile,   getPageId,   getPrefixer,   getValueMarshaller,   isEmpty,   isTransient,   iterator,   iterator,   load,   loadNode,   printStructure,   printStructure,   put,   remove,   setKeyMarshaller,   setPageFile,   setPageId,   setPrefixer,   setValueMarshaller,   storeNode,   unload,   visit
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.kahadb.index.BTreeIndex Detail:
 public synchronized  void clear(Transaction tx) throws IOException 
 public synchronized boolean containsKey(Transaction tx,
    Key key) throws IOException 
 BTreeNode<Key, Value> createNode(Transaction tx,
    BTreeNode<Key, Value> parent) throws IOException 
 BTreeNode<Key, Value> createNode(Page<Key, Value> p,
    BTreeNode<Key, Value> parent) throws IOException 
 public synchronized Value get(Transaction tx,
    Key key) throws IOException 
 public synchronized Entry<Key, Value> getFirst(Transaction tx) throws IOException 
 public Marshaller<Key> getKeyMarshaller() 
 public synchronized Entry<Key, Value> getLast(Transaction tx) throws IOException 
 public synchronized int getMaxLeafDepth(Transaction tx) throws IOException 
 public synchronized int getMinLeafDepth(Transaction tx) throws IOException 
 public PageFile getPageFile() 
 public long getPageId() 
 public Prefixer<Key> getPrefixer() 
 public Marshaller<Value> getValueMarshaller() 
 public synchronized boolean isEmpty(Transaction tx) throws IOException 
 public boolean isTransient() 
 public synchronized Iterator<Key, Value> iterator(Transaction tx) throws IOException 
 public synchronized Iterator<Key, Value> iterator(Transaction tx,
    Key initialKey) throws IOException 
 public synchronized  void load(Transaction tx) throws IOException 
 BTreeNode<Key, Value> loadNode(Transaction tx,
    long pageId,
    BTreeNode<Key, Value> parent) throws IOException 
 public synchronized  void printStructure(Transaction tx,
    PrintWriter out) throws IOException 
 public synchronized  void printStructure(Transaction tx,
    OutputStream out) throws IOException 
 public synchronized Value put(Transaction tx,
    Key key,
    Value value) throws IOException 
 public synchronized Value remove(Transaction tx,
    Key key) throws IOException 
 public  void setKeyMarshaller(Marshaller<Key> keyMarshaller) 
 public  void setPageFile(PageFile pageFile) 
 public  void setPageId(long pageId) 
 public  void setPrefixer(Prefixer<Key> prefixer) 
 public  void setValueMarshaller(Marshaller<Value> valueMarshaller) 
  void storeNode(Transaction tx,
    BTreeNode<Key, Value> node,
    boolean overflow) throws IOException 
 public synchronized  void unload(Transaction tx) 
 public synchronized  void visit(Transaction tx,
    BTreeVisitor<Key, Value> visitor) throws IOException