emqtt_inflight (emqtt v1.15.1)

View Source

Summary

Types

id/0

-type id() :: term().

inflight/0

-type inflight() :: inflight(req()).

inflight/1

-type inflight(Req) ::
          #{max_inflight := maximum() | {maximum(), _Limit :: maximum()},
            sent := sent(Req),
            seq := seq_no()}.

maximum/0

-type maximum() :: infinity | pos_integer().

req/0

-type req() :: term().

sent/1

-type sent(Req) :: #{id() => {seq_no(), Req}}.

seq_no/0

-type seq_no() :: pos_integer().

Functions

capacity(_)

-spec capacity(inflight()) -> integer().

delete(Id, Inflight)

-spec delete(id(), inflight()) -> error | {{value, req()}, inflight()}.

empty(Inflight)

-spec empty(inflight()) -> inflight().

foreach(F, _)

-spec foreach(F, inflight()) -> ok when F :: fun((id(), req()) -> ok).
first in first evaluate

insert(Id, Req, Inflight)

-spec insert(id(), req(), inflight()) -> error | {ok, inflight()}.

is_empty(_)

-spec is_empty(inflight()) -> boolean().

is_full(Inflight)

-spec is_full(inflight()) -> boolean().

limit(_Limit, Inflight)

-spec limit(_Limit :: pos_integer() | infinity, inflight()) -> inflight().

map(F, Inflight)

-spec map(F, inflight()) -> inflight() when F :: fun((id(), req()) -> {id(), req()}).

maxsize(_)

-spec maxsize(inflight()) -> pos_integer() | infinity.

new(MaxInflight)

-spec new(infinity | pos_integer()) -> inflight().

size(_)

-spec size(inflight()) -> non_neg_integer().

to_retry_list(Pred, _)

-spec to_retry_list(Pred, inflight()) -> [{id(), req()}] when Pred :: fun((id(), req()) -> boolean()).
Return a sorted list of Pred returned true

trim_overflow(Inflight)

-spec trim_overflow(inflight()) -> {_Overflow :: [{id(), req()}], inflight()}.

update(Id, Req, Inflight)

-spec update(id(), req(), inflight()) -> error | {ok, inflight()}.