refactor: remove unneeded comments
This commit is contained in:
parent
5cba376394
commit
96810a4d4f
2 changed files with 12 additions and 11 deletions
|
|
@ -12,12 +12,8 @@ pub(super) mod load_balance_options {
|
|||
pub const STICKY_ROUND_ROBIN: &str = "sticky";
|
||||
}
|
||||
|
||||
//
|
||||
// /// Counter for load balancing
|
||||
// pub cnt: UpstreamCount,
|
||||
|
||||
// TODO: カウンタの移動
|
||||
#[derive(Debug, Clone, Builder)]
|
||||
/// Counter object as a pointer to the current serving upstream destination
|
||||
pub struct LbRoundRobinCount {
|
||||
#[builder(default)]
|
||||
cnt: Arc<AtomicUsize>,
|
||||
|
|
@ -52,12 +48,12 @@ impl LbRoundRobinCount {
|
|||
pub enum LoadBalance {
|
||||
/// Fix to the first upstream. Use if only one upstream destination is specified
|
||||
FixToFirst,
|
||||
/// Simple round robin without session persistance
|
||||
RoundRobin(LbRoundRobinCount), // TODO: カウンタはここにいれる。randomとかには不要なので
|
||||
/// Randomly chose one upstream server
|
||||
Random,
|
||||
/// Simple round robin without session persistance
|
||||
RoundRobin(LbRoundRobinCount),
|
||||
/// Round robin with session persistance using cookie
|
||||
StickyRoundRobin,
|
||||
StickyRoundRobin(LbRoundRobinCount),
|
||||
}
|
||||
impl Default for LoadBalance {
|
||||
fn default() -> Self {
|
||||
|
|
|
|||
|
|
@ -96,14 +96,19 @@ impl UpstreamGroupBuilder {
|
|||
let lb = if let Some(x) = v {
|
||||
match x.as_str() {
|
||||
lb_opts::FIX_TO_FIRST => LoadBalance::FixToFirst,
|
||||
lb_opts::RANDOM => LoadBalance::Random,
|
||||
lb_opts::ROUND_ROBIN => LoadBalance::RoundRobin(
|
||||
LbRoundRobinCountBuilder::default()
|
||||
.max_val(upstream_num)
|
||||
.build()
|
||||
.unwrap(),
|
||||
),
|
||||
lb_opts::RANDOM => LoadBalance::Random,
|
||||
lb_opts::STICKY_ROUND_ROBIN => LoadBalance::StickyRoundRobin,
|
||||
lb_opts::STICKY_ROUND_ROBIN => LoadBalance::StickyRoundRobin(
|
||||
LbRoundRobinCountBuilder::default()
|
||||
.max_val(upstream_num)
|
||||
.build()
|
||||
.unwrap(),
|
||||
),
|
||||
_ => {
|
||||
error!("Specified load balancing option is invalid.");
|
||||
LoadBalance::default()
|
||||
|
|
@ -143,7 +148,7 @@ impl UpstreamGroup {
|
|||
let max = self.upstream.len() - 1;
|
||||
self.upstream.get(rng.gen_range(0..max))
|
||||
}
|
||||
LoadBalance::StickyRoundRobin => todo!(), // TODO: TODO:
|
||||
LoadBalance::StickyRoundRobin(_cnt) => todo!(), // TODO: TODO:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue