pub trait CoordinationService<Clock: Stopwatch, Message: Clone + Debug, Members, Metadata> {
    // Required methods
    fn new(id: SystemNodeId, metadata: Metadata) -> Self;
    fn leader(&self) -> Option<SystemNodeId>;
    fn get_state(&self) -> SystemState;
    fn get_current_rule(&self) -> Option<Rule>;
    fn update_rule(
        &mut self,
        communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
        new_rule: Rule
    );
    fn update_members(
        &mut self,
        communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
        new_config: UpdateClusterVec
    );
    fn update_state(
        &mut self,
        communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
        measurement: Measurement
    );
    fn process(
        &mut self,
        communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
        package: Option<CoordinationPackage<Message>>,
        members: Members
    );
}
Expand description

This is the main abstraction to be implemented by any coordination algorithm.

Required Methods§

source

fn new(id: SystemNodeId, metadata: Metadata) -> Self

source

fn leader(&self) -> Option<SystemNodeId>

Returns the ID of the cluster leader, or None if it is not set.

source

fn get_state(&self) -> SystemState

Returns the coordinated state of the system

source

fn get_current_rule(&self) -> Option<Rule>

Returns the current rule coordinated by the system

source

fn update_rule( &mut self, communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>, new_rule: Rule )

Updates the nodes in the cluster based on [new_config].

source

fn update_members( &mut self, communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>, new_config: UpdateClusterVec )

Updates the nodes in the cluster based on [new_config].

source

fn update_state( &mut self, communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>, measurement: Measurement )

Updates the coordinated state of the system based on measurement

source

fn process( &mut self, communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>, package: Option<CoordinationPackage<Message>>, members: Members )

Receives a message from another node so that the coordination can occur.

Object Safety§

This trait is not object safe.

Implementors§