MingaEditor.Shell.Traditional.Observatory (Minga v0.1.0)

Copy Markdown View Source

Pure lifecycle owner for the Traditional shell's BEAM Observatory.

Refresh timers are correlated by semantic tokens. Expiring a scheduled refresh moves it to an in-flight state, and only the matching result can install data and arm the next refresh. Closing clears every surface value, so delayed ticks and results cannot restore a hidden observatory.

Summary

Functions

Closes the surface and invalidates scheduled or in-flight refreshes.

Returns whether a collection token is currently in flight.

Completes a matching collection and schedules the next refresh.

Returns the latest collected Observatory data.

Expires a matching scheduled refresh and marks its collection in flight.

Shows or dismisses the process inspection float.

Returns the active process inspection, when present.

Opens the surface and installs its first scheduled refresh.

Installs data without changing refresh correlation.

Returns the timer handle that an effectful workflow should cancel.

Returns whether the Observatory surface is visible.

Types

phase()

@type phase() :: :idle | :scheduled | :collecting

t()

@type t() :: %MingaEditor.Shell.Traditional.Observatory{
  data: MingaEditor.Observatory.Data.t() | nil,
  inspection: MingaEditor.Observatory.Inspection.t() | nil,
  phase: phase(),
  timer: reference() | nil,
  token: reference() | nil,
  visible: boolean()
}

timer()

@type timer() :: {reference(), reference()}

Functions

close(observatory)

@spec close(t()) :: t()

Closes the surface and invalidates scheduled or in-flight refreshes.

collecting?(observatory, token)

@spec collecting?(t(), reference()) :: boolean()

Returns whether a collection token is currently in flight.

complete(observatory, token, data, arg)

@spec complete(t(), reference(), MingaEditor.Observatory.Data.t(), timer()) ::
  {:accepted | :stale, t()}

Completes a matching collection and schedules the next refresh.

data(observatory)

@spec data(t()) :: MingaEditor.Observatory.Data.t() | nil

Returns the latest collected Observatory data.

expire(observatory, token)

@spec expire(t(), reference()) :: {:collect | :stale, t()}

Expires a matching scheduled refresh and marks its collection in flight.

inspect(observatory, inspection)

@spec inspect(t(), MingaEditor.Observatory.Inspection.t() | nil) :: t()

Shows or dismisses the process inspection float.

inspection(observatory)

@spec inspection(t()) :: MingaEditor.Observatory.Inspection.t() | nil

Returns the active process inspection, when present.

open(observatory, arg2)

@spec open(t(), timer() | nil) :: t()

Opens the surface and installs its first scheduled refresh.

replace_data(observatory, data)

@spec replace_data(t(), MingaEditor.Observatory.Data.t() | nil) :: t()

Installs data without changing refresh correlation.

timer(observatory)

@spec timer(t()) :: reference() | nil

Returns the timer handle that an effectful workflow should cancel.

visible?(observatory)

@spec visible?(t()) :: boolean()

Returns whether the Observatory surface is visible.