Skip to main content

ControlPlane

Struct ControlPlane 

Source
pub struct ControlPlane { /* private fields */ }

Implementations§

Source§

impl ControlPlane

Source

pub fn submit( &mut self, command: ControlCommand, ts: u64, ) -> Result<AuditRecord, ControlError>

Source

pub fn submit_as( &mut self, command: ControlCommand, granted: Permission, ts: u64, ) -> Result<AuditRecord, ControlError>

带服务端授权上下文的提交入口。API/Worker 应优先使用此方法。

Source

pub fn command(&self, command_id: u64) -> Option<&ControlCommand>

Source

pub fn audit(&self) -> &[AuditRecord]

Source

pub fn audit_page( &self, cursor: Option<&str>, limit: usize, request_id: Option<&str>, ) -> Result<ControlAuditPageV1, &'static str>

Return a bounded newest-first page from a stable append-sequence snapshot. The cursor freezes the upper sequence on the first request, so new commands cannot extend a scan.

Source

pub fn strategy_lifecycle( &self, worker_id: &str, ) -> Option<&StrategyLifecycleRecord>

Source

pub fn strategy_pause_state(&self, worker_id: &str) -> Option<bool>

Legacy snapshots with retired audit cannot prove the last lifecycle state. Start unrecorded workers paused until an explicit resume establishes it.

Source

pub fn pending(&self) -> impl Iterator<Item = &ControlCommand>

待办命令。判据与 execute 的 AlreadyFinal 同一口径:终态审计记录一旦落下, 这条命令就不再是待办。

终态集合每次现算一遍:调用方是四个 worker 的轮询循环,而 audit 只追加不退场, 逐条命令回扫整段审计会把每轮轮询打成 O(commands × audit)(V13 R1-D)。

Source

pub fn pending_commands_count(&self) -> u64

Number of accepted commands awaiting a terminal outcome.

Source

pub fn retirement(&self) -> RetirementSummary

累计退场摘要。/metrics 读它,运维因此能看见「控制面确实被压回上界之内」。

Source

pub fn execute<F>( &mut self, command_id: u64, ts: u64, action: F, ) -> Result<AuditRecord, ControlError>

执行器唯一的状态入口:执行结果必须回写审计记录,不能只返回字符串。

Source

pub fn to_json(&self) -> Result<String, String>

Source

pub fn from_json(input: &str) -> Result<Self, String>

Trait Implementations§

Source§

impl Clone for ControlPlane

Source§

fn clone(&self) -> Self

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 Default for ControlPlane

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ControlPlane

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 Serialize for ControlPlane

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

Auto Trait Implementations§

§

impl Forget for ControlPlane

§

impl Freeze for ControlPlane

§

impl Move for ControlPlane

§

impl RefUnwindSafe for ControlPlane

§

impl Send for ControlPlane
where NodeRef<Owned, u64, ControlCommand, LeafOrInternal>: Send, BoxRaw<(u64, ControlCommand)>: Send, NodeRef<Owned, String, u64, LeafOrInternal>: Send, BoxRaw<(String, u64)>: Send, RawVecInner: Send, NodeRef<Owned, u64, Vec<u64>, LeafOrInternal>: Send, BoxRaw<(u64, Vec<u64>)>: Send, NodeRef<Owned, String, StrategyLifecycleRecord, LeafOrInternal>: Send, BoxRaw<(String, StrategyLifecycleRecord)>: Send,

§

impl Sync for ControlPlane
where NodeRef<Owned, u64, ControlCommand, LeafOrInternal>: Sync, BoxRaw<(u64, ControlCommand)>: Sync, NodeRef<Owned, String, u64, LeafOrInternal>: Sync, BoxRaw<(String, u64)>: Sync, RawVecInner: Sync, NodeRef<Owned, u64, Vec<u64>, LeafOrInternal>: Sync, BoxRaw<(u64, Vec<u64>)>: Sync, NodeRef<Owned, String, StrategyLifecycleRecord, LeafOrInternal>: Sync, BoxRaw<(String, StrategyLifecycleRecord)>: Sync,

§

impl Unpin for ControlPlane
where *const LeafNode<u64, ControlCommand> is !null: Unpin, Box<(u64, ControlCommand)>: Unpin, *const LeafNode<String, u64> is !null: Unpin, Box<(String, u64)>: Unpin, *const u8 is !null: Unpin, *const LeafNode<u64, Vec<u64>> is !null: Unpin, Box<(u64, Vec<u64>)>: Unpin, *const LeafNode<String, StrategyLifecycleRecord> is !null: Unpin, Box<(String, StrategyLifecycleRecord)>: Unpin,

§

impl UnsafeUnpin for ControlPlane

§

impl UnwindSafe for ControlPlane

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

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

fn try_from(value: U) -> Result<T, !>

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.