Skip to content

util/service: Add the IPC service seam traits - #485

Merged
chrysh merged 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:util-service-traits
Sep 25, 2026
Merged

chrysh merged 1 commit into
OpenPRoT:ocp-global-demo-wipfrom
9elements:util-service-traits

Conversation

@chrysh

@chrysh chrysh commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

The seams every IPC service is built from, held once instead of copied
per service. i2c and pldm each carry their own transport trait, dispatch
function and error type today, and the two have already drifted.

Transport blocks until the response arrives; AsyncTransport splits the
round-trip so an event-loop caller never blocks. A type implements
whichever it can serve, or both. Dispatch is the server end: one request
frame in, one response frame out.

Transport takes no deadline. i2c's seam has none today (IpcTransport
hardcodes Instant::MAX), and a host-buildable crate cannot name
userspace::time::Instant. Timeouts are the caller's concern; a caller
that cannot block uses AsyncTransport.

#479 has merged, so this is one commit on ocp-global-demo-wip with
nothing stacked below it.

Not in this PR, and no longer hypothetical: the generic Loopback over
Dispatch is #498, the kernel AsyncChannelTransport is #497, and the
pldm migration onto this seam is #499. i2c has not moved yet. mctp has no transport seam today and spdm, storage and
telemetry are not IPC-shaped, so none of them are in scope.

Assisted-by: Claude Code

@rusty1968

Copy link
Copy Markdown
Collaborator

will merge after #479

@rusty1968

Copy link
Copy Markdown
Collaborator

Please review and check if this is still required.

Every IPC service so far has defined its own copy of the same three
seams: a transport trait, a server dispatch function, and the error
type between them. i2c and pldm each carry one, and they have already
drifted apart. This crate holds them once so a service defines its
wire format and nothing else.

Transport blocks until the response arrives; AsyncTransport splits the
round-trip so an event-loop caller never blocks. A type implements
whichever it can serve, or both.

Dispatch is the server end, one request frame in, one response frame
out. It returns Result rather than a byte count with 0 meaning failure:
a service that merely failed an operation encodes that into the response
frame and still returns Ok, and the one case with nothing to send back
is a response buffer too small to hold even an error frame.

Traits only, no implementations and no migrations, so there is nothing
to unit test here. The generic loopback and the kernel channel
transport follow, then i2c and pldm move over.

Assisted-by: Claude Code
@chrysh
chrysh force-pushed the util-service-traits branch from 3e5d386 to 11bc272 Compare September 25, 2026 13:32
@chrysh
chrysh marked this pull request as ready for review September 25, 2026 13:41
@chrysh
chrysh merged commit 8387af8 into OpenPRoT:ocp-global-demo-wip Sep 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants