# `Minga.Parser.PortState`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga/parser/port_state.ex#L1)

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.

# `t`

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

# `closed`

```elixir
@spec closed(t()) :: t()
```

Records that the parser Port is closed.

# `gave_up`

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

Records that bounded restart attempts have been exhausted.

# `new`

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

Constructs parser Port state for an executable path.

# `opened`

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

Records a successfully opened parser Port.

# `reset_restart_policy`

```elixir
@spec reset_restart_policy(t()) :: t()
```

Resets bounded restart history for a manual restart.

# `restarted`

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

Records a successful automatic restart and resets backoff.

# `scheduled`

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

Records a scheduled restart attempt and its next backoff.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
