Resource

penalty-box

A penaltybox that can be used with the edge rate limiter or standalone for adding and checking if some entry is in the data set.

resource penalty-box;

F get-name

get-name: func() -> string;

Returns the name of this penaltybox.

F add

add: func(entry: string, ttl: u32) -> result​<_, error>;

Adds entry to the penaltybox for the duration of ttl.

Valid ttl span is 1m to 1h and TTL value is truncated to the nearest minute.

F has

has: func(entry: string) -> result​<bool, error>;

Checks if entry is in the penaltybox.

F open

open: func(name: string) -> result​<penalty-box, open-error>;

Opens a penalty-box identified by the given name.

The name must not exceed 1024 bytes in length. If the name is too long, open-error::name-too-long will be returned.