Skip to main content

Module service

Module service 

Source
Expand description

Request/response over ordinary edges (blueprint §9.4, request_id).

  client                                     server
    │ service_request(req)  ──► request_id=R ──►│
    │                                           │ ServiceRequest::from_event
    │◄── request_id=R ◄──  service_response(…) ──┤
    │ ServiceResponse::matches(R)               │

A service is two edges and one metadata key. The client stamps a fresh request_id; the server copies it onto the answer; the client matches it. Nothing else is needed, and nothing else is provided — which is why a service in AstRS records, replays and type-checks exactly like any other edge.

§What goes wrong without help

Answering with no request_id, or with a fresh one, leaves a client waiting forever. Node::service_response takes the request’s metadata rather than an id, so the id it copies is the one that arrived; and it refuses — crate::NodeError::Pattern — when the metadata carries no request id at all, rather than sending an uncorrelated answer.

Structs§

RequestId
One service exchange’s correlation id (§9.4).
ServiceRequest
An incoming service request, as the server sees it.
ServiceResponse
An incoming service response, as the client sees it.