Slap.Cluster.ShardChildren behaviour (slap_cluster v0.6.1)

Copy Markdown View Source

Starts application processes for a shard after its database opens.

A temporary, significant child stops the shard when it exits. The placement strategy decides whether and where to restart the shard.

A module used as shard_children: {module, :child_specs, args} can implement validate_child_options!/1. The cluster calls it before starting, so a configuration error does not leave shards retrying their startup. It can also implement services/0, which Slap.Cluster.clusters/0 reports.

Summary

Callbacks

Names for what the shards serve, such as [:streams].

Raises ArgumentError for invalid application settings.

Callbacks

child_specs(t)

@callback child_specs(Slap.Cluster.Shard.t()) :: [
  Supervisor.child_spec() | {module(), term()}
]

services()

(optional)
@callback services() :: [atom()]

Names for what the shards serve, such as [:streams].

validate_child_options!(keyword)

(optional)
@callback validate_child_options!(keyword()) :: :ok

Raises ArgumentError for invalid application settings.