Skip to main content

Module cluster_command

Module cluster_command 

Source
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

TagVariant
0x01DataPut
0x02DataDelete
0x10PlaceSplit
0x11PlaceMerge
0x12PlaceTransfer
0x20MembershipAdd
0x21MembershipRemove

§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§

ClusterCommand
A typed, serialisable view over the raw Command::data bytes 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.