MingaEditor.State.Workspace.RemoteSession (Minga v0.1.0)

Copy Markdown View Source

Durable remote session identity for an agent workspace.

Workspaces own remote identity. Tabs may project this data for display, but lifecycle code should read the workspace copy so reconnect and teardown still work when a file tab is active or the agent tab has been closed.

Summary

Types

Remote connection status.

t()

Durable remote session metadata for a workspace.

Functions

Returns true when the remote metadata points at the server/session pair.

Returns true when the remote metadata belongs to the server.

Updates the connection status.

Updates the last seen event id.

Types

connection_status()

@type connection_status() :: :connected | :disconnected | :ended | :unavailable

Remote connection status.

t()

@type t() :: %MingaEditor.State.Workspace.RemoteSession{
  connection_status: connection_status(),
  last_seen_event_id: non_neg_integer(),
  server_name: String.t(),
  session_id: String.t()
}

Durable remote session metadata for a workspace.

Functions

matches?(remote_session, server_name, session_id)

@spec matches?(t(), String.t(), String.t()) :: boolean()

Returns true when the remote metadata points at the server/session pair.

new(server_name, session_id, status \\ :connected, last_seen_event_id \\ 0)

@spec new(String.t(), String.t(), connection_status(), non_neg_integer()) :: t()

Creates durable remote metadata.

server?(remote_session, server_name)

@spec server?(t(), String.t()) :: boolean()

Returns true when the remote metadata belongs to the server.

set_connection_status(remote_session, status)

@spec set_connection_status(t(), connection_status()) :: t()

Updates the connection status.

set_last_seen_event_id(remote_session, event_id)

@spec set_last_seen_event_id(t(), non_neg_integer()) :: t()

Updates the last seen event id.