Skip to main content

Module patterns

Module patterns 

Source
Expand description

Services, actions and streams (blueprint §9.4).

All three ride ordinary edges plus metadata correlation — no separate RPC subsystem: services (request_id), actions (goal_id/goal_status FSM: Accepted→Executing→{Succeeded, Aborted, Canceled}), streams (session_id/segment_id/seq/fin/flush).

That sentence is the whole design. There is no service socket, no action server, no stream channel — there are edges, and there is astrs_wire::Metadata. What this module adds is the bookkeeping that makes the three patterns correct rather than merely expressible:

PatternWhat is easy to get wrongWhat this module does
serviceAnswering with the wrong (or no) request_idServiceRequest carries the id; the response helper copies it
actionAn illegal FSM transition, or a status after a terminal oneGoalTracker refuses both
streamGaps, reordering, a segment that never endsStreamAssembler detects all three

§Eviction immunity comes for free

A message carrying request_id, goal_id or goal_status is eviction-immune in every input queue (§11.2), because astrs_wire::Metadata::is_correlated says so and crate::events::QueuedEvent forwards that to the scheduler. So a service response cannot be the message a full queue drops — which is the one drop that would wedge a client forever.

Re-exports§

pub use action::ActionOutcome;
pub use action::GoalId;
pub use action::GoalTracker;
pub use service::RequestId;
pub use service::ServiceRequest;
pub use service::ServiceResponse;
pub use stream::ChunkRef;
pub use stream::StreamAssembler;
pub use stream::StreamSegment;
pub use stream::StreamWriter;

Modules§

action
Long-running goals with a status FSM (blueprint §9.4, goal_id/goal_status).
service
Request/response over ordinary edges (blueprint §9.4, request_id).
stream
Chunked transfers over ordinary edges (blueprint §9.4, session_id/segment_id/seq/fin/flush).

Functions§

fresh_id
A fresh, unique correlation id.