Fastly Compute C++ SDK
Loading...
Searching...
No Matches
fastly::erl::RateCounter Class Reference

#include <erl.h>

Public Member Functions

 RateCounter (std::string name)
tl::expected< void, ERLErrorincrement (std::string_view entry, std::uint32_t delta)
 Increment an entry in the ratecounter by delta.
tl::expected< std::uint32_t, ERLErrorlookup_rate (std::string_view entry, RateWindow window) const
 Lookup the current rate for entry in the rate counter for a window.
tl::expected< std::uint32_t, ERLErrorlookup_count (std::string_view entry, CounterDuration duration) const
 Lookup the current count for entry in the rate counter for a duration.
std::string_view name () const

Detailed Description

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

Examples
erl.cpp.

Constructor & Destructor Documentation

◆ RateCounter()

fastly::erl::RateCounter::RateCounter ( std::string name)
inlineexplicit

Member Function Documentation

◆ increment()

tl::expected< void, ERLError > fastly::erl::RateCounter::increment ( std::string_view entry,
std::uint32_t delta )

Increment an entry in the ratecounter by delta.

◆ lookup_count()

tl::expected< std::uint32_t, ERLError > fastly::erl::RateCounter::lookup_count ( std::string_view entry,
CounterDuration duration ) const

Lookup the current count for entry in the rate counter for a duration.

◆ lookup_rate()

tl::expected< std::uint32_t, ERLError > fastly::erl::RateCounter::lookup_rate ( std::string_view entry,
RateWindow window ) const

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

Examples
erl.cpp.

◆ name()

std::string_view fastly::erl::RateCounter::name ( ) const
inline

The documentation for this class was generated from the following file: