View Source RaftedValue.Config (rafted_value v0.11.2)

Link to this section Summary

Functions

Type-aware getter for communication_module.

Type-aware setter for communication_module.

Type-aware getter for data_module.

Type-aware setter for data_module.

Type-aware getter for election_timeout.

Type-aware setter for election_timeout.

Type-aware getter for election_timeout_clock_drift_margin.

Type-aware setter for election_timeout_clock_drift_margin.

Type-aware getter for heartbeat_timeout.

Type-aware setter for heartbeat_timeout.

Type-aware getter for leader_hook_module.

Type-aware setter for leader_hook_module.

Type-aware getter for max_retained_command_results.

Type-aware setter for max_retained_command_results.

Creates a new instance of RaftedValue.Config by using the given dict.

A variant of new/1 which returns t or raise if validation fails.

Updates an existing instance of RaftedValue.Config with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

Checks if the given value belongs to t/0 or not.

Link to this section Types

@type t() :: %RaftedValue.Config{
  communication_module: Croma.Atom.t(),
  data_module: Croma.Atom.t(),
  election_timeout: Croma.PosInteger.t(),
  election_timeout_clock_drift_margin: Croma.PosInteger.t(),
  heartbeat_timeout: Croma.PosInteger.t(),
  leader_hook_module: Croma.Atom.t(),
  max_retained_command_results: Croma.PosInteger.t()
}

Link to this section Functions

Link to this function

communication_module(config)

View Source
@spec communication_module(t()) :: Croma.Atom.t()

Type-aware getter for communication_module.

Link to this function

communication_module(s, field)

View Source
@spec communication_module(t(), Croma.Atom.t()) :: t()

Type-aware setter for communication_module.

@spec data_module(t()) :: Croma.Atom.t()

Type-aware getter for data_module.

@spec data_module(t(), Croma.Atom.t()) :: t()

Type-aware setter for data_module.

Link to this function

election_timeout(config)

View Source
@spec election_timeout(t()) :: Croma.PosInteger.t()

Type-aware getter for election_timeout.

Link to this function

election_timeout(s, field)

View Source
@spec election_timeout(t(), Croma.PosInteger.t()) :: t()

Type-aware setter for election_timeout.

Link to this function

election_timeout_clock_drift_margin(config)

View Source
@spec election_timeout_clock_drift_margin(t()) :: Croma.PosInteger.t()

Type-aware getter for election_timeout_clock_drift_margin.

Link to this function

election_timeout_clock_drift_margin(s, field)

View Source
@spec election_timeout_clock_drift_margin(t(), Croma.PosInteger.t()) :: t()

Type-aware setter for election_timeout_clock_drift_margin.

Link to this function

heartbeat_timeout(config)

View Source
@spec heartbeat_timeout(t()) :: Croma.PosInteger.t()

Type-aware getter for heartbeat_timeout.

Link to this function

heartbeat_timeout(s, field)

View Source
@spec heartbeat_timeout(t(), Croma.PosInteger.t()) :: t()

Type-aware setter for heartbeat_timeout.

Link to this function

leader_hook_module(config)

View Source
@spec leader_hook_module(t()) :: Croma.Atom.t()

Type-aware getter for leader_hook_module.

Link to this function

leader_hook_module(s, field)

View Source
@spec leader_hook_module(t(), Croma.Atom.t()) :: t()

Type-aware setter for leader_hook_module.

Link to this function

max_retained_command_results(config)

View Source
@spec max_retained_command_results(t()) :: Croma.PosInteger.t()

Type-aware getter for max_retained_command_results.

Link to this function

max_retained_command_results(s, field)

View Source
@spec max_retained_command_results(t(), Croma.PosInteger.t()) :: t()

Type-aware setter for max_retained_command_results.

@spec new(term()) :: Croma.Result.t(t())

Creates a new instance of RaftedValue.Config by using the given dict.

Values associated with the struct field names are fetched from the given dict and then validated/converted with valid?/1/new/1. For missing fields default values (if any) are used.

Returns {:ok, valid_struct} when all fields are filled with valid values. Returns {:error, reason} if any error occurs (invalid value or no value is available).

See also moduledoc of Croma.Struct.

@spec new!(term()) :: t()

A variant of new/1 which returns t or raise if validation fails.

In other words, new/1 followed by Croma.Result.get!/1.

@spec update(t(), Dict.t()) :: Croma.Result.t(t())

Updates an existing instance of RaftedValue.Config with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

@spec update!(t(), Dict.t()) :: t()

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

@spec valid?(term()) :: boolean()

Checks if the given value belongs to t/0 or not.