Struct CatalystCoprocessorFnInfo

Struct Documentation

struct CatalystCoprocessorFnInfo

The lifecycle hooks of a coprocessor function or launcher. The library defining the function may export them as const CatalystCoprocessorFnInfo *<symbol>_info(void), where <symbol> is the function’s name. The runtime looks <symbol>_info up only in the library that defines <symbol>. A per-message function without it is bound with a null ctx.

  • abi_version: the version the library is written against, at least 1. The struct only grows at its end, and the runtime reads only the fields of the versions it knows. A field added by a later version must be optional: null or zero keeps the behaviour of the earlier versions. Version 2 adds no fields: it changes what a launcher’s persistent engine reads and writes, which is codec frames laid out as CoprocLaunchDesc (Transport.hpp) describes, replies included. A launcher must export <symbol>_info reporting at least version 2, and the runtime refuses one that does not, since an engine built for version 1 would never publish a reply the runtime recognises. A per-message function may report 1 or 2.

  • reserved: zero. It fills the 4 bytes before init, which would otherwise be padding, and the runtime ignores it. A later version may give it a meaning, for which zero keeps the behaviour of this one.

  • init (may be null): called once, before the function is bound, with the node’s fn.-prefixed config keys, prefix removed, as key=value;.... Returns the ctx the function is called with, or null if the function cannot be configured. Catalyst’s frontend adds the controller’s message sizes as in_bytes=<n> and out_bytes=<n>, so init must accept both keys. A function may check them against what it processes and return null on a mismatch.

  • fini (may be null): releases the ctx init returned, once the session using it has stopped.

The returned pointer must stay valid for the life of the library.

Public Members

uint32_t abi_version
uint32_t reserved
void *(*init)(const char *config)
void (*fini)(void *ctx)