Skip to main content

RoutingPolicy

Trait RoutingPolicy 

Source
pub trait RoutingPolicy<Ref, M>: Debug {
    // Required methods
    fn route(&self, members: &[&Ref], msg: M, logger: &Logger<Arc<Fuse<Async>>>);
    fn boxed_clone(&self) -> Box<dyn RoutingPolicy<Ref, M> + Send + Sync>;
    fn broadcast(&self) -> Option<&(dyn RoutingPolicy<Ref, M> + Send + Sync)>;
    fn select(&self) -> Option<&(dyn RoutingPolicy<Ref, M> + Send + Sync)>;
}
Expand description

A routing policy described how to route a given msg over a given set of members

Required Methods§

Source

fn route(&self, members: &[&Ref], msg: M, logger: &Logger<Arc<Fuse<Async>>>)

Route the msg to the appropriate members

A logger should be provided to allow debugging and handle potential routing errors.

Source

fn boxed_clone(&self) -> Box<dyn RoutingPolicy<Ref, M> + Send + Sync>

Create a boxed copy of this policy

Used to make trait objects of this policy cloneable

Source

fn broadcast(&self) -> Option<&(dyn RoutingPolicy<Ref, M> + Send + Sync)>

Provide the broadcast part of this policy, if any

Source

fn select(&self) -> Option<&(dyn RoutingPolicy<Ref, M> + Send + Sync)>

Provide the select part of this policy, if any

Implementors§