Skip to main content

Handover

Struct Handover 

Source
pub struct Handover<'c> { /* private fields */ }
Expand description

One service’s side of handovers: its key, and how many wrong offers it has seen.

Implementations§

Source§

impl<'c> Handover<'c>

Source

pub fn new(ctx: &'c ServiceContext) -> Handover<'c>

Source

pub fn is_successor(&self) -> bool

Was this program started to take over from a running version of itself?

Source

pub fn offer(&mut self, msg: &Message) -> Option<Offer>

Is msg the supervisor’s offer for THIS version? None for an ordinary message, and for an offer that does not carry this version’s key, which is counted: after WRONG_MAX of them no offer is taken at all.

Source

pub fn hand_over( &self, offer: Offer, state: &[u8], drain: impl FnMut(Message), ) -> !

Hand over and end: every message already queued goes to drain first (they were sent to this version, so this version answers them), then the state goes to the successor with its key, then this program ends with status 0. A successor that cannot be reached is said, and this version ends all the same: the successor holds the name.

Source

pub fn take_over<'b>(&mut self, buf: &'b mut [u8; 4084]) -> Option<TakeOver<'b>>

Take over, if this is a successor: wait up to TAKE_SECS for the running version’s state - carrying this successor’s key - keeping up to EARLY_MAX ordinary messages that arrive first. None for a program that is not a successor, and for one whose state did not come in time, which is said: it starts fresh, as a restart would. A state with the wrong key is refused, and after WRONG_MAX of them none is taken.

Auto Trait Implementations§

§

impl<'c> Freeze for Handover<'c>

§

impl<'c> RefUnwindSafe for Handover<'c>

§

impl<'c> Send for Handover<'c>

§

impl<'c> Sync for Handover<'c>

§

impl<'c> Unpin for Handover<'c>

§

impl<'c> UnsafeUnpin for Handover<'c>

§

impl<'c> UnwindSafe for Handover<'c>

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