diff --git a/Cargo.toml b/Cargo.toml index ca4f737f2..b89fe5ab3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ "examples", "codegen", "grpc", + "xds-client", "interop", # Tests "tests/disable_comments", "tests/wellknown", diff --git a/xds-client/Cargo.toml b/xds-client/Cargo.toml new file mode 100644 index 000000000..b1e247617 --- /dev/null +++ b/xds-client/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "xds-client" +description = "An xDS client implementation in Rust" +version = "0.1.0-alpha.1" +edition = "2021" +homepage = "https://github.com/hyperium/tonic" +repository = "https://github.com/hyperium/tonic" +license = "MIT" +rust-version = { workspace = true } + +[lints] +workspace = true + +[dependencies] + +[features] +default = ["transport-tonic"] +transport-tonic = ["rt-tokio", "codegen-prost"] +rt-tokio = [] +codegen-prost = [] diff --git a/xds-client/src/client/mod.rs b/xds-client/src/client/mod.rs new file mode 100644 index 000000000..a5e53b7e0 --- /dev/null +++ b/xds-client/src/client/mod.rs @@ -0,0 +1 @@ +//! Client interface through which the user can watch and receive updates for xDS resources. diff --git a/xds-client/src/error.rs b/xds-client/src/error.rs new file mode 100644 index 000000000..3801c7b06 --- /dev/null +++ b/xds-client/src/error.rs @@ -0,0 +1 @@ +//! Error types for the xDS client. diff --git a/xds-client/src/lib.rs b/xds-client/src/lib.rs new file mode 100644 index 000000000..e2420a0b1 --- /dev/null +++ b/xds-client/src/lib.rs @@ -0,0 +1,13 @@ +//! A Rust implementation of [xDS](https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol) client. +//! +//! # Feature Flags +//! +//! - `transport-tonic`: Enables the use of the `tonic` transport. This enables `rt-tokio` and `codegen-prost` features. Enabled by default. +//! - `rt-tokio`: Enables the use of the `tokio` runtime. Enabled by default. +//! - `codegen-prost`: Enables the use of the `prost` codec generated resources. Enabled by default. + +pub mod client; +pub mod error; +pub mod resource; +pub mod runtime; +pub mod transport; diff --git a/xds-client/src/resource/mod.rs b/xds-client/src/resource/mod.rs new file mode 100644 index 000000000..0f83946f2 --- /dev/null +++ b/xds-client/src/resource/mod.rs @@ -0,0 +1,4 @@ +//! Provides abstraction for xDS resources. + +#[cfg(feature = "codegen-prost")] +pub mod prost; diff --git a/xds-client/src/resource/prost.rs b/xds-client/src/resource/prost.rs new file mode 100644 index 000000000..879d33a6f --- /dev/null +++ b/xds-client/src/resource/prost.rs @@ -0,0 +1 @@ +//! `prost` codec-specific resources. diff --git a/xds-client/src/runtime/mod.rs b/xds-client/src/runtime/mod.rs new file mode 100644 index 000000000..0173a8c8c --- /dev/null +++ b/xds-client/src/runtime/mod.rs @@ -0,0 +1,4 @@ +//! Provides abstraction for async runtimes. + +#[cfg(feature = "rt-tokio")] +pub mod tokio; diff --git a/xds-client/src/runtime/tokio.rs b/xds-client/src/runtime/tokio.rs new file mode 100644 index 000000000..ed894730b --- /dev/null +++ b/xds-client/src/runtime/tokio.rs @@ -0,0 +1 @@ +//! `tokio` based runtime implementation. diff --git a/xds-client/src/transport/mod.rs b/xds-client/src/transport/mod.rs new file mode 100644 index 000000000..a162b11e9 --- /dev/null +++ b/xds-client/src/transport/mod.rs @@ -0,0 +1,4 @@ +//! Provides abstraction for transport layers. + +#[cfg(feature = "transport-tonic")] +pub mod tonic; diff --git a/xds-client/src/transport/tonic.rs b/xds-client/src/transport/tonic.rs new file mode 100644 index 000000000..068c36f37 --- /dev/null +++ b/xds-client/src/transport/tonic.rs @@ -0,0 +1 @@ +//! `tonic` based transport implementation.