Minga.Parser.PortState (Minga v0.1.0)

Copy Markdown View Source

Owned state for the parser Port and its restart policy.

Minga.Parser.Manager owns the process and installs this aggregate, while this module is the only constructor and updater of %PortState{} values.

Summary

Functions

Records that the parser Port is closed.

Records that bounded restart attempts have been exhausted.

Constructs parser Port state for an executable path.

Records a successfully opened parser Port.

Resets bounded restart history for a manual restart.

Records a successful automatic restart and resets backoff.

Records a scheduled restart attempt and its next backoff.

Types

t()

@type t() :: %Minga.Parser.PortState{
  backoff_ms: pos_integer(),
  gave_up?: boolean(),
  handle: port() | nil,
  parser_path: String.t(),
  ready?: boolean(),
  restart_timestamps: [integer()]
}

Functions

closed(state)

@spec closed(t()) :: t()

Records that the parser Port is closed.

gave_up(state, timestamps)

@spec gave_up(t(), [integer()]) :: t()

Records that bounded restart attempts have been exhausted.

new(parser_path)

@spec new(String.t()) :: t()

Constructs parser Port state for an executable path.

opened(state, handle)

@spec opened(t(), port()) :: t()

Records a successfully opened parser Port.

reset_restart_policy(state)

@spec reset_restart_policy(t()) :: t()

Resets bounded restart history for a manual restart.

restarted(state, handle)

@spec restarted(t(), port()) :: t()

Records a successful automatic restart and resets backoff.

scheduled(state, timestamps, next_backoff_ms)

@spec scheduled(t(), [integer()], pos_integer()) :: t()

Records a scheduled restart attempt and its next backoff.