Files
unshell/src/protocol/introspection.rs
T

42 lines
1.6 KiB
Rust
Raw Normal View History

2026-04-24 13:37:30 -06:00
//! Required introspection payloads for discovery.
2026-04-24 12:32:24 -06:00
use alloc::{string::String, vec::Vec};
use rkyv::{Archive, Deserialize, Serialize};
/// Reserved procedure id for protocol introspection.
///
/// The protocol uses the empty string here so discovery traffic stays outside the normal
/// application procedure namespace. [`crate::protocol::validate_procedure_id`] reserves that
/// value exclusively for introspection.
2026-04-24 12:32:24 -06:00
pub const INTROSPECTION_PROCEDURE_ID: &str = "";
/// Endpoint-wide introspection payload.
#[derive(Archive, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct EndpointIntrospection {
/// Direct child endpoint segment names hosted immediately below this endpoint.
2026-04-25 11:27:29 -06:00
pub sub_endpoints: Vec<String>,
/// Leaf summaries hosted directly at this endpoint.
2026-04-24 12:32:24 -06:00
pub leaves: Vec<LeafIntrospectionSummary>,
}
/// Shared per-leaf discovery record.
#[derive(Archive, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct LeafIntrospectionSummary {
/// Canonical dotted leaf identifier.
2026-04-24 12:32:24 -06:00
pub leaf_name: String,
/// Exhaustive canonical procedure ids currently exposed by the leaf.
2026-04-24 12:32:24 -06:00
pub procedures: Vec<String>,
}
/// Leaf-specific introspection payload.
///
/// This duplicates [`LeafIntrospectionSummary`] intentionally because the leaf-only response is
/// a distinct wire payload from the endpoint-wide discovery response.
2026-04-24 12:32:24 -06:00
#[derive(Archive, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
pub struct LeafIntrospection {
/// Canonical dotted leaf identifier.
2026-04-24 12:32:24 -06:00
pub leaf_name: String,
/// Exhaustive canonical procedure ids currently exposed by the leaf.
2026-04-24 12:32:24 -06:00
pub procedures: Vec<String>,
}