pub struct ControlPlane { /* private fields */ }Implementations§
Source§impl ControlPlane
impl ControlPlane
pub fn submit( &mut self, command: ControlCommand, ts: u64, ) -> Result<AuditRecord, ControlError>
Sourcepub fn submit_as(
&mut self,
command: ControlCommand,
granted: Permission,
ts: u64,
) -> Result<AuditRecord, ControlError>
pub fn submit_as( &mut self, command: ControlCommand, granted: Permission, ts: u64, ) -> Result<AuditRecord, ControlError>
带服务端授权上下文的提交入口。API/Worker 应优先使用此方法。
pub fn command(&self, command_id: u64) -> Option<&ControlCommand>
pub fn audit(&self) -> &[AuditRecord]
Sourcepub fn audit_page(
&self,
cursor: Option<&str>,
limit: usize,
request_id: Option<&str>,
) -> Result<ControlAuditPageV1, &'static str>
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.
pub fn strategy_lifecycle( &self, worker_id: &str, ) -> Option<&StrategyLifecycleRecord>
Sourcepub fn strategy_pause_state(&self, worker_id: &str) -> Option<bool>
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.
Sourcepub fn pending(&self) -> impl Iterator<Item = &ControlCommand>
pub fn pending(&self) -> impl Iterator<Item = &ControlCommand>
待办命令。判据与 execute 的 AlreadyFinal 同一口径:终态审计记录一旦落下,
这条命令就不再是待办。
终态集合每次现算一遍:调用方是四个 worker 的轮询循环,而 audit 只追加不退场,
逐条命令回扫整段审计会把每轮轮询打成 O(commands × audit)(V13 R1-D)。
Sourcepub fn pending_commands_count(&self) -> u64
pub fn pending_commands_count(&self) -> u64
Number of accepted commands awaiting a terminal outcome.
Sourcepub fn retirement(&self) -> RetirementSummary
pub fn retirement(&self) -> RetirementSummary
累计退场摘要。/metrics 读它,运维因此能看见「控制面确实被压回上界之内」。
Sourcepub fn execute<F>(
&mut self,
command_id: u64,
ts: u64,
action: F,
) -> Result<AuditRecord, ControlError>
pub fn execute<F>( &mut self, command_id: u64, ts: u64, action: F, ) -> Result<AuditRecord, ControlError>
执行器唯一的状态入口:执行结果必须回写审计记录,不能只返回字符串。
pub fn to_json(&self) -> Result<String, String>
pub fn from_json(input: &str) -> Result<Self, String>
Trait Implementations§
Source§impl Clone for ControlPlane
impl Clone for ControlPlane
Source§impl Default for ControlPlane
impl Default for ControlPlane
Source§impl<'de> Deserialize<'de> for ControlPlane
impl<'de> Deserialize<'de> for ControlPlane
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for ControlPlane
impl Freeze for ControlPlanewhere
*const LeafNode<u64, ControlCommand> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(u64, ControlCommand)>>: Freeze,
*const LeafNode<String, u64> is !null: Freeze,
PhantomData<Box<(String, u64)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<AuditRecord>: Freeze,
PhantomData<u64>: Freeze,
*const LeafNode<u64, Vec<u64>> is !null: Freeze,
PhantomData<Box<(u64, Vec<u64>)>>: Freeze,
*const LeafNode<String, StrategyLifecycleRecord> is !null: Freeze,
PhantomData<Box<(String, StrategyLifecycleRecord)>>: Freeze,
impl Move for ControlPlane
impl RefUnwindSafe for ControlPlane
impl Send for ControlPlanewhere
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 ControlPlanewhere
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 ControlPlanewhere
*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 ControlPlanewhere
*const LeafNode<u64, ControlCommand> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(u64, ControlCommand)>>: UnsafeUnpin,
*const LeafNode<String, u64> is !null: UnsafeUnpin,
PhantomData<Box<(String, u64)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<AuditRecord>: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
*const LeafNode<u64, Vec<u64>> is !null: UnsafeUnpin,
PhantomData<Box<(u64, Vec<u64>)>>: UnsafeUnpin,
*const LeafNode<String, StrategyLifecycleRecord> is !null: UnsafeUnpin,
PhantomData<Box<(String, StrategyLifecycleRecord)>>: UnsafeUnpin,
impl UnwindSafe for ControlPlanewhere
BTreeMap<u64, ControlCommand>: UnwindSafe,
BTreeMap<String, u64>: UnwindSafe,
RawVecInner: UnwindSafe,
BTreeMap<u64, Vec<u64>>: UnwindSafe,
BTreeMap<String, StrategyLifecycleRecord>: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more