Trait caminos_lib::pattern::Pattern[][src]

pub trait Pattern: Quantifiable + Debug {
    fn initialize(
        &mut self,
        source_size: usize,
        target_size: usize,
        topology: &Box<dyn Topology>,
        rng: &RefCell<StdRng>
    );
fn get_destination(
        &self,
        origin: usize,
        topology: &Box<dyn Topology>,
        rng: &RefCell<StdRng>
    ) -> usize; }
Expand description

A Pattern describes how a set of entities decides destinations into another set of entities. The entities are initially servers, but after some operators it may mean router, rows/columns, or other agrupations. The source and target set may be or not be the same. Or even be of different size. Thus, a Pattern is a generalization of the mathematical concept of function.

Required methods

Fix the input and output size, providing the topology and random number generator. Careful with using toology in sub-patterns. For example, it may be misleading to use the dragonfly topology when building a pattern among groups or a pattern among the ruters of a single group. Even just a pattern of routers instead of a pattern of servers can lead to mistakes. Read the documentation of the traffic or meta-pattern using the pattern to know what its their input and output.

Obtain a destination of a source. This will be called repeteadly as the traffic requires destination for its messages.

Implementors