HttpFilter

Trait HttpFilter 

Source
pub trait HttpFilter {
    // Required method
    fn new_instance(
        &mut self,
        envoy_filter_instance: EnvoyFilterInstance,
    ) -> Box<dyn HttpFilterInstance>;

    // Provided method
    fn destroy(&self) { ... }
}
Expand description

A trait that represents a single HTTP filter in the Envoy filter chain. It is used to create HttpFilterInstance(s) that correspond to each HTTP request.

This is only created once per module instance via the new_http_filter function.

Required Methods§

Source

fn new_instance( &mut self, envoy_filter_instance: EnvoyFilterInstance, ) -> Box<dyn HttpFilterInstance>

This is called for each new HTTP request. This should return a new HttpFilterInstance object to handle the request.

Note that this must be concurrency-safe as it can be called concurrently for multiple requests.

  • envoy_filter_instance is the Envoy filter object that is used to interact with the underlying Envoy filter. This object is unique for each HTTP request. The object is destroyed when the stream is destroyed. Therefore, after event_http_destroy is called, the methods on this object become no-op.

Provided Methods§

Source

fn destroy(&self)

destroy is called when this filter is destroyed. E.g. the filter chain configuration is updated and removed from the Envoy.

After this returns, the filter object is destructed.

Implementors§