Expand description
Typed cluster command encoding for Raft log entries.
All commands written into the Raft log by AmateRS components (data writes,
placement actions, membership changes) are encoded as a ClusterCommand
and stored in Command::data. The encoding is:
[tag: u8] [json: UTF-8 bytes]The tag byte allows O(1) dispatch without deserialising the payload.
§Variant tags
| Tag | Variant |
|---|---|
| 0x01 | DataPut |
| 0x02 | DataDelete |
| 0x10 | PlaceSplit |
| 0x11 | PlaceMerge |
| 0x12 | PlaceTransfer |
| 0x20 | MembershipAdd |
| 0x21 | MembershipRemove |
§State machine boundary
This module is responsible for encoding commands into the Raft log only.
The state machine that applies committed PlaceSplit, PlaceMerge, and
PlaceTransfer entries — updating the crate::shard::ShardRegistry and
migrating data — is a separate concern implemented in future phases.
Enums§
- Cluster
Command - A typed, serialisable view over the raw
Command::databytes in a Raft log entry.
Constants§
- TAG_
DATA_ DELETE - Raft log tag for a KV delete (data plane).
- TAG_
DATA_ PUT - Raft log tag for a KV put (data plane).
- TAG_
MEMBERSHIP_ ADD - Raft log tag for adding a cluster member.
- TAG_
MEMBERSHIP_ REMOVE - Raft log tag for removing a cluster member.
- TAG_
PLACE_ MERGE - Raft log tag for a shard merge action.
- TAG_
PLACE_ SPLIT - Raft log tag for a shard split action.
- TAG_
PLACE_ TRANSFER - Raft log tag for a shard transfer action.