Skip to main content

Owner

Struct Owner 

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

One config.v2 owner, as a pure state machine over super::Owner, which runs config.v1’s rules unchanged with its times rounded up to the second (super::Owner::whole_seconds).

It adds the wire (§2.3 to §2.17): it puts its record whenever a field of it changes, and only then; it answers every call with the record in the value form, or a refusal in the error form, under its as-of mark; it publishes each change’s event after the reply; it mints 48-bit tokens, a new run before the counter passes 65,535; and it replays an idempotent retry’s first answer byte for byte.

Implementations§

Source§

impl Owner

Source

pub fn start( iface: Interface, s: Start, mint: &mut dyn Mint, ) -> Result<(Self, Output), StartError>

Starts an owner (§2.3): its instance number is the run mint writes under, and its first put is its record, before its tokens.

§Errors

config.v1’s StartErrors, and a floor of 0.

Source

pub fn restart(&self, mint: &mut dyn Mint) -> (Self, Output)

The owner after a restart (§2.12): a new instance under the next run mint takes, its startup values and persisted layer, nothing pending, no key held.

Source

pub fn restart_in(&self, mint: &mut dyn Mint) -> (Self, Output)

Owner::restart in a new instance that took its run already, as a re-mint does (v1 §2.12, “A re-mint is a restart”; core §1.5, §4.3): its instance number is the run mint writes under now, under which nothing was written yet.

Source

pub fn restart_plan(&self) -> Result<Vec<Restore>, (String, String)>

What a re-mint returns the device to first (v1 §2.12, “A re-mint is a restart”): config.v1’s super::Owner::restart_plan of the owner this one runs.

§Errors

(group, parameter) of a parameter with a running value and no startup value.

Source

pub fn interface(&self) -> &Interface

The config interface.

Source

pub fn inner(&self) -> &Owner

config.v1’s owner this one runs: its startup values, its due instants and its published events.

Source

pub fn instance(&self) -> u32

The instance number.

Source

pub fn epoch(&self) -> i64

The deployment epoch its times count from, in seconds.

Source

pub fn in_flight(&self) -> bool

Whether an act is in flight.

Source

pub fn next_due(&self) -> Option<Time>

The next instant Owner::due has something to do.

Source

pub fn state(&self) -> State

The record as it stands.

Source

pub fn set( &mut self, now: Time, group: &str, payload: &[u8], call: &Call, mint: &mut dyn Mint, ) -> Step

A call to set/<group> (§2.5, §2.9): the parse, an act in flight, a key held, then config.v1’s rows and its owner; answered now, or an Act::Apply for a hot group, answered by Owner::finish. A group with no set reaches no queryable: nothing answers.

Source

pub fn confirm( &mut self, now: Time, payload: &[u8], call: &Call, mint: &mut dyn Mint, ) -> Step

confirm (§2.10): answered now.

Source

pub fn cancel( &mut self, now: Time, payload: &[u8], call: &Call, mint: &mut dyn Mint, ) -> Step

cancel (§2.10): an Act::Undo when something of the change is applied, else answered now.

Source

pub fn extend( &mut self, now: Time, payload: &[u8], call: &Call, mint: &mut dyn Mint, ) -> Step

extend (§2.10): answered now, the deadline rounded up.

Source

pub fn persist( &mut self, now: Time, payload: &[u8], mint: &mut dyn Mint, ) -> Result<PersistPlan, Output>

Admits a persist (§2.13): without a persisted layer unavailable before the request is read, then the parse, then config.v1’s checks. The runtime writes the plan’s entries, then calls Owner::persisted.

§Errors

The refusal’s Output.

Source

pub fn persisted(&mut self, plan: PersistPlan, mint: &mut dyn Mint) -> Output

Commits a persist whose entries the runtime wrote: the record put when a source moved, then the reply.

Source

pub fn due(&mut self, now: Time, mint: &mut dyn Mint) -> Option<Step>

The act owed at now, if any (§2.9, §2.11): the deadline’s undo, or the earliest reach apply whose apply_at has come.

Source

pub fn finish( &mut self, now: Time, result: DeviceResult, mint: &mut dyn Mint, ) -> Step

Reports the device’s result for the act in flight, and answers what it owed.

Source

pub fn report_desired( &mut self, report: Option<DesiredReport>, mint: &mut dyn Mint, ) -> Output

Sets the desired report the record carries (§2.18), putting the record when it changed.

Source

pub fn converge(&self, doc: &DesiredConfig) -> Converge

What converging doc asks next (§2.18): config.v1’s, a revision above 32 bits refused whole, naming no group, before any group is read.

Source

pub fn published(&self, now: Time) -> Vec<Time>

The change events of the last hour, for the next instance.

Trait Implementations§

Source§

impl Clone for Owner

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 Debug for Owner

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Owner

§

impl Freeze for Owner

§

impl Move for Owner

§

impl RefUnwindSafe for Owner

§

impl Send for Owner
where RawVecInner: Send, &'static str: Send, NodeRef<Owned, String, Layout, LeafOrInternal>: Send, BoxRaw<(String, Layout)>: Send, NodeRef<Owned, String, String, LeafOrInternal>: Send, BoxRaw<(String, String)>: Send, NodeRef<Owned, (String, String), (Value, Source), LeafOrInternal>: Send, BoxRaw<((String, String), (Value, Source))>: Send, NodeRef<Owned, (String, String), Value, LeafOrInternal>: Send, BoxRaw<((String, String), Value)>: Send, NodeRef<Owned, (String, String), Slot, LeafOrInternal>: Send, BoxRaw<((String, String), Slot)>: Send, NodeRef<Owned, (String, String), EditRec, LeafOrInternal>: Send, BoxRaw<((String, String), EditRec)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, BoxRaw<ConfigView>: Send, BoxRaw<ConfigStatus>: Send, BoxRaw<State>: Send,

§

impl Sync for Owner
where RawVecInner: Sync, NodeRef<Owned, String, Layout, LeafOrInternal>: Sync, BoxRaw<(String, Layout)>: Sync, NodeRef<Owned, String, String, LeafOrInternal>: Sync, BoxRaw<(String, String)>: Sync, NodeRef<Owned, (String, String), (Value, Source), LeafOrInternal>: Sync, BoxRaw<((String, String), (Value, Source))>: Sync, NodeRef<Owned, (String, String), Value, LeafOrInternal>: Sync, BoxRaw<((String, String), Value)>: Sync, NodeRef<Owned, (String, String), Slot, LeafOrInternal>: Sync, BoxRaw<((String, String), Slot)>: Sync, NodeRef<Owned, (String, String), EditRec, LeafOrInternal>: Sync, BoxRaw<((String, String), EditRec)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, BoxRaw<ConfigView>: Sync, BoxRaw<ConfigStatus>: Sync, BoxRaw<State>: Sync,

§

impl Unpin for Owner
where *const u8 is !null: Unpin, &'static str: Unpin, *const LeafNode<String, Layout> is !null: Unpin, Box<(String, Layout)>: Unpin, *const LeafNode<String, String> is !null: Unpin, Box<(String, String)>: Unpin, *const LeafNode<(String, String), (Value, Source)> is !null: Unpin, Box<((String, String), (Value, Source))>: Unpin, *const LeafNode<(String, String), Value> is !null: Unpin, Box<((String, String), Value)>: Unpin, *const LeafNode<(String, String), Slot> is !null: Unpin, Box<((String, String), Slot)>: Unpin, *const LeafNode<(String, String), EditRec> is !null: Unpin, Box<((String, String), EditRec)>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, *const LeafNode<String, Value> is !null: Unpin, Box<(String, Value)>: Unpin, Box<ConfigView>: Unpin, Box<ConfigStatus>: Unpin, Box<State>: Unpin,

§

impl UnsafeUnpin for Owner

§

impl UnwindSafe for Owner

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

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

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.