pulzr-codec serve answers on port 5600 (PORT), on every address, or on
127.0.0.1 alone without authentication (BIND overrides either). It reads
engine.wasm beside the binary, or at PULZR_ENGINE.
| Route |
Body |
Answer |
POST /decode |
{package_hash, decoder_source | decoder_wasm, input} |
The codec’s decodeUplink answer |
POST /encode |
the same |
Its encodeDownlink answer |
POST /library/decode, /library/encode |
{package_hash, decoder_source?, input} |
The same, for a library codec: the source on the first call, the hash alone after |
POST /bundle |
{codec, libraries: {name: {label, manifest, files: {path: text}}}} |
{source, sha256, modules}, or 422 with what the author must fix |
GET /health |
|
Its limits, and the calls running and waiting |
package_hash keys the compiled codec: the same hash is the same codec.
input reaches the codec as the text that was sent.
- A codec’s failure is an answer, 200 with
errors; the answer carries
engine, the engine’s name.
- 401 without a valid token, 503 when nothing may call it, 413 for a body over
512 KB (a library’s, over its source limit), 409 for a library codec called
by hash that this instance has not loaded (send the source).
PULZR_CODEC_AUTH |
|
none |
Anyone who can reach it, so it binds 127.0.0.1 unless BIND says otherwise: a laptop, a CI job or a gateway serving itself |
oidc, the default when OIDC_ISSUER is set |
A bearer token (RS256) whose key is in OIDC_JWKS_URL, from one of OIDC_ISSUER (comma-separated), carrying the client role OIDC_ROLE in resource_access[OIDC_CLIENT_ID].roles, as Keycloak puts a service account’s roles |
| unset |
Nobody: every call answers 503, so a deployment that forgot its settings is closed rather than open |
The key set is fetched on first use, again for a key id it does not hold (at
most every 30 s), and once it is ten minutes old.
| Variable |
Default |
|
DECODER_TIME_MS |
50 |
One call |
DECODER_MEMORY_BYTES |
16 MiB |
A codec’s heap |
DECODER_WORKERS |
CPUs, up to 4 |
Calls at once |
DECODER_MAX_QUEUE |
64 |
Calls waiting, beyond which it answers 503 |
DECODER_CACHE_ENTRIES |
1,024 |
Warm instances across the process |
DECODER_ARTIFACT_BYTES |
256 MiB |
Compiled codecs kept beyond the warm ones |
LIBRARY_TIME_MS |
1,000 |
A library codec’s call |
LIBRARY_LOAD_MS |
3,000 |
Its first load |
LIBRARY_MEMORY_BYTES |
32 MiB |
Its heap |
LIBRARY_CACHE_BYTES |
192 MiB |
What warm library instances may add up to |
LIBRARY_WORKERS, LIBRARY_MAX_QUEUE |
1, 32 |
|
| At a limit |
Answer |
| A loop, or a regex backtracking |
decoder exceeded 50 ms, within half a second |
| Allocation without end |
decoder exceeded 16 MB |
| Recursion without end |
decoder threw: InternalError: stack overflow |
| A throw |
decoder threw: Error: ..., and the next call is a fresh instance |
| A native module importing WASI, another version or an unknown call |
Refused at load |
Four codecs looping at once do not stop another codec’s calls; a panic in the
host ends its call as an error and nothing else.