Module gen_stage_buffer

The buffer stores temporary, which is implicitly discarded, and permanent data, which are explicitly discarded.

Description

The buffer stores temporary, which is implicitly discarded, and permanent data, which are explicitly discarded.

Data is always delivered in the order they are buffered. The temporary data is stored in a queue. Permanent data is stored in a wheel for performance and to avoid discards.

Function Index

estimate_size/1Returns the estimate size of the buffer data.
new/1Builds a new buffer.
store_permanent_unless_empty/2Puts the permanent entry in the buffer unless the buffer is empty.
store_temporary/3Stores the temporary entries.
take_count_or_until_permanent/2Take count temporary from the buffer or until we find a permanent.

Function Details

estimate_size/1

estimate_size(X1) -> any()

Returns the estimate size of the buffer data.

It does not count data on the wheel.

new/1

new(Size) -> any()

Builds a new buffer.

store_permanent_unless_empty/2

store_permanent_unless_empty(Buffer, Perm) -> any()

Puts the permanent entry in the buffer unless the buffer is empty.

store_temporary/3

store_temporary(X1, Temps, Keep) -> any()

Stores the temporary entries.

keep controls which side to keep, first or last.

It returns a new buffer, the amount of discarded messages and any permanent entry that had to be emitted while discarding.

take_count_or_until_permanent/2

take_count_or_until_permanent(X1, Counter) -> any()

Take count temporary from the buffer or until we find a permanent.

Return empty if nothing was taken.


Generated by EDoc