|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.cursor.AbstractCursor<S>
com.amazon.carbonado.raw.RawCursor<S>
public abstract class RawCursor<S>
Abstract Cursor implementation for a repository that manipulates raw bytes.
| Field Summary | |
|---|---|
protected Lock |
mLock
Lock object, as passed into the constructor |
| Constructor Summary | |
|---|---|
protected |
RawCursor(Lock lock,
byte[] startBound,
boolean inclusiveStart,
byte[] endBound,
boolean inclusiveEnd,
int maxPrefix,
boolean reverse)
|
| Method Summary | |
|---|---|
void |
close()
Call close to release any resources being held by this cursor. |
protected int |
compareKeysPartially(byte[] key1,
byte[] key2)
Returns <0 if key1 is less, 0 if equal (at least partially), >0 if key1 is greater. |
protected void |
disableKeyAndValue()
An optimization hint which disables key and value acquisition. |
protected void |
disableValue()
An optimization hint which disables just value acquisition. |
protected void |
enableKeyAndValue()
Enable key and value acquisition again, after they have been disabled. |
protected abstract byte[] |
getCurrentKey()
Returns the contents of the current key being referenced, or null otherwise. |
protected abstract byte[] |
getCurrentValue()
Returns the contents of the current value being referenced, or null otherwise. |
protected void |
handleNoSuchElement()
Called right before throwing NoSuchElementException. |
boolean |
hasNext()
Returns true if this cursor has more elements. |
protected abstract S |
instantiateCurrent()
Returns a new Storable instance for the currently referenced entry. |
S |
next()
Returns the next element from this cursor. |
protected abstract void |
release()
Release any internal resources, called when closed. |
int |
skipNext(int amount)
Skips forward by the specified amount of elements, returning the actual amount skipped. |
protected abstract boolean |
toFirst()
Move the cursor to the first available entry. |
protected abstract boolean |
toFirst(byte[] key)
Move the cursor to the first available entry at or after the given key. |
protected abstract boolean |
toLast()
Move the cursor to the last available entry. |
protected abstract boolean |
toLast(byte[] key)
Move the cursor to the last available entry at or before the given key. |
protected abstract boolean |
toNext()
Move the cursor to the next available entry, returning false if none. |
protected int |
toNext(int amount)
Move the cursor to the next available entry, incrementing by the amount given. |
protected boolean |
toNextKey()
Move the cursor to the next unique key, returning false if none. |
protected abstract boolean |
toPrevious()
Move the cursor to the previous available entry, returning false if none. |
protected int |
toPrevious(int amount)
Move the cursor to the previous available entry, decrementing by the amount given. |
protected boolean |
toPreviousKey()
Move the cursor to the previous unique key, returning false if none. |
| Methods inherited from class com.amazon.carbonado.cursor.AbstractCursor |
|---|
copyInto, copyInto, toList, toList |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Lock mLock
| Constructor Detail |
|---|
protected RawCursor(Lock lock,
byte[] startBound,
boolean inclusiveStart,
byte[] endBound,
boolean inclusiveEnd,
int maxPrefix,
boolean reverse)
lock - operations lock on this objectstartBound - specify the starting key for the cursor, or null if firstinclusiveStart - true if start bound is inclusiveendBound - specify the ending key for the cursor, or null if lastinclusiveEnd - true if end bound is inclusivemaxPrefix - maximum expected common initial bytes in start and end boundreverse - when true, iteration is reversed
IllegalArgumentException - if any bound is null but is not inclusive| Method Detail |
|---|
public void close()
throws FetchException
Cursor
FetchException
public boolean hasNext()
throws FetchException
Cursornext would return an element rather than throwing
an exception.
FetchException - if storage layer throws an exception
public S next()
throws FetchException,
NoSuchElementException
Cursor
FetchException - if storage layer throws an exception
NoSuchElementException - if the cursor has no next element.
public int skipNext(int amount)
throws FetchException
Cursor
skipNext in interface Cursor<S>skipNext in class AbstractCursor<S>amount - maximum amount of elements to skip
FetchException - if storage layer throws an exception
protected abstract void release()
throws FetchException
FetchException
protected abstract byte[] getCurrentKey()
throws FetchException
If cursor is not opened, null must be returned.
IllegalStateException - if key is disabled
FetchException
protected abstract byte[] getCurrentValue()
throws FetchException
If cursor is not opened, null must be returned.
IllegalStateException - if value is disabled
FetchExceptionprotected void disableKeyAndValue()
protected void disableValue()
protected void enableKeyAndValue()
throws FetchException
FetchException
protected abstract S instantiateCurrent()
throws FetchException
IllegalStateException - if no current entry to instantiate
FetchException
protected abstract boolean toFirst()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected abstract boolean toFirst(byte[] key)
throws FetchException
key - key to search for
IllegalStateException - if cursor is not opened
FetchException
protected abstract boolean toLast()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected abstract boolean toLast(byte[] key)
throws FetchException
key - key to search for
IllegalStateException - if cursor is not opened
FetchException
protected abstract boolean toNext()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected int toNext(int amount)
throws FetchException
Calling to toNext(1) is equivalent to calling toNext().
amount - positive amount to advance
IllegalStateException - if cursor is not opened
FetchException
protected boolean toNextKey()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected abstract boolean toPrevious()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected int toPrevious(int amount)
throws FetchException
Calling to toPrevious(1) is equivalent to calling toPrevious().
amount - positive amount to retreat
IllegalStateException - if cursor is not opened
FetchException
protected boolean toPreviousKey()
throws FetchException
IllegalStateException - if cursor is not opened
FetchException
protected int compareKeysPartially(byte[] key1,
byte[] key2)
protected void handleNoSuchElement()
throws FetchException
FetchException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||