Search documentation of Plushie

# Plushie.Test.SessionPool.Windowed (Plushie v0.7.2)

Copy Markdown View Source

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.

## Summary

### Types

close_kind()

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

request_id()

Request identifier attached to a message sent to the renderer.

session_id()

Internal session identifier assigned by `SessionPool`.

t()

Per-session state for a windowed renderer process.

### Functions

find_close_by_port(sessions, closing_windowed, port)
find_session_by_port(sessions, port)
finish_exit(state, session_id, session, code)
handle_port_data(raw_data, session_id, session, format)
matches_owner?(session, pid, ref)
new(owner_pid, owner_ref, port)
register_session(state, caller_pid, monitor_ref, session_id)
request_exit(state, session_id, port, close_kind)
send_async(session, msg, format)
send_interact(session, msg, req_id, format)
send_sync(session, msg, req_id, response_type, from, format)

## Types

# close_kind()

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

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

# request_id()

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

Request identifier attached to a message sent to the renderer.

# session_id()

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

Internal session identifier assigned by `SessionPool`.

# t()

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

Per-session state for a windowed renderer process.

## Functions

# find_close_by_port(sessions, closing_windowed, port)

    @spec find_close_by_port(%{required(session_id()) => t()}, map(), port()) ::
      {session_id(), t()} | nil

# find_session_by_port(sessions, port)

    @spec find_session_by_port(%{required(session_id()) => t()}, port()) ::
      {session_id(), t()} | nil

# finish_exit(state, session_id, session, code)

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

# handle_port_data(raw_data, session_id, session, format)

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

# matches_owner?(session, pid, ref)

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

# new(owner_pid, owner_ref, port)

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

# register_session(state, caller_pid, monitor_ref, session_id)

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

# request_exit(state, session_id, port, close_kind)

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

# send_async(session, msg, format)

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

# send_interact(session, msg, req_id, format)

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

# send_sync(session, msg, req_id, response_type, from, format)

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