Trait portus::CongAlg

source ·
pub trait CongAlg<I: Ipc> {
    type Flow: Flow;

    // Required methods
    fn name() -> &'static str;
    fn datapath_programs(&self) -> HashMap<&'static str, String>;
    fn new_flow(&self, control: Datapath<I>, info: DatapathInfo) -> Self::Flow;
}
Expand description

implement this trait, portus::CongAlgBuilder and portus::Flow to define a ccp congestion control algorithm.

  • CongAlg implements functionality which applies to a given algorithm as a whole
  • Flow implements functionality specific to an individual flow
  • CongAlgBuilder specifies how the trait that implements CongAlg should be built from given command-line arguments.

Required Associated Types§

source

type Flow: Flow

A type which implements the portus::Flow trait, to manage an individual connection.

Required Methods§

source

fn name() -> &'static str

A unique name for the algorithm.

source

fn datapath_programs(&self) -> HashMap<&'static str, String>

datapath_programs returns all datapath programs the congestion control algorithm will to use during its execution. It is called once, when Portus initializes (portus::run or portus::spawn).

It should return a vector of string tuples, where the first string in each tuple is a unique name identifying the program, and the second string is the code for the program itself.

The Portus runtime will panic if any of the datapath programs do not compile.

For example,

use std::collections::HashMap;
let mut h = HashMap::new();
h.insert("prog1", "...(program)...".to_string());
h.insert("prog2", "...(program)...".to_string());
source

fn new_flow(&self, control: Datapath<I>, info: DatapathInfo) -> Self::Flow

Create a new instance of the CongAlg to manage a new flow. Optionally copy any configuration parameters from &self.

Implementations on Foreign Types§

source§

impl<T, I> CongAlg<I> for &Twhere I: Ipc, T: CongAlg<I>,

§

type Flow = <T as CongAlg<I>>::Flow

source§

fn name() -> &'static str

source§

fn datapath_programs(&self) -> HashMap<&'static str, String>

source§

fn new_flow(&self, control: Datapath<I>, info: DatapathInfo) -> Self::Flow

Implementors§