[−][src]Module envoy_sdk::host
Envoy
Host APIs
provided for use by extensions.
Structure
Every supported Envoy
Host API
is represented by a trait object,
e.g. Clock
, HttpClient
, Stats
, etc.
Extensions get parameterized with a concrete implementation of Host API
s
at the time of their construction.
This way, you can swap a real Host API
with a mock when unit testing your
extension.
Examples
Parameterize HTTP Filter extension with Envoy
Clock
:
use envoy::host::Clock; struct MyHttpFilter<'a> { clock: &'a dyn Clock, } impl<'a> MyHttpFilter<'a> { /// Creates a new instance parameterized with a given [`Clock`] implementation. pub fn new(clock: &'a dyn Clock) -> Self { MyHttpFilter { clock } } /// Creates a new instance parameterized with the default [`Clock`] implementation. pub fn default() -> Self { Self::new(Clock::default()) } }
Re-exports
pub use self::http::client::HttpClient; |
pub use self::http::client::HttpClientResponseOps; |
pub use self::shared_data::SharedData; |
pub use self::shared_queue::SharedQueue; |
pub use self::stats::Stats; |
pub use self::stream_info::StreamInfo; |
pub use self::time::Clock; |
Modules
error | Errors specific to interaction with |
http |
|
log |
|
shared_data |
|
shared_queue |
|
stats |
|
stream_info |
|
time |
|
Structs
ByteString | Represents a string value that is not necessarily UTF-8 encoded, e.g. an HTTP header value. |
Error | The |
HeaderMap | |
HttpClientRequestHandle | Opaque identifier of a request made via |
Traits
ErrorContext | Provides the |
Type Definitions
Result |
|