Interface Commit<T>
public interface Commit<T>
-
Method Summary
Modifier and Type Method Description longindex()Returns the commit index.io.atomix.utils.time.LogicalTimestamplogicalTime()Returns the logical time at which the operation was committed.<U> Commit<U>map(java.util.function.Function<T,U> transcoder)Converts the commit from one type to another.Commit<Void>mapToNull()Converts the commit to a null valued commit.OperationIdoperation()Returns the operation identifier.Sessionsession()Returns the session that submitted the operation.Tvalue()Returns the operation submitted by the client.io.atomix.utils.time.WallClockTimestampwallClockTime()Returns the time at which the operation was committed.
-
Method Details
-
index
long index()Returns the commit index.This is the index at which the committed
PrimitiveOperationwas written in the Raft log. Raft guarantees that this index will be unique forPrimitiveOperationcommits and will be the same for all instances of the given operation on all servers in the cluster.For
PrimitiveOperationoperations, the returnedindexmay actually be representative of the last committed index in the Raft log since queries are not actually written to disk. Thus, query commits cannot be assumed to have unique indexes.- Returns:
- The commit index.
-
session
Session session()Returns the session that submitted the operation.The returned
Sessionis representative of the session that submitted the operation that resulted in thisCommit. The session can be used toSession.publish(PrimitiveEvent)event messages to the client.- Returns:
- The session that created the commit.
-
logicalTime
io.atomix.utils.time.LogicalTimestamp logicalTime()Returns the logical time at which the operation was committed.- Returns:
- The logical commit time.
-
wallClockTime
io.atomix.utils.time.WallClockTimestamp wallClockTime()Returns the time at which the operation was committed.The time is representative of the time at which the leader wrote the operation to its log. Because instants are replicated through the Raft consensus algorithm, they are guaranteed to be consistent across all servers and therefore can be used to perform time-dependent operations such as expiring keys or timeouts. Additionally, commit times are guaranteed to progress monotonically, never going back in time.
Users should never use
Systemtime to control behavior in a state machine and should instead rely uponCommittimes or use theServiceExecutorfor time-based controls.- Returns:
- The commit time.
-
operation
OperationId operation()Returns the operation identifier.- Returns:
- the operation identifier
-
value
T value()Returns the operation submitted by the client.- Returns:
- The operation submitted by the client.
-
map
Converts the commit from one type to another.- Type Parameters:
U- the output commit value type- Parameters:
transcoder- the transcoder with which to transcode the commit value- Returns:
- the mapped commit
-
mapToNull
Converts the commit to a null valued commit.- Returns:
- the mapped commit
-