# soda-pool
⚠️ **Note**: Soda-pool library is in experimental stage.
Features may change, and breaking changes can occur while I integrate it in the production code I am working on. Use with caution.
# Overview
Soda-pool is a set of libraries meant to help adapt [tonic](https://github.com/hyperium/tonic) gRPC clients to be used in more dynamic world of microservices.
[Soda-pool](https://crates.io/crates/soda-pool) provides a dynamic, automatically managed pool of gRPC channels. Unlike the basic tonic's [balanced channel](https://docs.rs/tonic/latest/tonic/transport/struct.Channel.html#method.balance_channel), soda's pool is based on DNS resolution and automatically updates periodically to keep in sync with the true state of network.
Soda-pool is designed to be used in tandem with [soda-pool-build](https://crates.io/crates/soda-pool-build) rather than on it's own. Soda-pool-build builds upon soda-pool and tonic-build and can generate a gRPC client that on top of further simplifying channel pool management, supports also automatic request retrying.
# Features
- Automatically managed and updated gRPC connection pool
- Configurable retrying of failed requests
For considered future features, see [the roadmap](./ROADMAP.md).
# Getting started
All of the documentation and examples assume prior familiarity with [tonic](https://hyperium/tonic) ecosystem.
- [example-generator](./example/generator/src/main.rs) crate has a basic example of using a builder to generate a client that uses soda-pool internally.
- [example-protobuf](./example/protobuf.gen/src/health_pool.rs) crate has an exemplary client code generated by soda-pool-build.
- [example-client](./example/client/src/main.rs) crate has a basic example of using the aforementioned client.
While soda-pool channel pool can be used directly, it is not designed to be done so, so no examples are given beyond the [crate's documentation](https://docs.rs/soda-pool).
## Rust Version
At this experimental stage, crates are developed against the latest stable Rust version. I plan on lowering MSRV as far as reasonable soon.
## Dependencies
Soda-pool and generated clients depends heavily on `tonic` and `tokio` and the generated client code shares dependencies with the one generated by `tonic-build`.
# Project Layout
- [soda-pool](./soda-pool/): gRPC dynamic channel pool implementation.
- [soda-poll-build](./soda-pool-build/): [tonic-build](https://github.com/hyperium/tonic) based client codegen.
- [example](./example/): Usage example used also for basic manual testing.
#### License
<sup>
Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
</sup>
<sub>
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.
</sub>