Skip to main content

Module pool

Module pool 

Source
Expand description

The helper processes that call the operating system, and the way srv talks to them.

The shell loads third-party code (icon handlers, codecs, cloud providers), so none of it runs in srv: srv re-runs its own executable as a small helper (super::CHILD_ARG), sends it one request at a time over its pipes and kills it when it doesn’t answer in time (spec §4.2). The helper dies with srv: its stdin closes.

Protocol, one request in flight per helper. Request: one JSON line, {"kind":"file","ext":"rs","px":16}. Answer: one JSON line, either {"ok":true,"len":N} followed by N bytes of PNG, or {"ok":false,"err":"..."}.

Structs§

Pool
The helpers and the line of requests waiting for one.
WireAnswer
WireRequest

Constants§

DEADLINE
How long one request may take before its helper is killed.
ERR_NO_ICON
What the helper says when it has no icon for a request.
MAX_PNG_BYTES
The most a picture may weigh. A 256 px RGBA PNG is far smaller.
QUEUE_MAX
Requests allowed to wait for a helper before the rest are refused.
WORKERS
Helpers kept: one slow icon shouldn’t hold up every other.

Functions§

exchange
Send req and read the answer. A helper-reported error leaves the helper usable.
exchange_within
exchange that gives up after deadline.