Skip to main content

Module runner

Module runner 

Source
Expand description

Function runner — executes TypeScript functions via the bidirectional protocol.

The runner manages the connection to the Bun/Deno process and mediates all communication. It handles DB operations, stream forwarding, scheduling, and transaction management.

Structs§

FnCallError
FnRunner
Manages the TypeScript process and executes function calls.

Constants§

DEFAULT_CALL_TIMEOUT
Default ceiling on how long a single function call may take. Holds the SQLite write lock for mutations, so this is also a backstop against a runaway TS handler blocking the whole DB. Override via FnRunner::set_call_timeout or PYLON_FN_CALL_TIMEOUT (server-side).

Type Aliases§

NestedCallHook
Callback invoked when a running function asks to run another function (action → query/mutation). The wrapper is responsible for any per-type setup — notably wrapping mutations in their own BEGIN/COMMIT, which can’t happen inside call_inner because that path holds the io_lock and is called with the outer action’s non-transactional store.
ScheduleHook
Callback invoked when a function calls ctx.scheduler.runAfter/runAt. Returns Ok(job_id) on success or Err(msg) on persistence/queue failure. The runner reports the error back to the calling handler so users don’t get a silent {scheduled: true, id: ""}.
StreamCallback
Callback invoked for each stream chunk during function execution. The server layer converts these into SSE events on the HTTP response.