Module gen_stage_utils

Utility functions for gen_stage validation and helper operations.

Description

Utility functions for gen_stage validation and helper operations.

Function Index

is_transient_shutdown/1 Helper to check if a shutdown is transient.
self_name/0 Returns the name of the current process or self.
split_batches/5 Splits a list of events into messages configured by min, max, and demand.
validate_in/4 Validates the given option is one of the values.
validate_integer/6 Validates an integer.
validate_list/3 Validates the argument is a list.
validate_no_opts/1 Validates there are no options left.

Function Details

is_transient_shutdown/1

is_transient_shutdown(X1::any()) -> boolean()

Helper to check if a shutdown is transient.

self_name/0

self_name() -> atom() | pid()

Returns the name of the current process or self.

split_batches/5

split_batches(Events::[any()], From::pid() | {pid(), reference()} | {pid(), {reference(), reference()}}, Min::non_neg_integer(), Max::non_neg_integer(), Demand::non_neg_integer()) -> {non_neg_integer(), [{[any()], non_neg_integer()}]}

Splits a list of events into messages configured by min, max, and demand.

The From argument is only used for the excess-events log message; it is the subscription identifier (a plain pid in regular consumers, a nested {MonitorRef, InnerRef} tuple in gen_stage_stream subscriptions).

validate_in/4

validate_in(Opts::proplists:proplist(), Key::atom(), Default::any(), Values::[any()]) -> {ok, any(), proplists:proplist()} | {error, string()}

Validates the given option is one of the values.

validate_integer/6

validate_integer(Opts::proplists:proplist(), Key::atom(), Default::any(), Min::integer() | infinity, Max::integer() | infinity, AllowInfinity::boolean()) -> {ok, integer() | infinity, proplists:proplist()} | {error, string()}

Validates an integer.

validate_list/3

validate_list(Opts::proplists:proplist(), Key::atom(), Default::any()) -> {ok, list(), proplists:proplist()} | {error, string()}

Validates the argument is a list.

validate_no_opts/1

validate_no_opts(Opts::proplists:proplist()) -> ok | {error, string()}

Validates there are no options left.


Generated by EDoc