View Source esockd_limiter (esockd v5.9.3-rc.1)

A simple ets-based rate limit server.

Link to this section Summary

Link to this section Types

-type bucket_info() ::
    #{name => bucket_name(),
      capacity => pos_integer(),
      interval => pos_integer(),
      tokens => pos_integer(),
      lasttime => integer()}.
-type bucket_name() :: term().

Link to this section Functions

Link to this function

code_change(OldVsn, State, Extra)

View Source
-spec consume(bucket_name()) -> {Remaing :: integer(), PasueMillSec :: integer()}.
Link to this function

consume(Tokens, Limiter)

View Source
-spec create(bucket_name(), pos_integer()) -> ok.
Link to this function

create(Name, Capacity, Interval)

View Source
-spec create(bucket_name(), pos_integer(), pos_integer()) -> ok.
-spec delete(esockd_generic_limiter:limter()) -> ok;
      (bucket_name()) -> ok.
-spec get_all() -> [bucket_info()].
Link to this function

handle_call(Req, From, State)

View Source
Link to this function

handle_info(Info, State)

View Source
-spec lookup(bucket_name()) -> undefined | bucket_info().
-spec start_link() -> {ok, pid()}.
-spec stop() -> ok.
Link to this function

terminate(Reason, State)

View Source