MingaEditor.Extension.SourceFinalizer (Minga v0.1.0)

Copy Markdown View Source

Finalizes Editor-owned work and presentation for one contribution source.

Extension cleanup requests this workflow asynchronously and waits for an explicit Editor acknowledgement outside the lifecycle authority mailbox. The generation-owned effect scheduler drains before source presentation is removed.

Summary

Functions

Registers the Editor finalizer with source-owned contribution cleanup.

Cancels source work before removing its live picker presentation.

Schedules source-filtered unload callbacks and defers the cleanup acknowledgement.

Runs token-scoped unload callbacks against the production Editor, if it is running.

Finalizes a source against the production Editor, if it is running.

Finalizes a source against an explicit Editor server.

Types

result()

@type result() :: :ok | {:error, term()}

source()

unload_context()

@type unload_context() :: %{
  :token => Minga.Extension.CodeLease.unload_token(),
  optional(:callback_registry) => Minga.Extension.CallbackRegistry.registry(),
  optional(:callback_admission) => GenServer.server()
}

Functions

ensure_cleanup_registered()

@spec ensure_cleanup_registered() :: :ok

Registers the Editor finalizer with source-owned contribution cleanup.

finalize(state, source)

@spec finalize(MingaEditor.State.t(), source()) :: {result(), MingaEditor.State.t()}

Cancels source work before removing its live picker presentation.

finalize_unload(state, source, context, reply_to)

Schedules source-filtered unload callbacks and defers the cleanup acknowledgement.

unload_source(source, context)

Runs token-scoped unload callbacks against the production Editor, if it is running.

unregister_source(source)

@spec unregister_source(source()) :: result()

Finalizes a source against the production Editor, if it is running.

unregister_source(source, pid)

@spec unregister_source(source(), GenServer.server() | nil) :: result()

Finalizes a source against an explicit Editor server.