Skip to main content

MetaGroup

Struct MetaGroup 

Source
pub struct MetaGroup<T: RaftTransport> { /* private fields */ }
Expand description

One member of the dedicated meta control-plane group (spec section 12.1): a ConsensusGroup whose apply sink is a MetaApplySink, plus the bootstrap/membership/propose workflow the node runtime drives.

Implementations§

Source§

impl<T: RaftTransport> MetaGroup<T>

Source

pub async fn create( config: MetaGroupConfig, group_config: GroupConfig, transport: Arc<T>, ) -> Result<Self, MetaError>

Opens the group’s durable state and starts the raft task with a MetaApplySink installed. group_config must match MetaGroupConfig::group_config (tuned timings are fine; identity and directory are not — mismatches fail closed).

Source

pub fn group(&self) -> &ConsensusGroup<T>

The underlying consensus group (snapshots, membership, transfer, read barriers, shutdown).

Source

pub fn node_id(&self) -> NodeId

This node’s durable id.

Source

pub fn meta_group_id(&self) -> RaftGroupId

The meta group’s durable id.

Source

pub async fn bootstrap( &self, members: &[(NodeId, String)], ) -> Result<(), MetaError>

Bootstraps a pristine meta group with the given voter set of (node_id, rpc_address) pairs (call on one pristine member; check MetaGroup::is_initialized on reopen). The 64-bit raft-id projection of distinct node ids must not collide (ADR: collisions are rejected at cluster bootstrap by this layer — the consensus adapter treats raft ids as opaque).

Source

pub async fn is_initialized(&self) -> Result<bool, MetaError>

Whether this node already holds an initialized membership.

Source

pub async fn add_member( &self, descriptor: &NodeDescriptor, control: &ExecutionControl, ) -> Result<MetaCommandReceipt, MetaError>

Adds one member to the meta group (spec section 12.7’s movement protocol, meta-group form): add learner and wait until it is line-rate, promote it to voter through joint consensus, then register its descriptor in replicated meta state. Registration comes last so the feature-activation voter view (registered, non-decommissioned descriptors) reflects only nodes that actually vote.

Source

pub async fn remove_member( &self, node_id: NodeId, control: &ExecutionControl, ) -> Result<MetaCommandReceipt, MetaError>

Removes one member: the replicated MetaCommand::RemoveNode first (validating the node hosts no remaining replicas), then the joint-consensus removal. Validate-then-act keeps the two membership views from diverging on a refusal, and a retry after a mid-workflow failure is idempotent (RemoveNode of an absent node is a no-op). Leadership must be transferred off the node first (spec section 11.6); removing the current leader fails closed.

Source

pub async fn propose( &self, command_id: [u8; 16], command: MetaCommand, control: &ExecutionControl, ) -> Result<MetaCommandReceipt, MetaError>

Proposes one meta command (quorum durability; spec section 11.3) and waits for commit + apply. command_id is the caller’s idempotency token: a retry with the same id and payload replays the original apply without re-dispatching (S2B-004).

The command rides a COMMAND_TYPE_META_COMMAND catalog envelope. When the apply path refused the command, the typed MetaRejectionReason is returned (and journaled in state); the raft entry itself committed normally.

Source

pub fn state(&self) -> MetaState

A point-in-time clone of the replicated meta state at this node’s applied watermark. For a linearizable view, run ConsensusGroup::read_index (via MetaGroup::group) first.

Source

pub async fn allocate_raft_node_ids( &self, count: u32, control: &ExecutionControl, ) -> Result<Vec<RaftNodeId>, MetaError>

Allocates count fresh per-group raft node ids from the meta-owned allocator (spec section 12.1), returning them in ascending order. Tablet replica raft ids come from this allocator — never the ad-hoc node-id projection the meta group itself uses (see MetaCommand::AllocateRaftNodeIds). The allocation is idempotent under its command id and durable in replicated state, so ids are never reused across failovers and restarts.

Source

pub fn metadata_version(&self) -> MetadataVersion

The local applied watermark (monotonic per applied command).

Source

pub async fn shutdown(&self) -> Result<(), MetaError>

Graceful shutdown of the underlying group.

Source

pub async fn crash(self)

Process-free crash simulation: stops the raft task without the graceful storage close (see ConsensusGroup::crash); everything fsynced survives, which is exactly the split/merge crash-resume contract.

Auto Trait Implementations§

§

impl<T> !Freeze for MetaGroup<T>

§

impl<T> !RefUnwindSafe for MetaGroup<T>

§

impl<T> !UnwindSafe for MetaGroup<T>

§

impl<T> Send for MetaGroup<T>

§

impl<T> Sync for MetaGroup<T>

§

impl<T> Unpin for MetaGroup<T>

§

impl<T> UnsafeUnpin for MetaGroup<T>

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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