evoq_aggregates_sup (evoq v1.14.1)

View Source

Supervisor for aggregate processes.

Implements partitioned supervision for aggregates. Uses 4 partition supervisors to distribute load and prevent single-supervisor bottlenecks.

Aggregates are distributed across partitions using phash2(StreamId, 4).

Summary

Functions

Get an existing aggregate process.

Calculate partition for an aggregate ID.

Start an aggregate process in the appropriate partition (uses env store_id).

Start an aggregate process in the appropriate partition with explicit store_id.

Start the aggregates supervisor.

Functions

get_aggregate(AggregateId)

-spec get_aggregate(binary()) -> {ok, pid()} | {error, not_found}.

Get an existing aggregate process.

partition_for(AggregateId)

-spec partition_for(binary()) -> 1..4.

Calculate partition for an aggregate ID.

start_aggregate(AggregateModule, AggregateId)

This function is deprecated. Use start_aggregate/3 with explicit store_id instead..
-spec start_aggregate(atom(), binary()) -> {ok, pid()} | {error, term()}.

Start an aggregate process in the appropriate partition (uses env store_id).

start_aggregate(AggregateModule, AggregateId, StoreId)

-spec start_aggregate(atom(), binary(), atom()) -> {ok, pid()} | {error, term()}.

Start an aggregate process in the appropriate partition with explicit store_id.

start_link()

-spec start_link() -> {ok, pid()} | {error, term()}.

Start the aggregates supervisor.