Interface Commit<T>


public interface Commit<T>
Represents the committed state and metadata of a Raft state machine operation.
  • Method Summary

    Modifier and Type Method Description
    long index()
    Returns the commit index.
    io.atomix.utils.time.LogicalTimestamp logicalTime()
    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.
    OperationId operation()
    Returns the operation identifier.
    Session session()
    Returns the session that submitted the operation.
    T value()
    Returns the operation submitted by the client.
    io.atomix.utils.time.WallClockTimestamp wallClockTime()
    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 PrimitiveOperation was written in the Raft log. Raft guarantees that this index will be unique for PrimitiveOperation commits and will be the same for all instances of the given operation on all servers in the cluster.

      For PrimitiveOperation operations, the returned index may 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 Session is representative of the session that submitted the operation that resulted in this Commit. The session can be used to Session.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 System time to control behavior in a state machine and should instead rely upon Commit times or use the ServiceExecutor for 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

      <U> Commit<U> map​(java.util.function.Function<T,​U> transcoder)
      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

      Commit<Void> mapToNull()
      Converts the commit to a null valued commit.
      Returns:
      the mapped commit