MCPcopy
hub / github.com/yusing/godoxy / New

Function New

internal/net/gphttp/loadbalancer/loadbalancer.go:48–56  ·  view source on GitHub ↗
(cfg *types.LoadBalancerConfig)

Source from the content-addressed store, hash-verified

46const maxWeight int = 100
47
48func New(cfg *types.LoadBalancerConfig) *LoadBalancer {
49 lb := &LoadBalancer{
50 LoadBalancerConfig: cfg,
51 pool: pool.New[types.LoadBalancerServer]("loadbalancer."+cfg.Link, "loadbalancers"),
52 l: log.With().Str("name", cfg.Link).Logger(),
53 }
54 lb.UpdateConfigIfNeeded(cfg)
55 return lb
56}
57
58// Start implements task.TaskStarter.
59func (lb *LoadBalancer) Start(parent task.Parent) error {

Callers 2

addToLoadBalancerMethod · 0.92
TestRebalanceFunction · 0.85

Calls 3

UpdateConfigIfNeededMethod · 0.95
NewMethod · 0.80
LoggerMethod · 0.65

Tested by 1

TestRebalanceFunction · 0.68