[−][src]Module xaynet_server::state_machine
The state machine that controls the execution of the PET protocol.
Overview
The StateMachine
is responsible for executing the individual tasks of the PET protocol.
The main tasks include: building the sum and seed dictionaries, aggregating the masked
models, determining the applicable mask and unmasking the global masked model.
Furthermore, the StateMachine
publishes protocol events and handles protocol errors.
The StateMachine
as well as the PET settings can be configured in the config file.
See here for more details.
Phase states
Idle
Publishes PhaseName::Idle
, increments the round id
by 1
, invalidates the
SumDict
, SeedDict
, scalar
and mask length
, updates the EncryptKeyPair
,
thresholds
as well as the seed
and publishes the EncryptKeyPair
and the
RoundParameters
.
Sum
Publishes PhaseName::Sum
, builds and publishes the SumDict
, ensures that enough sum
messages have been submitted and initializes the SeedDict
.
Update
Publishes PhaseName::Update
, builds and publishes the SeedDict
, ensures that enough
update messages have been submitted and aggregates the masked model.
Sum2
Publishes PhaseName::Sum2
, builds the mask dictionary, ensures that enough sum2
messages have been submitted and determines the applicable mask for unmasking the global
masked model.
Unmask
Publishes PhaseName::Unmask
, unmasks the global masked model and publishes the global
model.
Error
Publishes PhaseName::Error
and handles PhaseStateError
s that can occur during the
execution of the StateMachine
. In most cases, the error is handled by restarting the round.
However, if a PhaseStateError::RequestChannel
occurs, the StateMachine
will shut down.
Shutdown
Publishes PhaseName::Shutdown
and shuts down the StateMachine
. During the shutdown,
the StateMachine
performs a clean shutdown of the Request channel by
closing it and consuming all remaining messages.
Requests
By initiating a new StateMachine
via StateMachineInitializer::init()
, a new
StateMachineRequest channel is created, the function of which is to send
StateMachineRequest
s to the StateMachine
. The sender half of that channel
(RequestSender
) is returned back to the caller of
StateMachineInitializer::init()
, whereas the receiver half (RequestReceiver
)
is used by the StateMachine
.
See here for more details.
Events
During the execution of the PET protocol, the StateMachine
will publish various events
(see Phase states). Everyone who is interested in the events can subscribe to the respective
events via the EventSubscriber
. An EventSubscriber
is automatically created when a new
StateMachine
is created through StateMachineInitializer::init()
.
See here for more details.
Re-exports
pub use self::initializer::StateMachineInitializer; |
Modules
coordinator | Coordinator state and round parameter types. |
events | This module provides the |
initializer | A state machine initializer. |
phases | This module provides the |
requests | This module provides the the |
Enums
RequestError | Error returned when the state machine fails to handle a request |
StateMachine | The state machine with all its states. |
Type Definitions
StateMachineResult |