View Source TripSwitch.Circuit (TripSwitch v0.1.1)

Documentation for TripSwitch.Circuit.

Link to this section Summary

Link to this section Types

@type signal() :: (() -> {:ok, term()} | {:break, term()})
@type state() :: :closed | :half_open | :open
@type t() :: %TripSwitch.Circuit{
  counter: pos_integer(),
  fix_after: pos_integer(),
  state: state(),
  surges: pos_integer(),
  threshold: pos_integer()
}

Link to this section Functions

@spec broken?(t()) :: boolean()
@spec handle(t(), signal()) :: {{:ok, term()} | :broken, t()}
@spec new(keyword()) :: t()
@spec repair(t()) :: t()
@spec repairable?(t()) :: boolean()
@spec reset(t()) :: t()