pub enum MetaCommand {
Show 18 variants
RegisterNode {
descriptor: NodeDescriptor,
},
UpdateNodeState {
node_id: NodeId,
state: NodeState,
expected_version: Option<MetadataVersion>,
},
RemoveNode {
node_id: NodeId,
},
CreateDatabase {
descriptor: DatabaseDescriptor,
},
DropDatabase {
database_id: DatabaseId,
},
SetTableSchema {
record: TableSchemaRecord,
},
SetTabletDescriptor {
descriptor: TabletDescriptor,
},
RemoveTabletDescriptor {
tablet_id: TabletId,
generation: u64,
},
SetReplicaPlacement {
placement: ReplicaPlacement,
},
SetPlacementPolicy {
name: String,
policy: PlacementPolicy,
},
SubmitSchemaJob {
job: SchemaJobRecord,
},
UpdateSchemaJob {
job_id: u64,
state: SchemaJobState,
updated_at: HlcTimestamp,
error: Option<String>,
expected_version: Option<MetadataVersion>,
},
SetClusterSetting {
key: String,
value: Value,
},
ActivateFeature {
activation: FeatureActivation,
},
SetTxnStatusPartition {
partition: TxnStatusPartition,
},
PublishSplit {
command: SplitPublishCommand,
},
PublishMerge {
command: MergePublishCommand,
},
AllocateRaftNodeIds {
count: u32,
},
}Expand description
One replicated meta control-plane command (spec section 12.1).
Every variant is deterministic and idempotent at apply: records are
versioned (MetadataVersion, schema_version, or generation per
record) and last-writer-wins guards reject stale or conflicting writes
with a typed MetaRejectionReason instead of faulting the state
machine.
Variants§
RegisterNode
Registers (or re-registers) a cluster node’s descriptor. Identical re-registration is a no-op.
Fields
descriptor: NodeDescriptorThe node’s advertised descriptor.
UpdateNodeState
Updates a node’s lifecycle state; Decommissioned is terminal.
Fields
expected_version: Option<MetadataVersion>Optimistic-concurrency guard: when Some, the write applies only
if the record’s current MetadataVersion equals it.
RemoveNode
Removes a node from membership. Refused while any tablet or placement still references the node; absent nodes are a no-op.
CreateDatabase
Creates a logical database. Name and id must both be free.
Fields
descriptor: DatabaseDescriptorThe new database’s descriptor.
DropDatabase
Drops a database. Refused while tables reference it; absent databases are a no-op.
Fields
database_id: DatabaseIdThe database to drop.
SetTableSchema
Publishes a table schema (last-writer-wins by schema_version).
Fields
record: TableSchemaRecordThe schema record to publish.
SetTabletDescriptor
Publishes a tablet descriptor (last-writer-wins by generation).
Review m7: LWW is the intended concurrency model for
SetTabletDescriptor / SetTableSchema. Only UpdateNodeState and
UpdateSchemaJob carry expected_version CAS tokens. Two admins
doing read-modify-write on one tablet descriptor can lose updates
silently when the later write carries a higher generation — tooling
must re-read before rewrite, or use a CAS-guarded command when added.
Fields
descriptor: TabletDescriptorThe tablet descriptor to publish.
RemoveTabletDescriptor
Removes a tablet descriptor at or above its stored generation.
Fields
SetReplicaPlacement
Publishes the replica placement of one raft group.
Fields
placement: ReplicaPlacementThe placement to publish.
SetPlacementPolicy
Publishes (or replaces) a named placement policy (spec section 12.7).
SubmitSchemaJob
Submits a schema/index job (starts SchemaJobState::Pending).
Fields
job: SchemaJobRecordThe job record.
UpdateSchemaJob
Transitions a schema job along the legal state graph.
Fields
state: SchemaJobStateRequested state.
updated_at: HlcTimestampTimestamp of the update.
expected_version: Option<MetadataVersion>Optimistic-concurrency guard; see
MetaCommand::UpdateNodeState::expected_version.
SetClusterSetting
Sets one dynamic cluster setting (spec section 16.2; see
KNOWN_SETTING_KEYS and SECRET_SETTING_KEY_DENYLIST).
ActivateFeature
Activates a cluster feature (spec section 11.8 step 5): refused at apply unless every non-decommissioned registered node supports the feature and the level satisfies the registry.
Fields
activation: FeatureActivationThe activation record.
SetTxnStatusPartition
Publishes one transaction status partition’s home group.
Fields
partition: TxnStatusPartitionThe partition record.
PublishSplit
Publishes the atomic routing change of one tablet split (spec section
12.5 step 8): the children become Active and the source Retiring
in ONE command. Refused unless the stored source is the command’s
Splitting precursor and the stored children its Creating
precursors at exactly one generation below the publication
generation, the child bounds partition the source at the split key,
and no other routable tablet of the table overlaps a child. An exact
re-application (the stored descriptors already carry the command’s
content) is a no-op, so a split resumed after a crash in the
publication barrier may re-publish.
Fields
command: SplitPublishCommandThe publication (see crate::split::SplitPublishCommand).
PublishMerge
Publishes the atomic routing change of one tablet merge (spec section
12.6): the hidden replacement becomes Active and both sources
Retiring in ONE command. Refused unless the stored sources are the
command’s Merging precursors and the stored replacement its
Creating precursor, with the command-wide generation one above the
highest stored generation (a lagging source jumps to it), the
replacement bounds covering exactly the source union, and no other
routable tablet of the table overlapping the replacement. Exact
re-application is a no-op (see Self::PublishSplit).
Fields
command: MergePublishCommandThe publication (see crate::merge::MergePublishCommand).
AllocateRaftNodeIds
Allocates count fresh per-group raft node ids from the meta-owned
allocator (spec section 12.1: the meta control plane owns the
node-id ↔ raft-id mapping; tablet replica raft ids come from this
allocator, never the ad-hoc node-id projection the meta group itself
uses). Ids are drawn from a monotonic counter that skips ids already
in use (registered-node projections, tablet and placement replicas).
The allocation is recorded under the command id, so a replayed
command never double-allocates; the proposer reads the base back
through MetaGroup::allocate_raft_node_ids.
Trait Implementations§
Source§impl Clone for MetaCommand
impl Clone for MetaCommand
Source§fn clone(&self) -> MetaCommand
fn clone(&self) -> MetaCommand
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MetaCommand
impl Debug for MetaCommand
Source§impl<'de> Deserialize<'de> for MetaCommand
impl<'de> Deserialize<'de> for MetaCommand
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MetaCommand
impl PartialEq for MetaCommand
Source§impl Serialize for MetaCommand
impl Serialize for MetaCommand
impl StructuralPartialEq for MetaCommand
Auto Trait Implementations§
impl Freeze for MetaCommand
impl RefUnwindSafe for MetaCommand
impl Send for MetaCommand
impl Sync for MetaCommand
impl Unpin for MetaCommand
impl UnsafeUnpin for MetaCommand
impl UnwindSafe for MetaCommand
Blanket Implementations§
impl<T> AppData for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
impl<T> AppDataResponse for Twhere
T: OptionalSend + OptionalSync + 'static + OptionalSerde,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request