Reformat lines.

This commit is contained in:
Michael Mikovsky
2026-04-25 12:41:10 -06:00
parent 080f55ddd3
commit 4a131e6b63
9 changed files with 77 additions and 37 deletions
+12 -4
View File
@@ -167,7 +167,10 @@ impl ProtocolEndpoint {
match self.decide_route(&header.dst_path) {
RouteDecision::Local => self.handle_local_call(header, call),
route => Ok(EndpointOutcome::forward(route, encode_packet(&header, &call)?)),
route => Ok(EndpointOutcome::forward(
route,
encode_packet(&header, &call)?,
)),
}
}
@@ -179,7 +182,8 @@ impl ProtocolEndpoint {
data: Vec<u8>,
end_hook: bool,
) -> Result<FrameBytes, EndpointError> {
let (header, message) = self.prepare_data(dst_path, hook_id, procedure_id, data, end_hook)?;
let (header, message) =
self.prepare_data(dst_path, hook_id, procedure_id, data, end_hook)?;
Ok(encode_packet(&header, &message)?)
}
@@ -191,7 +195,8 @@ impl ProtocolEndpoint {
data: Vec<u8>,
end_hook: bool,
) -> Result<EndpointOutcome, EndpointError> {
let (header, message) = self.prepare_data(dst_path, hook_id, procedure_id, data, end_hook)?;
let (header, message) =
self.prepare_data(dst_path, hook_id, procedure_id, data, end_hook)?;
if end_hook {
let sender_key = self
@@ -205,7 +210,10 @@ impl ProtocolEndpoint {
match self.decide_route(&header.dst_path) {
RouteDecision::Local => self.handle_local_data(header, message),
route => Ok(EndpointOutcome::forward(route, encode_packet(&header, &message)?)),
route => Ok(EndpointOutcome::forward(
route,
encode_packet(&header, &message)?,
)),
}
}
}
+20 -5
View File
@@ -32,8 +32,14 @@ impl ProtocolEndpoint {
let message = FaultMessage { fault };
match self.decide_route(&key.return_path) {
RouteDecision::Local => Ok(EndpointOutcome::event(LocalEvent::Fault { header, message })),
route => Ok(EndpointOutcome::forward(route, encode_packet(&header, &message)?)),
RouteDecision::Local => Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
})),
route => Ok(EndpointOutcome::forward(
route,
encode_packet(&header, &message)?,
)),
}
}
@@ -87,9 +93,15 @@ impl ProtocolEndpoint {
message: FaultMessage,
) -> Result<EndpointOutcome, EndpointError> {
let hook_id = header.hook_id.expect("validated");
if let Some(key) = self.hooks.resolve_active_key(&self.path, hook_id, &header.src_path) {
if let Some(key) = self
.hooks
.resolve_active_key(&self.path, hook_id, &header.src_path)
{
self.hooks.remove_active(&key);
return Ok(EndpointOutcome::event(LocalEvent::Fault { header, message }));
return Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
}));
}
let pending_key = HookKey::new(self.path.clone(), hook_id);
@@ -99,7 +111,10 @@ impl ProtocolEndpoint {
.is_some_and(|pending| pending.caller_src_path == header.src_path)
{
self.hooks.remove_pending(&pending_key);
return Ok(EndpointOutcome::event(LocalEvent::Fault { header, message }));
return Ok(EndpointOutcome::event(LocalEvent::Fault {
header,
message,
}));
}
Ok(EndpointOutcome::dropped())
+7 -4
View File
@@ -70,13 +70,16 @@ impl ProtocolEndpoint {
}
match self.decide_route(&key.return_path) {
super::super::RouteDecision::Local => Ok(EndpointOutcome::event(
super::core::LocalEvent::Data {
super::super::RouteDecision::Local => {
Ok(EndpointOutcome::event(super::core::LocalEvent::Data {
header: response_header,
message: response,
},
}))
}
route => Ok(EndpointOutcome::forward(
route,
encode_packet(&response_header, &response)?,
)),
route => Ok(EndpointOutcome::forward(route, encode_packet(&response_header, &response)?)),
}
}
}
+11 -4
View File
@@ -49,7 +49,11 @@ impl ProtocolEndpoint {
Some(leaf_name) => self
.leaves
.get(leaf_name)
.map(|leaf| leaf.procedures.iter().any(|procedure| procedure == &message.procedure_id))
.map(|leaf| {
leaf.procedures
.iter()
.any(|procedure| procedure == &message.procedure_id)
})
.unwrap_or(false),
None => self.endpoint_procedures.contains(&message.procedure_id),
};
@@ -105,12 +109,15 @@ impl Endpoint for ProtocolEndpoint {
RouteDecision::Child(index) => {
Ok(EndpointOutcome::forward(RouteDecision::Child(index), frame))
}
RouteDecision::Parent => Ok(EndpointOutcome::forward(RouteDecision::Parent, frame)),
RouteDecision::Parent => {
Ok(EndpointOutcome::forward(RouteDecision::Parent, frame))
}
RouteDecision::Drop => Ok(EndpointOutcome::dropped()),
RouteDecision::Local => {
let (header, payload) = parsed.into_parts();
let message =
deserialize_archived_bytes::<ArchivedCallMessage, CallMessage>(payload)?;
let message = deserialize_archived_bytes::<ArchivedCallMessage, CallMessage>(
payload,
)?;
validate_call(&header, &message)?;
self.handle_local_call(header, message)
}
+3 -1
View File
@@ -5,7 +5,9 @@ use alloc::{collections::BTreeMap, string::String, vec, vec::Vec};
/// Explicit test tree declaration used for configuration.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TreeNode {
Root { children: Vec<Self> },
Root {
children: Vec<Self>,
},
Endpoint {
segment: String,
leaves: Vec<LeafNode>,