Trait dcs2::coordination::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§
fn new(id: SystemNodeId, metadata: Metadata) -> Self
sourcefn leader(&self) -> Option<SystemNodeId>
fn leader(&self) -> Option<SystemNodeId>
Returns the ID of the cluster leader, or None if it is not set.
sourcefn get_state(&self) -> SystemState
fn get_state(&self) -> SystemState
Returns the coordinated state of the system
sourcefn get_current_rule(&self) -> Option<Rule>
fn get_current_rule(&self) -> Option<Rule>
Returns the current rule coordinated by the system
sourcefn update_rule(
&mut self,
communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
new_rule: Rule
)
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
].
sourcefn update_members(
&mut self,
communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
new_config: UpdateClusterVec
)
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
].
sourcefn update_state(
&mut self,
communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
measurement: Measurement
)
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
sourcefn process(
&mut self,
communication_service: &mut dyn CommunicationService<Package<SystemNodeId, Message>>,
package: Option<CoordinationPackage<Message>>,
members: Members
)
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.