Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions crates/wal-protocol/src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use restate_types::{
/// Announcing a new leader. This message can be written by any component to make the specified
/// partition processor the leader.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, bilrost::Message)]
pub struct AnnounceLeader {
pub struct AnnounceLeaderCommand {
/// Sender of the announce leader message.
///
/// This became non-optional in v1.5. Noting that it has always been set in previous versions,
Expand Down Expand Up @@ -60,9 +60,9 @@ pub struct AnnounceLeader {
pub next_config: Option<NextReplicaSetConfiguration>,
}

bilrost_storage_encode_decode!(AnnounceLeader);
bilrost_storage_encode_decode!(AnnounceLeaderCommand);

impl HasRecordKeys for AnnounceLeader {
impl HasRecordKeys for AnnounceLeaderCommand {
fn record_keys(&self) -> Keys {
Keys::RangeInclusive(self.partition_key_range.start()..=self.partition_key_range.end())
}
Expand Down Expand Up @@ -161,17 +161,17 @@ fn new_replica_set_state(version: Version, node_set: &NodeSet) -> ReplicaSetStat
/// minimum version of restate server that can progress after this command. It also updates the FSM
/// in case command has been trimmed.
#[derive(Debug, Clone, bilrost::Message, serde::Serialize, serde::Deserialize)]
pub struct VersionBarrier {
pub struct VersionBarrierCommand {
/// The minimum version required (inclusive) to progress after this barrier.
pub version: SemanticRestateVersion,
/// A human-readable reason for why this barrier exists.
pub human_reason: Option<String>,
pub partition_key_range: Keys,
}

bilrost_storage_encode_decode!(VersionBarrier);
bilrost_storage_encode_decode!(VersionBarrierCommand);

impl HasRecordKeys for VersionBarrier {
impl HasRecordKeys for VersionBarrierCommand {
fn record_keys(&self) -> Keys {
self.partition_key_range.clone()
}
Expand All @@ -185,7 +185,7 @@ impl HasRecordKeys for VersionBarrier {
///
/// Since v1.4.2.
#[derive(Debug, Clone, bilrost::Message, serde::Serialize, serde::Deserialize)]
pub struct PartitionDurability {
pub struct UpdatePartitionDurabilityCommand {
#[bilrost(tag(1))]
pub partition_id: PartitionId,
/// The partition has applied this LSN durably to the replica-set and/or has been
Expand All @@ -201,9 +201,9 @@ pub struct PartitionDurability {
pub partition_key_range: Keys,
}

bilrost_storage_encode_decode!(PartitionDurability);
bilrost_storage_encode_decode!(UpdatePartitionDurabilityCommand);

impl HasRecordKeys for PartitionDurability {
impl HasRecordKeys for UpdatePartitionDurabilityCommand {
fn record_keys(&self) -> Keys {
self.partition_key_range.clone()
}
Expand All @@ -213,14 +213,14 @@ impl HasRecordKeys for PartitionDurability {
///
/// Since v1.6.0.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct UpsertSchema {
pub struct UpsertSchemaCommand {
pub partition_key_range: Keys,
pub schema: Schema,
}

flexbuffers_storage_encode_decode!(UpsertSchema);
flexbuffers_storage_encode_decode!(UpsertSchemaCommand);

impl HasRecordKeys for UpsertSchema {
impl HasRecordKeys for UpsertSchemaCommand {
fn record_keys(&self) -> Keys {
self.partition_key_range.clone()
}
Expand All @@ -242,7 +242,7 @@ impl HasRecordKeys for UpsertSchema {
///
/// Since v1.7.0.
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct UpsertRuleBook {
pub struct UpsertRuleBookCommand {
pub partition_key_range: KeyRange,
pub rule_book: Bytes,
}
13 changes: 7 additions & 6 deletions crates/wal-protocol/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ use restate_types::message::MessageIndex;
use restate_types::state_mut::ExternalStateMutation;

use crate::control::{
AnnounceLeader, PartitionDurability, UpsertRuleBook, UpsertSchema, VersionBarrier,
AnnounceLeaderCommand, UpdatePartitionDurabilityCommand, UpsertRuleBookCommand,
UpsertSchemaCommand, VersionBarrierCommand,
};
use crate::timer::TimerKeyValue;

Expand Down Expand Up @@ -135,13 +136,13 @@ pub enum Command {
/// See [`PartitionDurability`] for more details.
///
/// *Since v1.4.2*
UpdatePartitionDurability(PartitionDurability),
UpdatePartitionDurability(UpdatePartitionDurabilityCommand),
/// A version barrier to fence off state machine changes that require a certain minimum
/// version of restate server.
/// *Since v1.4.0*
VersionBarrier(VersionBarrier),
VersionBarrier(VersionBarrierCommand),
// -- Control-plane related events
AnnounceLeader(Box<AnnounceLeader>),
AnnounceLeader(Box<AnnounceLeaderCommand>),

// -- Partition processor commands
/// Manual patching of storage state
Expand Down Expand Up @@ -188,12 +189,12 @@ pub enum Command {

/// Upsert schema for consistent schema across replicas
/// *Since v1.6.0
UpsertSchema(UpsertSchema),
UpsertSchema(UpsertSchemaCommand),
/// Upsert the cluster-global rule book for consistent rules across
/// replicas; the apply path persists it to the partition store and
/// notifies the leader's `UserLimiter` of the diff.
/// *Since v1.7.0
UpsertRuleBook(UpsertRuleBook),
UpsertRuleBook(UpsertRuleBookCommand),
// # Commands for VQueues management
// ----------------------------------
/// A command to attempt a run an entry in the vqueue (invocation, or otherwise)
Expand Down
Loading
Loading