Slap.Cluster.Shard (slap_cluster v0.4.0)

Copy Markdown View Source

The context of a shard placed on this node, given to the application's shard children and to functions run with call/3.

  • :cluster - the cluster module.
  • :n - the shard number, 0..shards - 1.
  • :db - the open Slap.SlateDB handle. Read and write through it directly.
  • :registry - the cluster's Registry. Name per-shard processes with the cluster's via/2, which scopes names to {n, name}.
  • :generation - the strategy's lease generation, or nil (Local).
  • :child_options - application settings passed to shard children.

:status and :shard_db are internal coordination fields. Use Slap.Cluster.shard_status/1 to inspect the shard's state.

A context is only valid while the shard is open on this node. When the shard stops, Slap.Cluster.shard_status/1 says why.

Summary

Types

t()

@type t() :: %Slap.Cluster.Shard{
  child_options: keyword(),
  cluster: module(),
  db: Slap.SlateDB.t(),
  generation: non_neg_integer() | nil,
  n: non_neg_integer(),
  registry: atom(),
  shard_db: pid(),
  status: :atomics.atomics_ref()
}