From fa5410862d4abeee31bed9bedfcf16b59b2ad2cf Mon Sep 17 00:00:00 2001 From: dd di cesare Date: Fri, 30 Aug 2024 11:55:53 +0200 Subject: [PATCH] [wip] Using the dispatcher... taking notes Signed-off-by: dd di cesare --- src/filter/http_context.rs | 5 +++++ src/filter/root_context.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/filter/http_context.rs b/src/filter/http_context.rs index fa80e75c..e21ca22a 100644 --- a/src/filter/http_context.rs +++ b/src/filter/http_context.rs @@ -1,3 +1,4 @@ +use crate::action_dispatcher::ActionDispatcher; use crate::configuration::{FailureMode, FilterConfig}; use crate::envoy::{RateLimitResponse, RateLimitResponse_Code}; use crate::policy::Policy; @@ -14,6 +15,7 @@ pub struct Filter { pub config: Rc, pub response_headers_to_add: Vec<(String, String)>, pub header_resolver: Rc, + pub action_dispatcher: Rc, } impl Filter { @@ -40,6 +42,9 @@ impl Filter { return Action::Continue; } + // ActionDispatcher gets populated with actions, on Pending State + // ActionDispatcher calls next, with service and message. Or probably it needs to initiate the messages on previous step and attach services when created? + // todo(adam-cattermole): For now we just get the first GrpcService but we expect to have // an action which links to the service that should be used let rls = self diff --git a/src/filter/root_context.rs b/src/filter/root_context.rs index 90774e1c..5ae6d70a 100644 --- a/src/filter/root_context.rs +++ b/src/filter/root_context.rs @@ -1,3 +1,4 @@ +use crate::action_dispatcher::ActionDispatcher; use crate::configuration::{FilterConfig, PluginConfiguration}; use crate::filter::http_context::Filter; use crate::service::HeaderResolver; @@ -42,6 +43,7 @@ impl RootContext for FilterRoot { config: Rc::clone(&self.config), response_headers_to_add: Vec::default(), header_resolver: Rc::new(HeaderResolver::new()), + action_dispatcher: Rc::new(ActionDispatcher::default()), })) }