|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.crankuptheamps.client.BookmarkRingBuffer
public class BookmarkRingBuffer
A ring buffer of bookmarks and activation status Used by all of the bookmark stores to track state of bookmarks we need to hold on to, either because they're active or because they're after an active one.
Nested Class Summary | |
---|---|
class |
BookmarkRingBuffer.Entry
Represents a single entry in an array of bookmarks |
Field Summary | |
---|---|
static int |
UNSET_INDEX
|
Constructor Summary | |
---|---|
BookmarkRingBuffer()
Initializes the underlying array, and sets the "last discarded" value to something reasonable. |
Method Summary | |
---|---|
int |
capacity()
Size of underlying array |
boolean |
discard(long index)
Discards an entry by index. |
BookmarkRingBuffer.Entry |
find(BookmarkField field)
Searches valid Entrys for the given bookmark |
BookmarkRingBuffer.Entry |
getByIndex(long index)
Retrieves an Entry given an index |
long |
getEndIndex()
Returns the index value one greater than the last valid Entry in self. |
BookmarkField |
getLastDiscarded()
Returns the "last discarded" bookmark. |
long |
getStartIndex()
Returns the index value associated with the first valid Entry in self. |
boolean |
isEmpty()
Returns if the buffer is currently empty. |
long |
log(BookmarkField bookmark)
Logs the bookmark by allocating an Entry, setting the Entry to active, copying the bookmark value to that entry, and returning the index of that entry. |
void |
noPersistedAcks()
Called to indicate that the server won't provide persisted acks for the bookmarks so anything that is discarded should be assumed persisted. |
void |
persisted(BookmarkField bookmark)
Mark all records up to the and including the provided bookmark as safe for discard and discard all appropriate bookmarks. |
void |
persisted(long bookmark)
|
boolean |
persistedAcks()
Called to check if persisted acks are expected. |
long |
relog(long oldIndex,
BookmarkField bookmark)
Re-logs the bookmark by copying an Entry to a new location and returning the index of that new location. |
void |
setPersistedAcks()
Called to indicate that the server will provide persisted acks for the bookmarks. |
long |
setRecovery()
|
void |
setResizeHandler(BookmarkStoreResizeHandler handler,
BookmarkStore store)
|
void |
setSubId(Field sub)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNSET_INDEX
Constructor Detail |
---|
public BookmarkRingBuffer()
Method Detail |
---|
public int capacity()
public BookmarkRingBuffer.Entry getByIndex(long index)
index
- An index returned by .getIndex(), getStartIndex(),
getEndIndex(), log, etc.
public BookmarkField getLastDiscarded()
public boolean isEmpty()
public long getStartIndex()
public long getEndIndex()
public long log(BookmarkField bookmark)
bookmark
- the bookmark to loc
public long relog(long oldIndex, BookmarkField bookmark)
bookmark
- the index to move
public boolean discard(long index)
index
- the index of the entry.
public BookmarkRingBuffer.Entry find(BookmarkField field)
field
- the bookmark to search for
public void persisted(BookmarkField bookmark)
bookmark
- The latest bookmark that can be safely disposed.public void persisted(long bookmark)
public void noPersistedAcks()
public void setPersistedAcks()
public boolean persistedAcks()
public void setResizeHandler(BookmarkStoreResizeHandler handler, BookmarkStore store)
public void setSubId(Field sub)
public long setRecovery()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |