Class HashIndex<Key,Value>
- java.lang.Object
-
- org.apache.activemq.store.kahadb.disk.index.HashIndex<Key,Value>
-
-
Field Summary
Fields Modifier and Type Field Description 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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear(Transaction tx)
clear the indexboolean
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 indexesValue
put(Transaction tx, Key key, Value value)
store the key, itemValue
remove(Transaction tx, Key key)
remove the index keyvoid
setBinCapacity(int binCapacity)
void
setKeyMarshaller(Marshaller<Key> marshaller)
Set the marshaller for key objectsvoid
setLoadFactor(int loadFactor)
int
setMaximumBinCapacity()
void
setMaximumBinCapacity(int maximumCapacity)
void
setValueMarshaller(Marshaller<Value> valueMarshaller)
Set the marshaller for value objectsint
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
-
-
-
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:
pageFile
-pageId
-- Throws:
IOException
-
-
Method Detail
-
load
public void load(Transaction tx) throws IOException
Description copied from interface:Index
load indexes- Specified by:
load
in interfaceIndex<Key,Value>
- Throws:
IOException
-
unload
public void unload(Transaction tx) throws IOException
Description copied from interface:Index
unload indexes- Specified by:
unload
in interfaceIndex<Key,Value>
- Throws:
IOException
-
get
public Value get(Transaction tx, Key key) throws IOException
- Specified by:
get
in interfaceIndex<Key,Value>
- Returns:
- the entry
- Throws:
IOException
-
containsKey
public boolean containsKey(Transaction tx, Key key) throws IOException
- Specified by:
containsKey
in interfaceIndex<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 interfaceIndex<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 interfaceIndex<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 interfaceIndex<Key,Value>
- Throws:
IOException
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx) throws IOException, UnsupportedOperationException
- Specified by:
iterator
in interfaceIndex<Key,Value>
- Returns:
- Throws:
IOException
UnsupportedOperationException
-
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 interfaceIndex<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 interfaceIndex<Key,Value>
- Parameters:
valueMarshaller
-
-
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 interfaceIndex<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()
-
-