public class IteratorWrapper extends Object implements Iterator
| Constructor and Description |
|---|
IteratorWrapper(IteratorImpl iterImpl) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
commit()
Commit state machine.
|
void |
commitAndSnapshotSync(Closure done)
Commit state machine, then try to save a snapshot with current log applied if commit successfully.
|
Closure |
done()
If done() is non-NULL, you must call done()->Run() after applying this
task no matter this operation succeeds or fails, otherwise the
corresponding resources would leak.
|
ByteBuffer |
getData()
Return the data whose content is the same as what was passed to
Node#apply(Task) in the leader node.
|
long |
getIndex()
Return a unique and monotonically increasing identifier of the current task:
- Uniqueness guarantees that committed tasks in different peers with
the same index are always the same and kept unchanged.
|
long |
getTerm()
Returns the term of the leader which to task was applied to.
|
boolean |
hasNext() |
ByteBuffer |
next() |
void |
setAutoCommitPerLog(boolean status)
When calling #{Iterator#next}, whether to commit the state machine.
|
void |
setErrorAndRollback(long ntail,
Status st)
Invoked when some critical error occurred.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemaining, removepublic IteratorWrapper(IteratorImpl iterImpl)
public boolean hasNext()
hasNext in interface Iterator<ByteBuffer>public ByteBuffer next()
next in interface Iterator<ByteBuffer>public void setAutoCommitPerLog(boolean status)
Iteratorstatus - enables auto-commit mode or not, true means enable.public ByteBuffer getData()
Iteratorpublic long getIndex()
Iteratorpublic long getTerm()
Iteratorpublic boolean commit()
Iteratorpublic void commitAndSnapshotSync(Closure done)
Iteratordone - Invoked when the snapshot finishes, describing the detailed result.Node.snapshotSync(Closure),
Iterator.commit()public Closure done()
Iteratorpublic void setErrorAndRollback(long ntail,
Status st)
Iteratorntail - the number of tasks (starting from the last iterated one) considered as not to be applied.st - Status to describe the detail of the error.Copyright © 2024. All rights reserved.