// NewResourceBalancer creates a new ResourceBalancer or returns an error if
// the limits are invalid.
//
// Limits should be a percentage expressed as an integer between 1 and 100
// inclusive.
NewResourceBalancer creates a new ResourceBalancer or returns an error if
the limits are invalid.

Limits should be a percentage expressed as an integer between 1 and 100
inclusive.
// NewResourceBalancer creates a new ResourceBalancer or returns an error if // the limits are invalid . // // Limits should be a percentage expressed as an integer between 1 and 100 // inclusive .
func NewResourceBalancer(src ResourceReporter, claimLimit, releaseLimit int) (*ResourceBalancer, error) {
	if claimLimit < 1 || claimLimit > 100 || releaseLimit < 1 || releaseLimit > 100 {
		return nil, fmt.Errorf("Limits must be between 1 and 100. claim=%d release=%d", claimLimit, releaseLimit)
	}
	if claimLimit >= releaseLimit {
		return nil, fmt.Errorf("Claim threshold must be < release threshold. claim=%d >= release=%d", claimLimit, releaseLimit)
	}
	return &ResourceBalancer{
		reporter:     src,
		claimLimit:   claimLimit,
		releaseLimit: releaseLimit,
	}, nil
}
func NewResourceBalancer ( src ResourceReporter , claimLimit , releaseLimit int ) ( * ResourceBalancer , error ) { if claimLimit < 1 || claimLimit > 100 || releaseLimit < 1 || releaseLimit > 100 { return nil , fmt . Errorf ( " " , claimLimit , releaseLimit ) } if claimLimit >= releaseLimit { return nil , fmt . Errorf ( " " , claimLimit , releaseLimit ) } return & ResourceBalancer { reporter : src , claimLimit : claimLimit , releaseLimit : releaseLimit , } , nil }
NewResourceBalancer creates a new ResourceBalancer or returns an error if
the limits are invalid.
NewResourceBalancer creates a new ResourceBalancer or returns an error if the limits are invalid .