org.apache.activemq.store.kahadb.disk.index
Class HashIndex<Key,Value>

java.lang.Object
  extended by org.apache.activemq.store.kahadb.disk.index.HashIndex<Key,Value>
All Implemented Interfaces:
Index<Key,Value>

public class HashIndex<Key,Value>
extends Object
implements Index<Key,Value>

BTree implementation


Field Summary
static int CLOSED_STATE
           
static int DEFAULT_BIN_CAPACITY
           
static int DEFAULT_LOAD_FACTOR
           
static int DEFAULT_MAXIMUM_BIN_CAPACITY
           
static int DEFAULT_MINIMUM_BIN_CAPACITY
           
static int OPEN_STATE
           
 
Constructor Summary
HashIndex(PageFile pageFile, long pageId)
          Constructor
 
Method Summary
 void clear(Transaction tx)
          clear the index
 boolean containsKey(Transaction tx, Key key)
           
 Value get(Transaction tx, Key key)
           
 int getActiveBins()
           
 int getBinCapacity()
           
 long getBinPageId()
           
 int getBinsActive()
           
 Marshaller<Key> getKeyMarshaller()
           
 int getLoadFactor()
           
 PageFile getPageFile()
           
 Marshaller<Value> getValueMarshaller()
           
 boolean isTransient()
           
 Iterator<Map.Entry<Key,Value>> iterator(Transaction tx)
           
 void load(Transaction tx)
          load indexes
 Value put(Transaction tx, Key key, Value value)
          store the key, item
 Value remove(Transaction tx, Key key)
          remove the index key
 void setBinCapacity(int binCapacity)
           
 void setKeyMarshaller(Marshaller<Key> marshaller)
          Set the marshaller for key objects
 void setLoadFactor(int loadFactor)
           
 int setMaximumBinCapacity()
           
 void setMaximumBinCapacity(int maximumCapacity)
           
 void setValueMarshaller(Marshaller<Value> valueMarshaller)
          Set the marshaller for value objects
 int size(Transaction tx)
           
 void store(Transaction tx, org.apache.activemq.store.kahadb.disk.index.HashBin<Key,Value> bin)
           
 String toString()
           
 void unload(Transaction tx)
          unload indexes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLOSED_STATE

public static final int CLOSED_STATE
See Also:
Constant Field Values

OPEN_STATE

public static final int OPEN_STATE
See Also:
Constant Field Values

DEFAULT_BIN_CAPACITY

public static final int DEFAULT_BIN_CAPACITY

DEFAULT_MAXIMUM_BIN_CAPACITY

public static final int DEFAULT_MAXIMUM_BIN_CAPACITY

DEFAULT_MINIMUM_BIN_CAPACITY

public static final int DEFAULT_MINIMUM_BIN_CAPACITY

DEFAULT_LOAD_FACTOR

public static final int DEFAULT_LOAD_FACTOR
Constructor Detail

HashIndex

public HashIndex(PageFile pageFile,
                 long pageId)
          throws IOException
Constructor

Parameters:
directory -
name -
indexManager -
numberOfBins -
Throws:
IOException
Method Detail

load

public void load(Transaction tx)
          throws IOException
Description copied from interface: Index
load indexes

Specified by:
load in interface Index<Key,Value>
Throws:
IOException

unload

public void unload(Transaction tx)
            throws IOException
Description copied from interface: Index
unload indexes

Specified by:
unload in interface Index<Key,Value>
Throws:
IOException

get

public Value get(Transaction tx,
                 Key key)
          throws IOException
Specified by:
get in interface Index<Key,Value>
Returns:
the entry
Throws:
IOException

containsKey

public boolean containsKey(Transaction tx,
                           Key key)
                    throws IOException
Specified by:
containsKey in interface Index<Key,Value>
Returns:
true if it contains the key
Throws:
IOException

put

public Value put(Transaction tx,
                 Key key,
                 Value value)
          throws IOException
Description copied from interface: Index
store the key, item

Specified by:
put in interface Index<Key,Value>
Throws:
IOException

remove

public Value remove(Transaction tx,
                    Key key)
             throws IOException
Description copied from interface: Index
remove the index key

Specified by:
remove in interface Index<Key,Value>
Returns:
StoreEntry removed
Throws:
IOException

clear

public void clear(Transaction tx)
           throws IOException
Description copied from interface: Index
clear the index

Specified by:
clear in interface Index<Key,Value>
Throws:
IOException

iterator

public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx)
                                        throws IOException,
                                               UnsupportedOperationException
Specified by:
iterator in interface Index<Key,Value>
Returns:
Throws:
IOException
UnsupportedOperationException

toString

public String toString()
Overrides:
toString in class Object

store

public void store(Transaction tx,
                  org.apache.activemq.store.kahadb.disk.index.HashBin<Key,Value> bin)
           throws IOException
Throws:
IOException

getKeyMarshaller

public Marshaller<Key> getKeyMarshaller()

setKeyMarshaller

public void setKeyMarshaller(Marshaller<Key> marshaller)
Set the marshaller for key objects

Specified by:
setKeyMarshaller in interface Index<Key,Value>
Parameters:
marshaller -

getValueMarshaller

public Marshaller<Value> getValueMarshaller()

setValueMarshaller

public void setValueMarshaller(Marshaller<Value> valueMarshaller)
Set the marshaller for value objects

Specified by:
setValueMarshaller in interface Index<Key,Value>
Parameters:
marshaller -

getBinCapacity

public int getBinCapacity()
Returns:
number of bins in the index

setBinCapacity

public void setBinCapacity(int binCapacity)
Parameters:
binCapacity -

isTransient

public boolean isTransient()
Specified by:
isTransient in interface Index<Key,Value>
Returns:
true if the index is transient

getLoadFactor

public int getLoadFactor()
Returns:
the loadFactor

setLoadFactor

public void setLoadFactor(int loadFactor)
Parameters:
loadFactor - the loadFactor to set

setMaximumBinCapacity

public int setMaximumBinCapacity()
Returns:
the maximumCapacity

setMaximumBinCapacity

public void setMaximumBinCapacity(int maximumCapacity)
Parameters:
maximumCapacity - the maximumCapacity to set

size

public int size(Transaction tx)

getActiveBins

public int getActiveBins()

getBinPageId

public long getBinPageId()

getPageFile

public PageFile getPageFile()

getBinsActive

public int getBinsActive()


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.