[−][src]Struct xaynet_server::state_machine::initializer::StateMachineInitializer
The state machine initializer that initializes a new state machine.
Implementations
impl<C, M> StateMachineInitializer<C, M> where
C: CoordinatorStorage,
M: ModelStorage,
[src]
C: CoordinatorStorage,
M: ModelStorage,
pub fn new(
pet_settings: PetSettings,
mask_settings: MaskSettings,
model_settings: ModelSettings,
#[cfg(feature = "model-persistence")]
restore_settings: RestoreSettings,
store: Store<C, M>
) -> Self
[src]
pet_settings: PetSettings,
mask_settings: MaskSettings,
model_settings: ModelSettings,
#[cfg(feature = "model-persistence")] restore_settings: RestoreSettings,
store: Store<C, M>
) -> Self
Creates a new StateMachineInitializer
.
impl<C, M> StateMachineInitializer<C, M> where
C: CoordinatorStorage,
M: ModelStorage,
[src]
C: CoordinatorStorage,
M: ModelStorage,
pub async fn init(
self
) -> Result<(StateMachine<C, M>, RequestSender, EventSubscriber), StateMachineInitializationError>
[src]
self
) -> Result<(StateMachine<C, M>, RequestSender, EventSubscriber), StateMachineInitializationError>
This is supported on crate feature
model-persistence
only.Initializes a new StateMachine
by trying to restore the previous coordinator state
along with the latest global model. After a successful initialization, the state machine
always starts from a new round. This means that the round id is increased by one.
If the state machine is reset during the initialization, the state machine starts
with the round id 1
.
Behavior
- If the [
RestoreSettings.enable
] flag is set tofalse
, the current coordinator state will be reset and a newStateMachine
is created with the given settings. - If no coordinator state exists, the current coordinator state will be reset and a new
StateMachine
is created with the given settings. - If a coordinator state exists but no global model has been created so far, the
StateMachine
will be restored with the coordinator state but without a global model. - If a coordinator state and a global model exists, the
StateMachine
will be restored with the coordinator state and the global model. - If a global model has been created but does not exists, the initialization will fail with
StateMachineInitializationError::GlobalModelUnavailable
. - If a global model exists but its properties do not match the coordinator model settings,
the initialization will fail with
StateMachineInitializationError::GlobalModelInvalid
. - Any network error will cause the initialization to fail.
Auto Trait Implementations
impl<C, M> RefUnwindSafe for StateMachineInitializer<C, M> where
C: RefUnwindSafe,
M: RefUnwindSafe,
[src]
C: RefUnwindSafe,
M: RefUnwindSafe,
impl<C, M> Send for StateMachineInitializer<C, M>
[src]
impl<C, M> Sync for StateMachineInitializer<C, M>
[src]
impl<C, M> Unpin for StateMachineInitializer<C, M> where
C: Unpin,
M: Unpin,
[src]
C: Unpin,
M: Unpin,
impl<C, M> UnwindSafe for StateMachineInitializer<C, M> where
C: UnwindSafe,
M: UnwindSafe,
[src]
C: UnwindSafe,
M: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,