Annotation Interface StateMachineWrite


@Target({METHOD,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface StateMachineWrite
Marks a method as a write operation in the Raft state machine.

Write operations modify the state machine and must go through the Raft consensus protocol to ensure consistency across all nodes in the cluster. These operations are replicated to all nodes and applied in the same order.

Each write operation must be uniquely identifiable within the state machine definition by its id and version combination. The same id/version pair cannot be shared between write operations.

The version parameter enables backwards compatibility when evolving the state machine interface over time.

Since:
2.0
Author:
José Bolina
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    Unique identifier for this write operation within the state machine definition.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Version number for backwards compatibility.
  • Element Details

    • id

      int id
      Unique identifier for this write operation within the state machine definition.
      Returns:
      the operation identifier
    • version

      int version
      Version number for backwards compatibility.

      Allows evolution of the state machine interface while maintaining compatibility with existing clients.

      Returns:
      the operation version, defaults to 1
      Default:
      1