Add stateful call leaf runtime

This commit is contained in:
Michael Mikovsky
2026-04-25 15:35:08 -06:00
parent 56bc7ee4f8
commit 7e266e2a38
18 changed files with 1349 additions and 388 deletions
+2 -1
View File
@@ -205,6 +205,7 @@ impl ProtocolEndpoint {
data: Vec<u8>,
end_hook: bool,
) -> Result<EndpointOutcome, EndpointError> {
let local_end_dst_path = dst_path.clone();
let (header, message) =
self.prepare_data(dst_path, hook_id, procedure_id, data, end_hook)?;
@@ -213,7 +214,7 @@ impl ProtocolEndpoint {
// so fall back to the endpoint's own hook key shape when closing them.
let local_hook_key = self
.hooks
.resolve_active_key(&self.path, hook_id, &self.path)
.resolve_active_key(&local_end_dst_path, hook_id, &self.path)
.unwrap_or_else(|| HookKey::new(self.path.clone(), hook_id));
if self.hooks.mark_local_end(&local_hook_key) {
self.hooks.remove_active(&local_hook_key);
+3 -1
View File
@@ -11,7 +11,7 @@ use crate::protocol::{
CallMessage, DataMessage, FaultMessage, FrameBytes, FrameError, PacketHeader, ValidationError,
};
use super::super::{CompiledRoutes, HookTable, RouteDecision};
use super::super::{CompiledRoutes, HookKey, HookTable, RouteDecision};
/// Registration state for a direct child endpoint.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -66,10 +66,12 @@ pub enum LocalEvent {
Data {
header: PacketHeader,
message: DataMessage,
hook_key: HookKey,
},
Fault {
header: PacketHeader,
message: FaultMessage,
hook_key: HookKey,
},
}
+9 -1
View File
@@ -35,6 +35,7 @@ impl ProtocolEndpoint {
RouteDecision::Local => Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
hook_key: key,
})),
route => Ok(EndpointOutcome::forward(
route,
@@ -75,6 +76,7 @@ impl ProtocolEndpoint {
message: FaultMessage {
fault: ProtocolFault::INVALID_HOOK_PEER,
},
hook_key: key,
}));
}
@@ -87,7 +89,11 @@ impl ProtocolEndpoint {
self.hooks.remove_active(&key);
}
Ok(EndpointOutcome::event(LocalEvent::Data { header, message }))
Ok(EndpointOutcome::event(LocalEvent::Data {
header,
message,
hook_key: key,
}))
}
pub(crate) fn handle_local_fault(
@@ -104,6 +110,7 @@ impl ProtocolEndpoint {
return Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
hook_key: key,
}));
}
@@ -117,6 +124,7 @@ impl ProtocolEndpoint {
return Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
hook_key: pending_key,
}));
}
@@ -75,6 +75,7 @@ impl ProtocolEndpoint {
Ok(EndpointOutcome::event(super::core::LocalEvent::Data {
header: response_header,
message: response,
hook_key: key,
}))
}
route => Ok(EndpointOutcome::forward(