chore: update comment (#2747)

Co-authored-by: haiyux <haiyux@foxmail.com>
pull/2612/head
yonwoo9 2 years ago committed by GitHub
parent 393bf4dbcb
commit e273c5188a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      contrib/registry/servicecomb/watcher.go
  2. 6
      selector/p2c/p2c.go
  3. 8
      selector/wrr/wrr.go

@ -1,8 +1,9 @@
package servicecomb package servicecomb
import ( import (
"context"
"github.com/go-chassis/sc-client" "github.com/go-chassis/sc-client"
"golang.org/x/net/context"
"github.com/go-kratos/kratos/v2/registry" "github.com/go-kratos/kratos/v2/registry"
) )

@ -13,16 +13,16 @@ import (
const ( const (
forcePick = time.Second * 3 forcePick = time.Second * 3
// Name is balancer name // Name is p2c(Pick of 2 choices) balancer name
Name = "p2c" Name = "p2c"
) )
var _ selector.Balancer = (*Balancer)(nil) var _ selector.Balancer = (*Balancer)(nil)
// Option is random builder option. // Option is p2c builder option.
type Option func(o *options) type Option func(o *options)
// options is random builder options // options is p2c builder options
type options struct{} type options struct{}
// New creates a p2c selector. // New creates a p2c selector.

@ -9,19 +9,19 @@ import (
) )
const ( const (
// Name is wrr balancer name // Name is wrr(Weighted Round Robin) balancer name
Name = "wrr" Name = "wrr"
) )
var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name var _ selector.Balancer = (*Balancer)(nil) // Name is balancer name
// Option is random builder option. // Option is wrr builder option.
type Option func(o *options) type Option func(o *options)
// options is random builder options // options is wrr builder options
type options struct{} type options struct{}
// Balancer is a random balancer. // Balancer is a wrr balancer.
type Balancer struct { type Balancer struct {
mu sync.Mutex mu sync.Mutex
currentWeight map[string]float64 currentWeight map[string]float64

Loading…
Cancel
Save