Skip to main content

zenkey_fleet/report/
service.rs

1//! The `@rpc` plane: producers, their procedures, and what a procedure
2//! declares (RFC 05 §3, RFC 08 §6.1).
3
4use serde::Serialize;
5
6#[derive(Debug, Clone, Serialize)]
7pub struct ServiceRow {
8    pub producer: String,
9    pub registry_version: String,
10    pub kind: String,
11    pub path: String,
12    #[serde(skip_serializing_if = "Option::is_none")]
13    pub request: Option<String>,
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub reply: Option<String>,
16}
17
18#[derive(Debug, Clone, Serialize)]
19pub struct ServiceList {
20    pub procedures: Vec<ServiceRow>,
21}
22
23/// One procedure, with everything the registry declares about it and the key
24/// shape a caller would actually use (issue #211).
25#[derive(Debug, Clone, Serialize)]
26pub struct ServiceProcedure {
27    pub path: String,
28    pub kind: String,
29    /// The base-relative `@rpc` key this procedure answers on, with `{origin}`
30    /// standing for the publishing identity. A service origin has no producer
31    /// chunk (RFC 06 §5), so the two shapes genuinely differ and the reader
32    /// should not have to reconstruct which applies.
33    pub key: String,
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub request: Option<String>,
36    #[serde(skip_serializing_if = "Option::is_none")]
37    pub reply: Option<String>,
38    /// `forbidden` means the fleet spelling does not exist for this procedure
39    /// (RFC 08 §1.1 G2) — worth seeing *before* reaching for `*`.
40    #[serde(skip_serializing_if = "Option::is_none")]
41    pub fanout: Option<String>,
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub idempotent: Option<bool>,
44    #[serde(skip_serializing_if = "Option::is_none")]
45    pub encoding: Option<String>,
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub since: Option<String>,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub description: Option<String>,
50}
51
52/// One producer's `@rpc` surface — the verb a user reaches for immediately
53/// before `service call` (issue #211).
54///
55/// `service list` says *what exists* across the fleet; this says *what one
56/// producer offers and how to call it*, which is the question left over.
57#[derive(Debug, Clone, Serialize)]
58pub struct ServiceInfo {
59    pub producer: String,
60    pub registry_version: String,
61    /// Present when this producer is a service origin (RFC 06 §5) — its keys
62    /// carry no producer chunk.
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub service_origin: Option<String>,
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub description: Option<String>,
67    pub procedures: Vec<ServiceProcedure>,
68}