Class ListIndex<Key,Value>
- java.lang.Object
-
- org.apache.activemq.store.kahadb.disk.index.ListIndex<Key,Value>
-
-
Field Summary
Fields Modifier and Type Field Description protected long
headPageId
protected AtomicBoolean
loaded
static long
NOT_SET
protected PageFile
pageFile
protected long
tailPageId
-
Method Summary
-
-
-
Field Detail
-
NOT_SET
public static final long NOT_SET
- See Also:
- Constant Field Values
-
pageFile
protected PageFile pageFile
-
headPageId
protected long headPageId
-
tailPageId
protected long tailPageId
-
loaded
protected AtomicBoolean loaded
-
-
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
-
onLoad
protected void onLoad(ListNode<Key,Value> node, Transaction tx)
-
unload
public void unload(Transaction tx)
Description copied from interface:Index
unload indexes
-
getHead
protected ListNode<Key,Value> getHead(Transaction tx) throws IOException
- Throws:
IOException
-
getTail
protected ListNode<Key,Value> getTail(Transaction tx) throws IOException
- 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
-
get
public Value get(Transaction tx, Key key) throws IOException
- Specified by:
get
in interfaceIndex<Key,Value>
- Returns:
- the entry
- Throws:
IOException
-
put
public Value put(Transaction tx, Key key, Value value) throws IOException
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:
put
in interfaceIndex<Key,Value>
- Returns:
- the old value contained in the list if one exists or null.
- Throws:
IOException
-
add
public Value add(Transaction tx, Key key, Value value) throws IOException
- Throws:
IOException
-
addFirst
public Value addFirst(Transaction tx, Key key, Value value) throws IOException
- 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
-
isTransient
public boolean isTransient()
- Specified by:
isTransient
in interfaceIndex<Key,Value>
- Returns:
- true if the index is transient
-
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
-
listNodeIterator
public Iterator<ListNode<Key,Value>> listNodeIterator(Transaction tx) throws IOException
- Throws:
IOException
-
isEmpty
public boolean isEmpty(Transaction tx) throws IOException
- Throws:
IOException
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx) throws IOException
- Specified by:
iterator
in interfaceIndex<Key,Value>
- Returns:
- Throws:
IOException
-
iterator
public Iterator<Map.Entry<Key,Value>> iterator(Transaction tx, long initialPosition) throws IOException
- Throws:
IOException
-
getFirst
public Map.Entry<Key,Value> getFirst(Transaction tx) throws IOException
- Throws:
IOException
-
getLast
public Map.Entry<Key,Value> getLast(Transaction tx) throws IOException
- Throws:
IOException
-
createNode
public ListNode<Key,Value> createNode(Transaction tx) throws IOException
- Throws:
IOException
-
storeNode
public void storeNode(Transaction tx, ListNode<Key,Value> node, boolean overflow) throws IOException
- Throws:
IOException
-
getPageFile
public PageFile getPageFile()
-
setPageFile
public void setPageFile(PageFile pageFile)
-
getHeadPageId
public long getHeadPageId()
-
setHeadPageId
public void setHeadPageId(long headPageId)
-
getKeyMarshaller
public Marshaller<Key> getKeyMarshaller()
-
setKeyMarshaller
public void setKeyMarshaller(Marshaller<Key> keyMarshaller)
Description copied from interface:Index
Set the marshaller for key objects- Specified by:
setKeyMarshaller
in interfaceIndex<Key,Value>
-
getValueMarshaller
public Marshaller<Value> getValueMarshaller()
-
setValueMarshaller
public void setValueMarshaller(Marshaller<Value> valueMarshaller)
Description copied from interface:Index
Set the marshaller for key objects- Specified by:
setValueMarshaller
in interfaceIndex<Key,Value>
-
setTailPageId
public void setTailPageId(long tailPageId)
-
getTailPageId
public long getTailPageId()
-
size
public long size()
-
-