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.
- Wire
Answer - Wire
Request
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
reqand read the answer. A helper-reported error leaves the helper usable. - exchange_
within exchangethat gives up afterdeadline.