State and business logic for the shared-renderer session pool modes.
:mock and :headless run one renderer process that hosts many logical
sessions. This module owns the registrations, pending replies, teardown
tracking, and dispatch of replies back to the correct test process.
Summary
Types
Request identifier attached to a message sent to the renderer.
Internal session identifier assigned by SessionPool.
Shared-renderer state for multiplexed test sessions.
Types
@type request_id() :: String.t()
Request identifier attached to a message sent to the renderer.
@type session_id() :: String.t()
Internal session identifier assigned by SessionPool.
@type t() :: %Plushie.Test.SessionPool.Multiplexed{ buffer: binary(), pending: %{ required({session_id(), request_id()}) => {String.t(), GenServer.from()} }, pending_close: %{required(session_id()) => :awaiting}, port: port(), sessions: %{required(session_id()) => {pid(), reference()}} }
Shared-renderer state for multiplexed test sessions.
Functions
@spec handle_port_data( binary() | {:eol, binary()}, t(), Plushie.Test.SessionPool.Transport.format() ) :: t()
@spec register(t(), session_id(), pid(), reference()) :: t()
@spec release_session( t(), session_id(), request_id(), Plushie.Test.SessionPool.Transport.format() ) :: t()
@spec send_async( t(), session_id(), map(), Plushie.Test.SessionPool.Transport.format() ) :: t()
@spec send_interact( t(), session_id(), map(), request_id(), Plushie.Test.SessionPool.Transport.format() ) :: {:ok, t()} | :error
@spec send_sync( t(), session_id(), map(), request_id(), String.t(), GenServer.from(), Plushie.Test.SessionPool.Transport.format() ) :: {:ok, t()} | :error
@spec session_count(t()) :: non_neg_integer()
@spec unregister( t(), session_id(), request_id(), GenServer.from(), Plushie.Test.SessionPool.Transport.format() ) :: t()