Letterpress.Compiler (Letterpress v0.1.0)

Copy Markdown View Source

Routes authoring requests to a caller-owned compiler pool.

Start Letterpress.Compiler.Supervisor in the host application's supervision tree before calling authoring functions. The framed protocol and worker lifecycle remain private; callers receive tagged errors and never observe port messages or worker process identities.

Summary

Types

An operation implemented by the bundled compiler protocol.

Functions

Returns whether :pool has at least one registered compiler worker.

Executes a bounded operation in a compiler pool.

Returns :ready when :pool has a worker, otherwise :unavailable.

Types

operation()

@type operation() ::
  :discover | :analyze | :compile | :format | :apply_translations | :contract

An operation implemented by the bundled compiler protocol.

Functions

available?(opts \\ [])

@spec available?(keyword()) :: boolean()

Returns whether :pool has at least one registered compiler worker.

The default pool is Letterpress.Compiler.Pool.

request(operation, payload, opts \\ [])

@spec request(operation(), map(), keyword()) :: {:ok, map()} | {:error, term()}

Executes a bounded operation in a compiler pool.

Options

  • :pool - registered compiler pool; defaults to Letterpress.Compiler.Pool
  • :timeout - request deadline in milliseconds; defaults to 15000

Most consumers should call the facade functions in Letterpress.

status(opts \\ [])

@spec status(keyword()) :: :unavailable | :ready

Returns :ready when :pool has a worker, otherwise :unavailable.

This is suitable for authoring-node readiness checks. Delivery-only nodes do not need a compiler pool and should not include it in their readiness policy.