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>
impl<'c> Handover<'c>
pub fn new(ctx: &'c ServiceContext) -> Handover<'c>
Sourcepub fn is_successor(&self) -> bool
pub fn is_successor(&self) -> bool
Was this program started to take over from a running version of itself?
Sourcepub fn offer(&mut self, msg: &Message) -> Option<Offer>
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.
Sourcepub fn hand_over(
&self,
offer: Offer,
state: &[u8],
drain: impl FnMut(Message),
) -> !
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.
Sourcepub fn take_over<'b>(&mut self, buf: &'b mut [u8; 4084]) -> Option<TakeOver<'b>>
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.