Class ListIndex<Key,Value>
java.lang.Object
org.apache.activemq.store.kahadb.disk.index.ListIndex<Key,Value>
- All Implemented Interfaces:
Index<Key,Value>
- Direct Known Subclasses:
PListImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected AtomicBooleanstatic final longprotected PageFileprotected long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Transaction tx, Key key, Value value) addFirst(Transaction tx, Key key, Value value) voidclear(Transaction tx) clear the indexbooleancontainsKey(Transaction tx, Key key) get(Transaction tx, Key key) getFirst(Transaction tx) getHead(Transaction tx) longgetLast(Transaction tx) getTail(Transaction tx) longbooleanisEmpty(Transaction tx) booleaniterator(Transaction tx) iterator(Transaction tx, long initialPosition) voidload(Transaction tx) load indexesprotected voidonLoad(ListNode<Key, Value> node, Transaction tx) voidput(Transaction tx, Key key, Value value) Update the value of the item with the given key in the list if ot exists, otherwise it appends the value to the end of the list.remove(Transaction tx, Key key) remove the index keyvoidsetHeadPageId(long headPageId) voidsetKeyMarshaller(Marshaller<Key> keyMarshaller) Set the marshaller for key objectsvoidsetPageFile(PageFile pageFile) voidsetTailPageId(long tailPageId) voidsetValueMarshaller(Marshaller<Value> valueMarshaller) Set the marshaller for key objectslongsize()voidstoreNode(Transaction tx, ListNode<Key, Value> node, boolean overflow) voidunload(Transaction tx) unload indexes
-
Field Details
-
NOT_SET
public static final long NOT_SET- See Also:
-
pageFile
-
headPageId
protected long headPageId -
tailPageId
protected long tailPageId -
loaded
-
-
Constructor Details
-
ListIndex
public ListIndex() -
ListIndex
-
ListIndex
-
-
Method Details
-
load
Description copied from interface:Indexload indexes- Specified by:
loadin interfaceIndex<Key,Value> - Throws:
IOException
-
onLoad
-
unload
Description copied from interface:Indexunload indexes -
getHead
- Throws:
IOException
-
getTail
- Throws:
IOException
-
containsKey
- Specified by:
containsKeyin interfaceIndex<Key,Value> - Returns:
- true if it contains the key
- Throws:
IOException
-
get
- Specified by:
getin interfaceIndex<Key,Value> - Returns:
- the entry
- Throws:
IOException
-
put
Update the value of the item with the given key in the list if ot exists, otherwise it appends the value to the end of the list.- Specified by:
putin interfaceIndex<Key,Value> - Returns:
- the old value contained in the list if one exists or null.
- Throws:
IOException
-
add
- Throws:
IOException
-
addFirst
- Throws:
IOException
-
remove
Description copied from interface:Indexremove the index key- Specified by:
removein interfaceIndex<Key,Value> - Returns:
- StoreEntry removed
- Throws:
IOException
-
onRemove
-
isTransient
public boolean isTransient()- Specified by:
isTransientin interfaceIndex<Key,Value> - Returns:
- true if the index is transient
-
clear
Description copied from interface:Indexclear the index- Specified by:
clearin interfaceIndex<Key,Value> - Throws:
IOException
-
listNodeIterator
- Throws:
IOException
-
isEmpty
- Throws:
IOException
-
iterator
- Specified by:
iteratorin interfaceIndex<Key,Value> - Returns:
- Throws:
IOException
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx, long initialPosition) throws IOException - Throws:
IOException
-
getFirst
- Throws:
IOException
-
getLast
- Throws:
IOException
-
createNode
- Throws:
IOException
-
storeNode
public void storeNode(Transaction tx, ListNode<Key, Value> node, boolean overflow) throws IOException- Throws:
IOException
-
getPageFile
-
setPageFile
-
getHeadPageId
public long getHeadPageId() -
setHeadPageId
public void setHeadPageId(long headPageId) -
getKeyMarshaller
-
setKeyMarshaller
Description copied from interface:IndexSet the marshaller for key objects- Specified by:
setKeyMarshallerin interfaceIndex<Key,Value>
-
getValueMarshaller
-
setValueMarshaller
Description copied from interface:IndexSet the marshaller for key objects- Specified by:
setValueMarshallerin interfaceIndex<Key,Value>
-
setTailPageId
public void setTailPageId(long tailPageId) -
getTailPageId
public long getTailPageId() -
size
public long size()
-