ERL

Classin erlcompute-sdk-cpp 0.7.0View source

Include fastly/erl.h to use this class.

Constructor

fastly::erl::ERL::ERL(RateCounter rate_counter, PenaltyBox penalty_box)

Parameters

rate_counter: RateCounter
penalty_box: PenaltyBox

Methods

check_rate

View source
tl::expected<bool, ERLError> fastly::erl::ERL::check_rate(std::string_view entry, std::uint32_t delta, RateWindow window, std::uint32_t limit, std::chrono::minutes ttl) const

Increment an entry in a rate counter and check if the client has exceeded some average number of requests per second (RPS) over the window. If the client is over the rps limit for the window, add to the penaltybox for ttl. Valid ttl span is 1m to 1h.

Parameters

entry: std::string_view
delta: std::uint32_t
window: RateWindow
limit: std::uint32_t
ttl: std::chrono::minutes

Returns

tl::expected<bool, ERLError>

penalty_box

View source
const PenaltyBox & fastly::erl::ERL::penalty_box() const

Returns

const PenaltyBox &

rate_counter

View source
const RateCounter & fastly::erl::ERL::rate_counter() const

Returns

const RateCounter &