CoordinationService

Trait CoordinationService 

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§