RateCounter

Structin erlfastly 0.13.1View source
pub struct RateCounter { /* private fields */ }

A rate counter that can be used with a edge rate limiter or stand alone for counting and rate calculations

Methods

increment

View source
fn increment(&self, entry: &str, delta: u32) -> Result<(), ERLError>

Increment an entry in the ratecounter by delta.

Parameters

self: &Self
entry: &str
delta: u32

Returns

lookup_count

View source
fn lookup_count(&self, entry: &str, duration: CounterDuration) -> Result<u32, ERLError>

Lookup the current count for entry in the ratecounter for duration.

Parameters

self: &Self
entry: &str
duration: CounterDuration

Returns

lookup_rate

View source
fn lookup_rate(&self, entry: &str, window: RateWindow) -> Result<u32, ERLError>

Lookup the current rate for entry in the ratecounter for a window.

Parameters

self: &Self
entry: &str
window: RateWindow

Returns

fn open(ratecounter_name: &str) -> Self

Open a RateCounter with the given name for a ratecounter.

Parameters

ratecounter_name: &str

Returns

Self

Auto trait implementations

Blanket implementations