1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::lib::*;

/// Gives additional information about the negative outcome of a batch
/// cell decision.
///
/// Since batch queries can be made for batch sizes bigger than the
/// rate limiter parameter could accomodate, there are now two
/// possible negative outcomes:
///
///   * `BatchNonConforming` - the query is valid but the Decider can
///     not accomodate them.
///
///   * `InsufficientCapacity` - the query was invalid as the rate
///     limite parameters can never accomodate the number of cells
///     queried for.
#[derive(Debug, PartialEq)]
pub enum NegativeMultiDecision<E: fmt::Display> {
    /// A batch of cells (the first argument) is non-conforming and
    /// can not be let through at this time. The second argument gives
    /// information about when that batch of cells might be let
    /// through again (not accounting for thundering herds and other,
    /// simultaneous decisions).
    BatchNonConforming(u32, E),

    /// The number of cells tested (the first argument) is larger than
    /// the bucket's capacity, which means the decision can never have
    /// a conforming result. The argument gives the maximum number of
    /// cells that could ever have a conforming result.
    InsufficientCapacity(u32),
}