View Source ProcessHub.Service.Batch (ProcessHub v0.7.0)

The items queued behind one flush — the core of a group commit.

add/3 queues an item and, when the batch was empty, sends flush_msg to the current process once. That message lands behind every request already in the mailbox, so everything that arrives before it joins the same batch; take/1 hands the items back in arrival order and empties the batch. The owner decides what one flush does — one durable sync, one manifest write — and answers every item after it.

Summary

Types

@type t() :: %ProcessHub.Service.Batch{items: [term()], open?: boolean()}

Functions

Link to this function

add(batch, flush_msg, item)

View Source
@spec add(t(), term(), term()) :: t()
@spec new() :: t()
@spec take(t()) :: {[term()], t()}