Skip to main content

PlacementControlPlane

Struct PlacementControlPlane 

Source
pub struct PlacementControlPlane { /* private fields */ }
Expand description

The controller.

Implementations§

Source§

impl PlacementControlPlane

Source

pub fn with_kind_registry(self, kinds: KindRegistry) -> Self

Replace the workload-kind registry (default: KindRegistry::builtin).

Source

pub fn new( key: SigningKey, gate: Arc<dyn GateBackend>, chain: Arc<ChainManager>, exchange: Arc<ArtifactExchange>, anchors: TrustAnchors, connector: Arc<dyn CtlConnector>, ) -> Self

Controller for the node owning key. Every decision is chained.

Source

pub fn with_membership(self, m: Arc<ClusterMembership>) -> Self

Use membership peer state for liveness.

Source

pub fn with_config(self, cfg: PlaneConfig) -> Self

Replace the tunables.

Source

pub fn node_id(&self) -> &str

This controller’s node id.

Source

pub fn targets(&self) -> Vec<TargetInfo>

Known targets.

Source

pub fn hosts(&self) -> Vec<ServiceAdvertisement>

Nodes advertising workload-host.

Source

pub fn placements(&self) -> Vec<PlacementRecord>

Placed instances.

Source

pub fn view(&self) -> Vec<LiveNodeFacts>

The verified facts the engine will see, with liveness. Runtimes a node has no adapter route for are hidden (a node without a workload-host advertisement offers none).

Source

pub async fn add_target( &self, addr: &str, tier: FactsTier, ) -> Result<String, PlaneError>

Learn (or refresh) the target at addr: signed describe, verify and cache its signed facts under tier, merge its advertisement. Returns its node id. Whatever key answers is accepted (first use); see Self::add_target_expecting to require a key.

Source

pub async fn add_target_expecting( &self, addr: &str, tier: FactsTier, expect: Option<[u8; 32]>, ) -> Result<String, PlaneError>

Self::add_target, refusing any answer not signed by expect when given. Trust is bound to the node key: an operator tier is only ever given to the key the operator pinned, or to the key first seen at that address, never to whoever answers there later.

Source

pub async fn refresh(&self)

Re-describe every known target, requiring the key it was learned with; unreachable ones are marked so the engine sees them as not alive. A node whose address now answers with another key (it was replaced, or someone else took the address) is marked unreachable and the new key is not learned: it gets no tier until the operator pins it (OperatorPeer::key).

Source

pub async fn call( &self, node_id: &str, m: &str, decision_id: Option<String>, body: Value, ) -> Result<Value, PlaneError>

A signed call to a known node (no payload serving).

Source§

impl PlacementControlPlane

Source

pub async fn node_admin( &self, node_id: &str, m: &str, body: Value, ) -> Result<Value, PlaneError>

Send node-admin method m to node_id and return its result.

Source§

impl PlacementControlPlane

Source

pub fn set_tier(&self, node_id: &str, tier: FactsTier) -> bool

Set the operator-assigned tier of a known target (targets map and facts cache). False if the node is not known.

Source

pub async fn apply_operator_peers( &self, peers: &[OperatorPeer], keep: &[&str], ) -> Vec<(String, PlaneError)>

Make the known targets match the operator’s peers. Returns one error per peer that could not be learned (it is retried on the next sync).

Source§

impl PlacementControlPlane

Source

pub fn lifecycle_of(&self, instance_id: &str) -> Option<LifecycleState>

Lifecycle state the controller holds for instance_id.

Source

pub fn life_summary(&self, instance_id: &str) -> Option<Value>

{state, restarts, reschedules, has_error} the controller holds for instance_id; in memory only, no peer is contacted. The error text is withheld (it can carry paths and peer detail).

Source

pub async fn lifecycle_tick(&self) -> Vec<LifecycleEvent>

One pass of the controller lifecycle; see the module docs.

Source

pub fn spawn_lifecycle(self: &Arc<Self>, period: Duration) -> JoinHandle<()> ⓘ

Run Self::lifecycle_tick every period for as long as the runtime lives.

Source§

impl PlacementControlPlane

Source

pub async fn place(&self, order: &PlaceOrder) -> Result<PlaceReport, PlaneError>

Decide (and unless dry_run, dispatch) one placement, with the default lifecycle policy (see Self::place_with).

Source

pub async fn place_with( &self, order: &PlaceOrder, policy: LifecyclePolicy, ) -> Result<PlaceReport, PlaneError>

Self::place, recording what the lifecycle needs to reschedule the instance if its node is lost: the order, and policy (whether it may move at all).

Source

pub async fn instance( &self, m: &str, instance_id: &str, ) -> Result<Value, PlaneError>

Gate an instance transition on the controller (chained) and send it.

Source§

impl PlacementControlPlane

Source

pub fn unsettled(&self) -> Vec<PlacementRecord>

Decisions still unsettled.

Source

pub async fn settle_unsettled(&self) -> usize

Ask each target holding an unsettled decision what became of it: adopt the instances it produced (chained as adopted), forget it if it produced none, keep it while in flight or unreachable. Returns the number of instances adopted.

Source§

impl PlacementControlPlane

Source

pub fn add_seed( &self, node_id: &str, host: Arc<WorkloadHost>, tier: TrustTier, ) -> Result<(), PlaneError>

Register a Seed adapter under its operator-assigned node id and trust tier (governance sees that tier, not a default).

Source

pub async fn place_store_pin( &self, o: &StorePinOrder, ) -> Result<PlacementRecord, PlaneError>

Place an operator-pinned store cog on a Seed. Pinned by construction: the node is the operator-assigned id.

Source§

impl PlacementControlPlane

Source

pub fn with_state_file( self, path: impl Into<PathBuf>, ) -> Result<Self, PlaneError>

Persist to path after every change, restoring what it holds now. A missing file starts empty; a malformed one is refused (the caller decides; nothing is overwritten).

Source

pub fn forget_instances(&self, ids: &[String]) -> usize

Drop the controller’s records of ids (instances a revocation took down on this node, see super::host_revoke), and their Seed handles, and save. Returns how many records were removed.

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> 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> 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, 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> 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> Pointee for T

Source§

type Pointer = u32

Source§

fn debug( pointer: <T as Pointee>::Pointer, f: &mut Formatter<'_>, ) -> Result<(), Error>

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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