# `Plushie.Test.SessionPool.Windowed`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.7.2/lib/plushie/test/session_pool/windowed.ex#L1)

State and business logic for the `:windowed` session pool mode.

Windowed tests run one renderer process per logical session. This module owns
per-session state, request tracking, response dispatch, and exit handling for
those renderer processes.

# `close_kind`

```elixir
@type close_kind() :: {:sync, GenServer.from()} | :async
```

How the pool is waiting for a windowed renderer to exit.

# `request_id`

```elixir
@type request_id() :: String.t()
```

Request identifier attached to a message sent to the renderer.

# `session_id`

```elixir
@type session_id() :: String.t()
```

Internal session identifier assigned by `SessionPool`.

# `t`

```elixir
@type t() :: %Plushie.Test.SessionPool.Windowed{
  buffer: binary(),
  owner_pid: pid(),
  owner_ref: reference(),
  pending: %{required(request_id()) =&gt; {String.t(), GenServer.from()}},
  port: port()
}
```

Per-session state for a windowed renderer process.

# `find_close_by_port`

```elixir
@spec find_close_by_port(%{required(session_id()) =&gt; t()}, map(), port()) ::
  {session_id(), t()} | nil
```

# `find_session_by_port`

```elixir
@spec find_session_by_port(%{required(session_id()) =&gt; t()}, port()) ::
  {session_id(), t()} | nil
```

# `finish_exit`

```elixir
@spec finish_exit(Plushie.Test.SessionPool.t(), session_id(), t(), integer()) ::
  Plushie.Test.SessionPool.t()
```

# `handle_port_data`

```elixir
@spec handle_port_data(
  binary() | {:eol, binary()},
  session_id(),
  t(),
  Plushie.Test.SessionPool.Transport.format()
) :: t()
```

# `matches_owner?`

```elixir
@spec matches_owner?(t(), pid(), reference()) :: boolean()
```

# `new`

```elixir
@spec new(pid(), reference(), port()) :: t()
```

# `register_session`

```elixir
@spec register_session(Plushie.Test.SessionPool.t(), pid(), reference(), session_id()) ::
  Plushie.Test.SessionPool.t()
```

# `request_exit`

```elixir
@spec request_exit(Plushie.Test.SessionPool.t(), session_id(), port(), close_kind()) ::
  Plushie.Test.SessionPool.t()
```

# `send_async`

```elixir
@spec send_async(t(), map(), Plushie.Test.SessionPool.Transport.format()) :: t()
```

# `send_interact`

```elixir
@spec send_interact(
  t(),
  map(),
  request_id(),
  Plushie.Test.SessionPool.Transport.format()
) :: t()
```

# `send_sync`

```elixir
@spec send_sync(
  t(),
  map(),
  request_id(),
  String.t(),
  GenServer.from(),
  Plushie.Test.SessionPool.Transport.format()
) :: t()
```

---

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