Bedrock.Durability (bedrock v0.5.3)

View Source

Durability profile contract for Bedrock clusters.

This module exposes a small API that downstream integrations can call to:

  • inspect a cluster's durability profile (profile/1)
  • enforce profile requirements (require/2)

Summary

Functions

Evaluates the durability profile for the given target.

Enforces durability profile requirements for the given mode.

Types

mode()

@type mode() :: :strict | :relaxed

target()

@type target() ::
  module()
  | keyword()
  | %{optional(:node_config) => keyword(), optional(:cluster_config) => map()}

Functions

profile(target)

@spec profile(target()) :: Bedrock.Durability.Profile.t()

Evaluates the durability profile for the given target.

The target may be:

  • a cluster module (must export node_config/0, optionally fetch_config/0)
  • a node config keyword list
  • a map containing :node_config and optional :cluster_config

require(target, mode \\ :strict)

@spec require(target(), mode()) ::
  :ok | {:error, {:durability_profile_failed, [atom()]}}

Enforces durability profile requirements for the given mode.

Returns :ok in :relaxed mode even when profile checks fail. Returns {:error, {:durability_profile_failed, reasons}} in :strict mode when requirements are not met.