// GetThresholdQuantity returns the expected quantity value for a thresholdValue
167261
func GetThresholdQuantity(value ThresholdValue, capacity *resource.Quantity) *resource.Quantity {
	if value.Quantity != nil {
		return value.Quantity.Copy()
	}
	return resource.NewQuantity(int64(float64(capacity.Value())*float64(value.Percentage)), resource.BinarySI)
}
607500
func ValidatePositiveQuantity(value resource.Quantity, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	if value.Cmp(resource.Quantity{}) < 0 {
		allErrs = append(allErrs, field.Invalid(fldPath, value.String(), isNegativeErrorMsg))
	}
	return allErrs
}
825889
func (r Account_ProofOfConcept) GetTotalRequestsPendingOverThresholdReviewCount() (resp int, err error) {
	err = r.Session.DoRequest("SoftLayer_Account_ProofOfConcept", "getTotalRequestsPendingOverThresholdReviewCount", nil, &r.Options, &resp)
	return
}
1200775
func (batch MessageBatch) ReachedTimeThreshold(timeout time.Duration) bool {
	lastFlush := time.Unix(atomic.LoadInt64(batch.lastFlush), 0)
	return !batch.IsEmpty() && time.Since(lastFlush) > timeout
}
695840
func (s *AbortCriteria) SetThresholdPercentage(v float64) *AbortCriteria {
	s.ThresholdPercentage = &v
	return s
}
180188
func (pq *PriorityQueue) getItemByPriorityID(priority uint8, id uint64) (*PriorityItem, error) {
	// Check if empty or out of bounds.
	if pq.levels[priority].length() == 0 {
		return nil, ErrEmpty
	} else if id <= pq.levels[priority].head || id > pq.levels[priority].tail {
		return nil, ErrOutOfBounds
	}

	// Get item from database.
	var err error
	item := &PriorityItem{ID: id, Priority: priority, Key: pq.generateKey(priority, id)}
	if item.Value, err = pq.db.Get(item.Key, nil); err != nil {
		return nil, err
	}

	return item, nil
}
729369
func (s *HealthCheck) SetHealthyThreshold(v int64) *HealthCheck {
	s.HealthyThreshold = &v
	return s
}
998015
func NewMemoryThresholdNotifier(threshold evictionapi.Threshold, cgroupRoot string, factory NotifierFactory, handler func(string)) (ThresholdNotifier, error) {
	cgroups, err := cm.GetCgroupSubsystems()
	if err != nil {
		return nil, err
	}
	cgpath, found := cgroups.MountPoints["memory"]
	if !found || len(cgpath) == 0 {
		return nil, fmt.Errorf("memory cgroup mount point not found")
	}
	if isAllocatableEvictionThreshold(threshold) {
		// for allocatable thresholds, point the cgroup notifier at the allocatable cgroup
		cgpath += cgroupRoot
	}
	return &memoryThresholdNotifier{
		threshold:  threshold,
		cgroupPath: cgpath,
		events:     make(chan struct{}),
		handler:    handler,
		factory:    factory,
	}, nil
}
708059
func GetDustThreshold(scriptSize int, relayFeePerKb btcutil.Amount) btcutil.Amount {
	// Calculate the total (estimated) cost to the network.  This is
	// calculated using the serialize size of the output plus the serial
	// size of a transaction input which redeems it.  The output is assumed
	// to be compressed P2PKH as this is the most common script type.  Use
	// the average size of a compressed P2PKH redeem input (148) rather than
	// the largest possible (txsizes.RedeemP2PKHInputSize).
	totalSize := 8 + wire.VarIntSerializeSize(uint64(scriptSize)) +
		scriptSize + 148

	byteFee := relayFeePerKb / 1000
	relayFee := btcutil.Amount(totalSize) * byteFee
	return 3 * relayFee
}
1164393
func (r Location_Datacenter) GetOnlineSslVpnUserCount() (resp int, err error) {
	err = r.Session.DoRequest("SoftLayer_Location_Datacenter", "getOnlineSslVpnUserCount", nil, &r.Options, &resp)
	return
}
375408
func LevelThreshold(l logrus.Level) []logrus.Level {
	for i := range AllLevels {
		if AllLevels[i] == l {
			return AllLevels[i:]
		}
	}
	return []logrus.Level{}
}
161066
func (s *PurchaseOfferingInput) SetQuantity(v int64) *PurchaseOfferingInput {
	s.Quantity = &v
	return s
}
1371092
func NewQuantity(value int64, format Format) *Quantity {
	return &Quantity{
		i:      int64Amount{value: value},
		Format: format,
	}
}
380237
func (c *ConsulAlertClient) GetChangeThreshold(check *Check) int {
	service := check.ServiceID
	if service == "" {
		service = "_"
	}
	// List from most specific to least specific
	keys := []string{
		fmt.Sprintf("consul-alerts/config/checks/single/%s/%s/%s/change-threshold", check.Node, service, check.CheckID),
		fmt.Sprintf("consul-alerts/config/checks/check/%s/change-threshold", check.CheckID),
		fmt.Sprintf("consul-alerts/config/checks/service/%s/change-threshold", service),
		fmt.Sprintf("consul-alerts/config/checks/node/%s/change-threshold", check.Node),
	}

	for _, key := range keys {
		log.Debugf("Checking key %s for change-threshold override", key)
		kvpair, _, err := c.api.KV().Get(key, nil)
		if kvpair == nil || err != nil {
			continue
		}
		if val, err := strconv.Atoi(string(kvpair.Value)); err == nil {
			log.Debugf("Found change-threshold override: %d", val)
			return val
		}
	}
	return -1
}
1011315
func GetCounterValue(m prometheus.Counter) float64 {
	var pm dto.Metric
	err := m.Write(&pm)
	if err == nil {
		return *pm.Counter.Value
	}
	return 0
}
214767
func (s *InvalidationList) SetQuantity(v int64) *InvalidationList {
	s.Quantity = &v
	return s
}
247228
func (s *ApprovalThresholdPolicy) SetThresholdPercentage(v int64) *ApprovalThresholdPolicy {
	s.ThresholdPercentage = &v
	return s
}