Annotation Interface StateMachineField
Marks a field for inclusion in Raft snapshots.
This annotation identifies state machine fields that should be persisted when creating snapshots of the current state. Snapshots are used to compact the log and enable efficient state transfer to new or lagging nodes.
Field requirements:
- Must not be
private- accessible for snapshot operations - Must not be
final- modifiable during snapshot restoration - Must be thread-safe - concurrent access during snapshot creation
The order parameter determines the sequence in which fields are stored and restored in snapshots, ensuring
consistent state reconstruction.
- Since:
- 2.0
- Author:
- José Bolina
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionintThe order of the field to be stored in the snapshot.
-
Element Details
-
order
int orderThe order of the field to be stored in the snapshot.The fields guarantee the order in which they are stored in the snapshot. This value must be unique across all fields in the state machine. If multiple fields have the same order, an
IllegalStateExceptionwill be thrown.- Returns:
- The order of the field in the snapshot.
-