Skip to main content

featherbit/plugins/native/
client.rs

1//! The `client` node — the fixed terminal point of every policy graph.
2
3use async_trait::async_trait;
4use std::collections::HashMap;
5
6use crate::context::Context;
7use crate::plugins::{Plugin, PluginOutput, PluginResult};
8
9/// The Client node is the terminal node in a routing policy.
10/// When the context reaches this node, the response is sent to the client.
11/// It is a passthrough — it does not modify the context.
12///
13/// Graph execution stops here: whatever `Context.response` holds at this point
14/// is what the server writes back to the caller. It takes no configuration.
15pub struct ClientPlugin;
16
17#[async_trait]
18impl Plugin for ClientPlugin {
19    fn plugin_type(&self) -> &str {
20        "client"
21    }
22
23    async fn execute(
24        &self,
25        ctx: Context,
26        _named_inputs: &HashMap<String, serde_json::Value>,
27    ) -> PluginResult {
28        Ok(PluginOutput {
29            context: ctx,
30            named_outputs: HashMap::new(),
31        })
32    }
33}