Annotation Interface StateMachineRead
Read operations do not modify the state machine and can be executed locally without going through the consensus protocol. This provides better performance for queries that don't require strong consistency. Read-only operations also employ the optimization described in the Raft paper to ensure linearizability by checking the leader's commit index, in case linearizability is required.
Each read operation must be uniquely identifiable within the state machine class by its id and version combination.
The same id/version pair cannot be shared between read 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 ElementsModifier and TypeRequired ElementDescriptionintUnique identifier for this read operation within the state machine definition. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionintVersion number for backwards compatibility.
-
Element Details
-
id
int idUnique identifier for this read operation within the state machine definition.- Returns:
- the operation identifier
-
version
int versionVersion 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
-