// Preference specifies the node or shard the operation should be performed on
// (default: random).
433551
func (s *UpdateByQueryService) Preference(preference string) *UpdateByQueryService {
	s.preference = preference
	return s
}
643739
func (s *IndicesAnalyzeService) PreferLocal(preferLocal bool) *IndicesAnalyzeService {
	s.preferLocal = &preferLocal
	return s
}
118025
func (s *Service) OrganizationPreferencesList(ctx context.Context, organizationPreferencesIdentity string) (*OrganizationPreferences, error) {
	var organizationPreferences OrganizationPreferences
	return &organizationPreferences, s.Get(ctx, &organizationPreferences, fmt.Sprintf("/organizations/%v/preferences", organizationPreferencesIdentity), nil, nil)
}
1027041
func (n *GroupByClause) Accept(v Visitor) (Node, bool) {
	newNode, skipChildren := v.Enter(n)
	if skipChildren {
		return v.Leave(newNode)
	}
	n = newNode.(*GroupByClause)
	for i, val := range n.Items {
		node, ok := val.Accept(v)
		if !ok {
			return n, false
		}
		n.Items[i] = node.(*ByItem)
	}
	return v.Leave(n)
}
1244752
func (pool *Pool) SelectNode() (*Node, error) {
	pool.Lock()
	defer pool.Unlock()

	var possibleNodes []*Node
	for _, node := range pool.nodes {
		if node.ErrorRate() < NODE_ERROR_THRESHOLD {
			possibleNodes = append(possibleNodes, node)
		}
	}

	count := len(possibleNodes)

	if count > 0 {
		return possibleNodes[rand.Int31n(int32(count))], nil
	}

	return nil, ErrAllNodesDown
}
398446
func (s *GetConferencePreferenceOutput) SetPreference(v *ConferencePreference) *GetConferencePreferenceOutput {
	s.Preference = v
	return s
}
27494
func (lbp *Random) Choose(peers []fab.Peer) (fab.Peer, error) {
	if len(peers) == 0 {
		logger.Warn("No peers to choose from!")
		return nil, nil
	}

	index := rand.Intn(len(peers))
	logger.Debugf("Choosing peer at index %d", index)
	return peers[index], nil
}
516834
func (s *ExistsService) Preference(preference string) *ExistsService {
	s.preference = preference
	return s
}
941379
func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
	return func(ep *endpoint) {
		// ep lock already acquired
		c := ep.network.getController()
		c.Lock()
		sb, ok := c.sandboxes[ep.sandboxID]
		c.Unlock()
		if !ok {
			logrus.Errorf("Could not set endpoint priority value during Join to endpoint %s: No sandbox id present in endpoint", ep.id)
			return
		}
		sb.epPriority[ep.id] = prio
	}
}
686927
func (s *ScanService) Preference(preference string) *ScanService {
	s.preference = preference
	return s
}
77122
func (s *GetService) Preference(preference string) *GetService {
	s.preference = preference
	return s
}
959728
func (r User_Customer_OpenIdConnect) ChangePreference(preferenceTypeKeyName *string, value *string) (resp []datatypes.User_Preference, err error) {
	params := []interface{}{
		preferenceTypeKeyName,
		value,
	}
	err = r.Session.DoRequest("SoftLayer_User_Customer_OpenIdConnect", "changePreference", params, &r.Options, &resp)
	return
}
60427
func Choose(prefix string, choices []string, opts ...Option) string {
	completer := newChoiceCompleter(choices, FilterHasPrefix)
	pt := New(dummyExecutor, completer)
	pt.renderer.prefixTextColor = DefaultColor
	pt.renderer.prefix = prefix

	for _, opt := range opts {
		if err := opt(pt); err != nil {
			panic(err)
		}
	}
	return pt.Input()
}
364839
func (g *GroupComposer) SetPriority(l level.Priority) error {
	if l == level.Invalid {
		return fmt.Errorf("cannot set priority to an invalid setting")
	}

	for _, m := range g.messages {
		if m == nil {
			continue
		}

		if m.Priority() == level.Invalid {
			_ = m.SetPriority(l)
		}
	}

	return nil
}
791665
func (iter *LimitIterator) nextOption() *RankedNode {
	sourceOption := iter.source.Next()
	if sourceOption == nil && iter.skippedNodeIndex < len(iter.skippedNodes) {
		skippedOption := iter.skippedNodes[iter.skippedNodeIndex]
		iter.skippedNodeIndex += 1
		return skippedOption
	}
	return sourceOption
}
346995
func (r *charRange) choose(rand *rand.Rand) rune {
	count := int64(r.last - r.first)
	return r.first + rune(rand.Int63n(count))
}
67661
func (cfg *ubuntuCloudConfig) PackagePreferences() []packaging.PackagePreferences {
	prefs, _ := cfg.attrs["apt_preferences"].([]packaging.PackagePreferences)
	return prefs
}