@@ -365,6 +365,18 @@ pub trait HttpFilter<EHF: EnvoyHttpFilter> {
365365 ///
366366 /// See [`EnvoyHttpFilter::new_scheduler`] for more details on how to use this.
367367 fn on_scheduled ( & mut self , _envoy_filter : & mut EHF , _event_id : u64 ) { }
368+
369+ /// This is called when the downstream buffer size goes above the high watermark for a
370+ /// terminal filter.
371+ ///
372+ /// * `envoy_filter` can be used to interact with the underlying Envoy filter object.
373+ fn on_downstream_above_write_buffer_high_watermark ( & mut self , _envoy_filter : & mut EHF ) { }
374+
375+ /// This is called when the downstream buffer size goes below the low watermark for a
376+ /// terminal filter.
377+ ///
378+ /// * `envoy_filter` can be used to interact with the underlying Envoy filter object.
379+ fn on_downstream_below_write_buffer_low_watermark ( & mut self , _envoy_filter : & mut EHF ) { }
368380}
369381
370382/// An opaque object that represents the underlying Envoy Http filter config. This has one to one
@@ -2148,8 +2160,10 @@ impl EnvoyHttpFilterImpl {
21482160/// Since this is primarily designed to be used from a different thread than the one
21492161/// where the [`HttpFilter`] instance was created, it is marked as `Send` so that
21502162/// the [`Box<dyn EnvoyHttpFilterScheduler>`] can be sent across threads.
2163+ ///
2164+ /// It is also safe to be called concurrently, so it is marked as `Sync` as well.
21512165#[ automock]
2152- pub trait EnvoyHttpFilterScheduler : Send {
2166+ pub trait EnvoyHttpFilterScheduler : Send + Sync {
21532167 /// Commit the scheduled event to the worker thread where [`HttpFilter`] is running.
21542168 ///
21552169 /// It accepts an `event_id` which can be used to distinguish different events
@@ -2168,6 +2182,7 @@ struct EnvoyHttpFilterSchedulerImpl {
21682182}
21692183
21702184unsafe impl Send for EnvoyHttpFilterSchedulerImpl { }
2185+ unsafe impl Sync for EnvoyHttpFilterSchedulerImpl { }
21712186
21722187impl Drop for EnvoyHttpFilterSchedulerImpl {
21732188 fn drop ( & mut self ) {
@@ -2472,6 +2487,26 @@ unsafe extern "C" fn envoy_dynamic_module_on_http_filter_scheduled(
24722487 filter. on_scheduled ( & mut EnvoyHttpFilterImpl :: new ( envoy_ptr) , event_id) ;
24732488}
24742489
2490+ #[ no_mangle]
2491+ unsafe extern "C" fn envoy_dynamic_module_on_http_filter_downstream_above_write_buffer_high_watermark (
2492+ envoy_ptr : abi:: envoy_dynamic_module_type_http_filter_envoy_ptr ,
2493+ filter_ptr : abi:: envoy_dynamic_module_type_http_filter_module_ptr ,
2494+ ) {
2495+ let filter = filter_ptr as * mut * mut dyn HttpFilter < EnvoyHttpFilterImpl > ;
2496+ let filter = & mut * * filter;
2497+ filter. on_downstream_above_write_buffer_high_watermark ( & mut EnvoyHttpFilterImpl :: new ( envoy_ptr) ) ;
2498+ }
2499+
2500+ #[ no_mangle]
2501+ unsafe extern "C" fn envoy_dynamic_module_on_http_filter_downstream_below_write_buffer_low_watermark (
2502+ envoy_ptr : abi:: envoy_dynamic_module_type_http_filter_envoy_ptr ,
2503+ filter_ptr : abi:: envoy_dynamic_module_type_http_filter_module_ptr ,
2504+ ) {
2505+ let filter = filter_ptr as * mut * mut dyn HttpFilter < EnvoyHttpFilterImpl > ;
2506+ let filter = & mut * * filter;
2507+ filter. on_downstream_below_write_buffer_low_watermark ( & mut EnvoyHttpFilterImpl :: new ( envoy_ptr) ) ;
2508+ }
2509+
24752510impl From < envoy_dynamic_module_type_metrics_result >
24762511 for Result < ( ) , envoy_dynamic_module_type_metrics_result >
24772512{
0 commit comments