T - command result typepublic interface Command<T> extends Operation<T>
Commands are submitted by clients to a Raft server and used to modify Raft cluster-wide state. When a command is submitted to the cluster, if the command is received by a follower, the Raft protocol dictates that it must be forwarded to the cluster leader. Once the leader receives a command, it logs and replicates the command to a majority of the cluster before applying it to its state machine and responding with the result.
When commands are submitted to the Raft cluster, they're written to a commit log on disk or in memory (based on the
storage configuration) and replicated to a majority of the cluster. As disk usage grows over time, servers compact
their logs to remove commands that no longer contribute to the state machine's state. In order to ensure state machines
remain deterministic, commands must provide compaction modes
to aid servers in deciding when it's safe to remove a command from the log. The compaction mode allows state machines
to safely handle the complexities of removing state from state machines while ensuring state machines remain
deterministic, particularly in the event of a failure and replay of the commit log. See the
Command.CompactionMode documentation for more info.
CatalystSerializable
or register a custom TypeSerializer for better performance. Serializable types
can be registered on the associated client/server Serializer instance.Command.CompactionMode| Modifier and Type | Interface and Description |
|---|---|
static class |
Command.CompactionMode
Constants for specifying command compaction modes.
|
| Modifier and Type | Method and Description |
|---|---|
default Command.CompactionMode |
compaction()
Returns the command compaction mode.
|
default Command.CompactionMode compaction()
The compaction mode will dictate the circumstances under which the command can be safely removed from the Raft replicated log. Commands and the state machines to which they apply must coordinate the compaction process via this mechanism.
Command.CompactionModeCopyright © 2013–2017. All rights reserved.