Skip to main content

Module modula

Module modula 

Source
Expand description

Modula distribution: each live server contributes a number of continuum slots equal to its weight, and dispatch is hash % ncontinuum.

§Examples

use dynomite::hashkit::modula::{Continuum, ServerSpec};
let c = Continuum::build(&[
    ServerSpec { name: "a".into(), weight: 1 },
    ServerSpec { name: "b".into(), weight: 1 },
]).unwrap();
assert_eq!(c.dispatch(0).unwrap(), 0);
assert_eq!(c.dispatch(1).unwrap(), 1);

Structs§

Continuum
Sorted-by-server-order continuum.
ServerSpec
Specification for one server in modula mode.
Slot
One continuum slot: weight unit -> server index.