Pure identity and lifecycle registry owned by Minga.Parser.Manager.
Summary
Functions
Returns the parser ID for a buffer PID.
Returns the number of registrations.
Returns all registrations.
Evicts stale unprotected buffers and returns their identities.
Returns a registration by PID.
Returns whether a DOWN message belongs to the current monitor.
Creates an empty editor-buffer registry.
Allocates the next manager-owned parser version.
Replaces an existing registration; unknown PIDs are ignored.
Records the process monitor owned by the parser manager.
Registers a buffer, preserving identity only while its inert configuration is unchanged.
Returns whether a parser ID belongs to an editor buffer.
Returns the buffer PID for a parser ID.
Resets parser versions and marks every registration for full resync.
Refreshes activity for a registered buffer.
Unregisters a buffer and returns its former parser ID and monitor.
Types
@type meta() :: Minga.Parser.BufferRegistration.t()
@type register_status() :: :new | :existing | {:replaced, pos_integer()}
@type t() :: %Minga.Parser.BufferRegistry{ entries: %{required(pid()) => meta()}, ids: %{required(pid()) => pos_integer()}, last_active_at: %{required(pid()) => integer()}, monitors: %{required(pid()) => reference()}, next_id: pos_integer(), parse_version: non_neg_integer(), pids: %{required(pos_integer()) => pid()} }
Functions
@spec buffer_id(t(), pid()) :: pos_integer() | nil
Returns the parser ID for a buffer PID.
@spec count(t()) :: non_neg_integer()
Returns the number of registrations.
Returns all registrations.
@spec evict_inactive(t(), [pid()], non_neg_integer(), integer()) :: {[{pid(), pos_integer(), reference() | nil}], t()}
Evicts stale unprotected buffers and returns their identities.
Returns a registration by PID.
Returns whether a DOWN message belongs to the current monitor.
@spec new() :: t()
Creates an empty editor-buffer registry.
@spec next_parse_version(t()) :: {pos_integer(), t()}
Allocates the next manager-owned parser version.
Replaces an existing registration; unknown PIDs are ignored.
Records the process monitor owned by the parser manager.
@spec register(t(), pid(), Minga.Parser.BufferConfig.t(), integer()) :: {pos_integer(), register_status(), t()}
Registers a buffer, preserving identity only while its inert configuration is unchanged.
@spec registered_id?(t(), non_neg_integer()) :: boolean()
Returns whether a parser ID belongs to an editor buffer.
@spec resolve(t(), non_neg_integer()) :: pid() | nil
Returns the buffer PID for a parser ID.
Resets parser versions and marks every registration for full resync.
Refreshes activity for a registered buffer.
@spec unregister(t(), pid()) :: {pos_integer() | nil, reference() | nil, t()}
Unregisters a buffer and returns its former parser ID and monitor.