Trait caminos_lib::pattern::Pattern
source · pub trait Pattern: Quantifiable + Debug {
// Required methods
fn initialize(
&mut self,
source_size: usize,
target_size: usize,
topology: &dyn Topology,
rng: &mut StdRng
);
fn get_destination(
&self,
origin: usize,
topology: &dyn Topology,
rng: &mut 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 groupings.
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§
sourcefn initialize(
&mut self,
source_size: usize,
target_size: usize,
topology: &dyn Topology,
rng: &mut StdRng
)
fn initialize( &mut self, source_size: usize, target_size: usize, topology: &dyn Topology, rng: &mut StdRng )
Fix the input and output size, providing the topology and random number generator. Careful with using topology 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 routers 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.