LivePanels.Canvas.Shared (livepanels v0.1.0)

Copy Markdown View Source

Public shared-mode configuration facade.

Use this module when an application needs child specs or backend health checks for the shared backend configured on a canvas.

Summary

Functions

Exercises a shared backend with a generated shared canvas.

Returns child specs for the given backend declaration.

Returns the configured local backend used when no backend is supplied.

Normalizes a shared backend declaration into the runtime backend record.

Returns a LiveView session map containing shared participant metadata.

Projects canonical shared canvas state for a participant client id.

Types

backend()

@type backend() :: LivePanels.Canvas.Shared.Backend.t()

backend_health_check_report()

@type backend_health_check_report() ::
  LivePanels.Canvas.Shared.Backend.backend_health_check_report()

backend_spec()

@type backend_spec() ::
  nil | :local | :horde | module() | {module() | atom(), keyword()} | backend()

Functions

backend_health_check(opts)

@spec backend_health_check(keyword()) ::
  {:ok, backend_health_check_report()} | {:error, term()}

Exercises a shared backend with a generated shared canvas.

backend_health_check!(opts)

@spec backend_health_check!(keyword()) :: backend_health_check_report()

Bang variant of backend_health_check/1.

child_specs(backend \\ nil)

@spec child_specs(backend_spec()) :: [Supervisor.child_spec()]

Returns child specs for the given backend declaration.

default()

@spec default() :: backend()

Returns the configured local backend used when no backend is supplied.

normalize!(backend)

@spec normalize!(backend_spec()) :: backend()

Normalizes a shared backend declaration into the runtime backend record.

participant_session(opts \\ [])

@spec participant_session(keyword() | map()) :: map()

Returns a LiveView session map containing shared participant metadata.

project_state(canvas_state, client_id, participants, meta \\ %{})

@spec project_state(LivePanels.Canvas.State.t(), String.t(), map(), map()) ::
  LivePanels.Canvas.State.t()

Projects canonical shared canvas state for a participant client id.