kumulant

GroupedStat

Marker interface for stats whose result is a GroupResult. Implemented by StatGroup and its modality variants. Used in the group declarator below to enforce that nested-group entries actually produce GroupResult rather than some other Result shape.

Inheritors

Properties

Link copied to clipboard
abstract val concurrency: Concurrency

The thread-safety contract this stat was constructed with. Each stat picks the cell-encoding and lock strategy that honours this contract for its mathematical structure:

Functions

Link copied to clipboard
abstract fun create(concurrency: Concurrency? = null): Stat<GroupResult>

Spawn a fresh accumulator with the same configuration. Optionally override the Concurrency; useful for materialising a wire spec at a different concurrency level than the source.

Link copied to clipboard
abstract fun merge(values: GroupResult)

Fold another accumulator's snapshot into this one. The unit of merge is the immutable Result; not a live Stat; which is what lets the merge cross a process boundary. Many workers track slices of the same stream, call read periodically, ship snapshots to a coordinator, and the coordinator merges them in.

Link copied to clipboard
abstract fun read(timestampNanos: Long = currentTimeNanos()): GroupResult

Materialise the current state as an immutable Result. Reads never mutate, so the caller can read as often as it likes without affecting the stream.

Link copied to clipboard
abstract fun reset()

Reset the stat to its prior-seeded baseline. Equivalent to constructing a fresh stat with the same configuration, but in place; keeps the same Concurrency and any per-stat tunables.