MingaEditor.Shell.StateStash (Minga v0.1.0)

Copy Markdown View Source

Stashed shell state tied to the exact shell registration that produced it.

Shell state is safe to restore only into the same registered shell id, module, source, and generation. MingaEditor.Shell.Identity owns that comparison contract for registration, runtime, renderer, and stash paths.

Summary

Functions

Returns true when the stash belongs to the current exact registry entry.

Stores shell state with the exact registry identity that produced it.

Restores stored state only when the current registry entry has the same exact identity.

Retires a dead buffer from a stashed Traditional value without changing its identity.

Types

t()

@type t() :: %MingaEditor.Shell.StateStash{
  identity: MingaEditor.Shell.Identity.t(),
  state: MingaEditor.Shell.shell_state()
}

Functions

matches?(stash, entry)

@spec matches?(t(), MingaEditor.Shell.Entry.t()) :: boolean()

Returns true when the stash belongs to the current exact registry entry.

new(entry, state)

Stores shell state with the exact registry identity that produced it.

restore(stash, entry)

@spec restore(t(), MingaEditor.Shell.Entry.t()) ::
  {:ok, MingaEditor.Shell.shell_state()} | :mismatch

Restores stored state only when the current registry entry has the same exact identity.

retire_buffer(stash, buffer_pid)

@spec retire_buffer(t(), pid()) :: t()

Retires a dead buffer from a stashed Traditional value without changing its identity.