Skip to main content

MetaCommand

Enum MetaCommand 

Source
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: NodeDescriptor

The node’s advertised descriptor.

§

UpdateNodeState

Updates a node’s lifecycle state; Decommissioned is terminal.

Fields

§node_id: NodeId

The node to update.

§state: NodeState

Requested lifecycle state.

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

Fields

§node_id: NodeId

The node to remove.

§

CreateDatabase

Creates a logical database. Name and id must both be free.

Fields

§descriptor: DatabaseDescriptor

The new database’s descriptor.

§

DropDatabase

Drops a database. Refused while tables reference it; absent databases are a no-op.

Fields

§database_id: DatabaseId

The database to drop.

§

SetTableSchema

Publishes a table schema (last-writer-wins by schema_version).

Fields

§record: TableSchemaRecord

The 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: TabletDescriptor

The tablet descriptor to publish.

§

RemoveTabletDescriptor

Removes a tablet descriptor at or above its stored generation.

Fields

§tablet_id: TabletId

The tablet to remove.

§generation: u64

Removal generation; below the stored generation the command is stale.

§

SetReplicaPlacement

Publishes the replica placement of one raft group.

Fields

§placement: ReplicaPlacement

The placement to publish.

§

SetPlacementPolicy

Publishes (or replaces) a named placement policy (spec section 12.7).

Fields

§name: String

Policy name.

§policy: PlacementPolicy

The policy.

§

SubmitSchemaJob

Submits a schema/index job (starts SchemaJobState::Pending).

Fields

§job: SchemaJobRecord

The job record.

§

UpdateSchemaJob

Transitions a schema job along the legal state graph.

Fields

§job_id: u64

The job to transition.

§state: SchemaJobState

Requested state.

§updated_at: HlcTimestamp

Timestamp of the update.

§error: Option<String>

Failure detail to record (cleared with None).

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

Fields

§key: String

Setting key.

§value: Value

Setting value (typed per key).

§

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: FeatureActivation

The activation record.

§

SetTxnStatusPartition

Publishes one transaction status partition’s home group.

Fields

§partition: TxnStatusPartition

The 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

§

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

§

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.

Fields

§count: u32

Number of ids to allocate (1..=MAX_RAFT_NODE_ID_ALLOCATION).

Trait Implementations§

Source§

impl Clone for MetaCommand

Source§

fn clone(&self) -> MetaCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MetaCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MetaCommand

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MetaCommand

Source§

fn eq(&self, other: &MetaCommand) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for MetaCommand

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for MetaCommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AppData for T
where T: OptionalSend + OptionalSync + 'static + OptionalSerde,

Source§

impl<T> AppDataResponse for T
where T: OptionalSend + OptionalSync + 'static + OptionalSerde,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more