historian v0.11.0-beta.3 Historian.UserInterface View Source

Manages the state of the User Interface including the page buffer to use and color scheme.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Get the current page buffer in the Historian.UserInterface process.

Callback implementation for GenServer.init/1.

Sets the page buffer in the Historian.UserInterface process, returns {:ok, ref} if the process has been successfully set or {:error, :dead_pid} if the process's spark of life has been smothered in shite...

Link to this section Types

Link to this type

server()

View Source
server() :: pid() | atom()

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

current_session(server \\ __MODULE__)

View Source
current_session(server()) :: {:ok, reference()} | {:error, :no_session_prepared}
Link to this function

get(server \\ __MODULE__, page_ref)

View Source
get(server(), page_ref :: reference() | nil) ::
  {:ok, page_buffer_pid :: pid()}
  | {:error, :dead_pid}
  | {:error, :stale_reference}

Get the current page buffer in the Historian.UserInterface process.

Returns:

  • {:ok, page_buffer_pid} - Success result.
  • {:error, :dead_pid} - Page buffer process is nothing but a dreadful reminder of our endless march towards death and being forgotten.
  • {:error, :stale_pid} - Reference belongs to a stale pid, if you do not care about the old pid, you can call this function with nil and it will return whatever the current pid is bypassing the reference check.

Parameters

  • server: [optional] UI process to call (defaults to process named: Elixir.Historian.UserInterface)
  • page_ref: The reference returned when setting the page buffer or nil to skip stale ref check.

Callback implementation for GenServer.init/1.

Link to this function

prepare_session(server \\ __MODULE__, screen_name)

View Source
prepare_session(server(), screen_name :: :archive | :view_history) ::
  {:ok, session_ref :: reference()}
Link to this function

session_info(server \\ __MODULE__, session_ref)

View Source
session_info(server(), session_ref :: reference()) ::
  {:ok, map()} | {:error, :invalid_session_ref}
Link to this function

set(server \\ __MODULE__, page_buffer_pid)

View Source
set(server(), page_buffer_pid :: pid()) ::
  {:ok, reference()} | {:error, :dead_pid}

Sets the page buffer in the Historian.UserInterface process, returns {:ok, ref} if the process has been successfully set or {:error, :dead_pid} if the process's spark of life has been smothered in shite...

Parameters

  • server: [optional] UI process to call (defaults to process named: Elixir.Historian.UserInterface)
  • pager: The pid for a Historian.PageBuffer process.
Link to this function

set_color_scheme!(scheme)

View Source
Link to this function

update_color_scheme(color_scheme)

View Source