public interface Iterator extends Iterator<ByteBuffer>
StateMachine.onApply(Iterator)| 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.
|
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.
|
forEachRemaining, hasNext, next, removevoid setAutoCommitPerLog(boolean status)
status - enables auto-commit mode or not, true means enable.ByteBuffer getData()
long getIndex()
long getTerm()
Closure done()
boolean commit()
void commitAndSnapshotSync(Closure done)
done - Invoked when the snapshot finishes, describing the detailed result.Node.snapshotSync(Closure),
commit()void setErrorAndRollback(long ntail,
Status st)
ntail - 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.