registerCompiler

fun registerCompiler(compile: suspend (source: ByteArray, target: Target, optLevel: OptLevel) -> ByteArray)

Register this node as a compiler node: installs the well-known CompileOp.ID op in registry so compile(sourceHash, target, optLevel) requests reach this node as ordinary ring-dispatched tasks rather than requiring a direct imperative publishVariant call.

Any peer enqueues a compile task with CompileOp.descriptor; when this node claims it, the registered op:

  1. decodes the CompileRequest from the task args,

  2. resolves the source bytes — from the local Creel if cached, otherwise lazily fetched from the mesh (bounded by WarpLazyFetch.fetchTimeout; a timeout throws, which unclaims the task so it is retried on a later cycle — transient, not terminal),

  3. invokes compile to build the variant bytes, and

  4. publishes them via publishVariant so the variant gossips to the mesh exactly as an imperative publish would.

The task's result on the results board is the variant's BobbinHash hex value as UTF-8 bytes — compile(sourceHash, target, optLevel) → variantHash.

Requires a lazyFetch capability (the compiler must be able to fetch sources and publish variants) — throws IllegalStateException otherwise, fail-loud like publishVariant. Call once at startup; a duplicate registration throws (see OpRegistry.register).

Parameters

compile

Builds the variant bytes from the source kernel bytes for the requested Target and OptLevel. Must be deterministic and pure — same input, same output, same content hash on every compiler node.