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 intCLOSED_STATEstatic intDEFAULT_BIN_CAPACITYstatic intDEFAULT_LOAD_FACTORstatic intDEFAULT_MAXIMUM_BIN_CAPACITYstatic intDEFAULT_MINIMUM_BIN_CAPACITYstatic intOPEN_STATE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear(Transaction tx)clear the indexbooleancontainsKey(Transaction tx, Key key)Valueget(Transaction tx, Key key)intgetActiveBins()intgetBinCapacity()longgetBinPageId()intgetBinsActive()Marshaller<Key>getKeyMarshaller()intgetLoadFactor()PageFilegetPageFile()Marshaller<Value>getValueMarshaller()booleanisTransient()Iterator<Map.Entry<Key,Value>>iterator(Transaction tx)voidload(Transaction tx)load indexesValueput(Transaction tx, Key key, Value value)store the key, itemValueremove(Transaction tx, Key key)remove the index keyvoidsetBinCapacity(int binCapacity)voidsetKeyMarshaller(Marshaller<Key> marshaller)Set the marshaller for key objectsvoidsetLoadFactor(int loadFactor)intsetMaximumBinCapacity()voidsetMaximumBinCapacity(int maximumCapacity)voidsetValueMarshaller(Marshaller<Value> valueMarshaller)Set the marshaller for value objectsintsize(Transaction tx)voidstore(Transaction tx, org.apache.activemq.store.kahadb.disk.index.HashBin<Key,Value> bin)StringtoString()voidunload(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:Indexload indexes- Specified by:
loadin interfaceIndex<Key,Value>- Throws:
IOException
-
unload
public void unload(Transaction tx) throws IOException
Description copied from interface:Indexunload indexes- Specified by:
unloadin interfaceIndex<Key,Value>- Throws:
IOException
-
get
public Value get(Transaction tx, Key key) throws IOException
- Specified by:
getin interfaceIndex<Key,Value>- Returns:
- the entry
- Throws:
IOException
-
containsKey
public boolean containsKey(Transaction tx, Key key) throws IOException
- Specified by:
containsKeyin 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:Indexstore the key, item- Specified by:
putin interfaceIndex<Key,Value>- Throws:
IOException
-
remove
public Value remove(Transaction tx, Key key) throws IOException
Description copied from interface:Indexremove the index key- Specified by:
removein interfaceIndex<Key,Value>- Returns:
- StoreEntry removed
- Throws:
IOException
-
clear
public void clear(Transaction tx) throws IOException
Description copied from interface:Indexclear the index- Specified by:
clearin interfaceIndex<Key,Value>- Throws:
IOException
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx) throws IOException, UnsupportedOperationException
- Specified by:
iteratorin interfaceIndex<Key,Value>- Returns:
- Throws:
IOExceptionUnsupportedOperationException
-
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:
setKeyMarshallerin 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:
setValueMarshallerin 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:
isTransientin 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()
-
-