View Source kpro_sent_reqs (kafka_protocol v4.2.3)

This module manages an opaque collection of sent-requests.

Summary

Functions

Add a new request to sent collection. Return the last corrlation ID and the new collection.

Delete a request from the opaque collection. Crash if correlation ID is not found.

Get the correction to be sent for the next request.

Get caller of a request having the given correlation ID. Crash if the request is not found.

Fetch and increment the correlation ID This is used if we don't want a response from the broker

Scan all sent requests to get oldest sent request. Age is in milli-seconds. 0 is returned if there is no pending response.

Types

corr_id/0

-type corr_id() :: kpro:corr_id().

requests/0

-opaque requests()

Functions

add(Requests, Caller, Ref, API, Vsn)

-spec add(requests(), pid(), reference(), kpro:api(), kpro:vsn()) -> {corr_id(), requests()}.

Add a new request to sent collection. Return the last corrlation ID and the new collection.

del(Requests, CorrId)

-spec del(requests(), corr_id()) -> requests().

Delete a request from the opaque collection. Crash if correlation ID is not found.

get_corr_id(Requests)

-spec get_corr_id(requests()) -> corr_id().

Get the correction to be sent for the next request.

get_req(Requests, CorrId)

-spec get_req(requests(), corr_id()) -> {pid(), reference(), kpro:api(), kpro:vsn()}.

Get caller of a request having the given correlation ID. Crash if the request is not found.

increment_corr_id(Requests)

-spec increment_corr_id(requests()) -> {corr_id(), requests()}.

Fetch and increment the correlation ID This is used if we don't want a response from the broker

is_empty(Requests)

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

new()

-spec new() -> requests().

scan_for_max_age(Requests)

-spec scan_for_max_age(requests()) -> timeout().

Scan all sent requests to get oldest sent request. Age is in milli-seconds. 0 is returned if there is no pending response.