Skip to main content

CommandPublisher

Trait CommandPublisher 

Source
pub trait CommandPublisher: Send + Sync {
    // Required method
    fn publish(&self, cmd_type: u8, data: &[u8]);
}
Expand description

Publisher for command replication to standby instances.

After processing each command, the runtime publishes the raw command bytes so that standby engines can replay the same command stream and maintain identical state. Standby instances compare their state hash (ApplyOutput::hash) against the primary’s published hash to detect divergence.

In production, this is typically backed by NATS JetStream for ordered, persistent delivery.

Required Methods§

Source

fn publish(&self, cmd_type: u8, data: &[u8])

Publish a command for replication.

  • cmd_type: Numeric command type tag for deserialization routing.
  • data: Serialized command bytes.

Implementors§