Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for AllWeightsEqual (0.17 sec)

  1. pkg/test/loadbalancersim/loadbalancer/weight.go

    func newLBConnection(name string, conns []*WeightedConnection) *weightedConnections {
    	return &weightedConnections{
    		conns:  conns,
    		helper: network2.NewConnectionHelper(name),
    	}
    }
    
    func (lb *weightedConnections) AllWeightsEqual() bool {
    	if len(lb.conns) == 0 {
    		return true
    	}
    
    	weight := lb.conns[0].Weight
    	for _, conn := range lb.conns {
    		if conn.Weight != weight {
    			return false
    		}
    	}
    	return true
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Feb 03 18:19:25 UTC 2022
    - 2.8K bytes
    - Viewed (0)
  2. pkg/test/loadbalancersim/loadbalancer/leastrequest.go

    	if len(s.Connections) == 0 {
    		panic("attempting to create load balancer with zero connections")
    	}
    
    	conn := newLBConnection("LeastRequestLB", s.Connections)
    
    	if conn.AllWeightsEqual() {
    		return newUnweightedLeastRequest(conn)
    	}
    
    	return newWeightedLeastRequest(conn, s.ActiveRequestBias)
    }
    
    type unweightedLeastRequest struct {
    	*weightedConnections
    	r *rand.Rand
    }
    
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Nov 14 20:23:34 UTC 2022
    - 3.4K bytes
    - Viewed (0)
Back to top