Skip to content

Implementation of the pick_first LB policy #2340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions grpc/src/client/load_balancing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
pub mod child_manager;
pub mod pick_first;

#[cfg(test)]
pub mod test_utils;

pub(crate) mod registry;
use super::{service_config::LbConfig, subchannel::SubchannelStateWatcher};
pub(crate) use registry::{LbPolicyRegistry, GLOBAL_LB_REGISTRY};
Expand Down Expand Up @@ -89,7 +92,7 @@
pub fn new(json: &str) -> Result<Self, String> {
match serde_json::from_str(json) {
Ok(value) => Ok(ParsedJsonLbConfig { value }),
Err(e) => Err(format!("failed to parse LB config JSON: {}", e)),

Check warning on line 95 in grpc/src/client/load_balancing/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
}
}

Expand All @@ -108,7 +111,7 @@
let res: T = match serde_json::from_value(self.value.clone()) {
Ok(v) => v,
Err(e) => {
return Err(format!("{}", e).into());

Check warning on line 114 in grpc/src/client/load_balancing/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
}
};
Ok(res)
Expand Down Expand Up @@ -209,7 +212,7 @@
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "connectivity_state: {}", self.connectivity_state)?;
if let Some(err) = &self.last_connection_error {
write!(f, ", last_connection_error: {}", err)?;

Check warning on line 215 in grpc/src/client/load_balancing/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

variables can be used directly in the `format!` string
}
Ok(())
}
Expand Down
Loading
Loading