[][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 APIs 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 Envoy host ABI.

http

Envoy HTTP API.

log

Envoy Log API.

shared_data

Envoy Shared Data API.

shared_queue

Envoy Shared Queue API.

stats

Envoy Stats API.

stream_info

Envoy Stream Info API.

time

Envoy Time API.

Structs

ByteString

Represents a string value that is not necessarily UTF-8 encoded, e.g. an HTTP header value.

Error

The Error type, a wrapper around a dynamic error type.

HeaderMap
HttpClientRequestHandle

Opaque identifier of a request made via HTTP Client API.

Traits

ErrorContext

Provides the context method for Result.

Type Definitions

Result

Result<T, Error>