// InstallSubNotes will (if true) instruct Tiller to render SubChart Notes
513946
func InstallSubNotes(enable bool) InstallOption {
	return func(opts *options) {
		opts.instReq.SubNotes = enable
	}
}
237828
func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error) {
	for _, opt := range opts {
		opt(&c.Opts)
	}

	releaseName := c.Opts.instReq.Name
	releaseDescription := c.Opts.instReq.Description

	// Check to see if the release already exists.
	rel, err := c.ReleaseStatus(releaseName, nil)
	if err == nil && rel != nil {
		return nil, errors.New("cannot re-use a name that is still in use")
	}

	mockOpts := &MockReleaseOptions{
		Name:        releaseName,
		Chart:       chart,
		Config:      c.Opts.instReq.Values,
		Namespace:   ns,
		Description: releaseDescription,
	}

	release := ReleaseMock(mockOpts)

	if c.RenderManifests {
		if err := RenderReleaseMock(release, false); err != nil {
			return nil, err
		}
	}

	if !c.Opts.dryRun {
		c.Rels = append(c.Rels, release)
	}

	return &rls.InstallReleaseResponse{
		Release: release,
	}, nil
}
1169673
func (c *client) addShadowSub(sub *subscription, im *streamImport, useFrom bool) (*subscription, error) {
	nsub := *sub // copy
	nsub.im = im
	if useFrom {
		nsub.subject = []byte(im.from)
	} else if im.prefix != "" {
		// redo subject here to match subject in the publisher account space.
		// Just remove prefix from what they gave us. That maps into other space.
		nsub.subject = sub.subject[len(im.prefix):]
	}

	c.Debugf("Creating import subscription on %q from account %q", nsub.subject, im.acc.Name)

	if err := im.acc.sl.Insert(&nsub); err != nil {
		errs := fmt.Sprintf("Could not add shadow import subscription for account %q", im.acc.Name)
		c.Debugf(errs)
		return nil, fmt.Errorf(errs)
	}

	// Update our route map here.
	c.srv.updateRouteSubscriptionMap(im.acc, &nsub, 1)
	return &nsub, nil
}
1306168
func RenderInstanceGroupSubnets(cluster *kops.Cluster) InstanceGroupRenderFunction {
	return func(ig *kops.InstanceGroup) string {
		return strings.Join(ig.Spec.Subnets, ",")
	}
}
1270097
func (pool *TxPool) AddRemotes(txs []*types.Transaction) []error {
	return pool.addTxs(txs, false)
}
507540
func addNodeToResults(n *node, results *SublistResult) {
	// Normal subscriptions
	if n.plist != nil {
		results.psubs = append(results.psubs, n.plist...)
	} else {
		for _, psub := range n.psubs {
			results.psubs = append(results.psubs, psub)
		}
	}
	// Queue subscriptions
	for qname, qr := range n.qsubs {
		if len(qr) == 0 {
			continue
		}
		// Need to find matching list in results
		var i int
		if i = findQSlot([]byte(qname), results.qsubs); i < 0 {
			i = len(results.qsubs)
			nqsub := make([]*subscription, 0, len(qr))
			results.qsubs = append(results.qsubs, nqsub)
		}
		for _, sub := range qr {
			if isRemoteQSub(sub) {
				ns := atomic.LoadInt32(&sub.qw)
				// Shadow these subscriptions
				for n := 0; n < int(ns); n++ {
					results.qsubs[i] = append(results.qsubs[i], sub)
				}
			} else {
				results.qsubs[i] = append(results.qsubs[i], sub)
			}
		}
	}
}
329741
func (s *CaptionSelectorSettings) SetDvbSubSourceSettings(v *DvbSubSourceSettings) *CaptionSelectorSettings {
	s.DvbSubSourceSettings = v
	return s
}
713961
func (a *ACLToken) PolicySubset(policies []string) bool {
	// Hot-path the management tokens, superset of all policies.
	if a.Type == ACLManagementToken {
		return true
	}
	associatedPolicies := make(map[string]struct{}, len(a.Policies))
	for _, policy := range a.Policies {
		associatedPolicies[policy] = struct{}{}
	}
	for _, policy := range policies {
		if _, ok := associatedPolicies[policy]; !ok {
			return false
		}
	}
	return true
}
34247
func (c *Client) HasSubtitles(subs Subtitles) (bool, error) {
	subArgs, err := subs.toTryUploadParams()
	if err != nil {
		return true, err
	}
	args := []interface{}{c.Token, subArgs}
	res := struct {
		Status string `xmlrpc:"status"`
		Exists int    `xmlrpc:"alreadyindb"`
	}{}
	if err := c.Call("TryUploadSubtitles", args, &res); err != nil {
		return true, err
	}
	if res.Status != StatusSuccess {
		return true, fmt.Errorf("HasSubtitles: %s", res.Status)
	}

	return res.Exists == 1, nil
}
357719
func joinSubTrees(h hash.Hash, a, b *subTree) *subTree {
	if DEBUG {
		if b.next != a {
			panic("invalid subtree join - 'a' is not paired with 'b'")
		}
		if a.height < b.height {
			panic("invalid subtree presented - height mismatch")
		}
	}

	return &subTree{
		next:   a.next,
		height: a.height + 1,
		sum:    nodeSum(h, a.sum, b.sum),
	}
}
601251
func (s *DefaultMessage) SetSubstitutions(v map[string][]*string) *DefaultMessage {
	s.Substitutions = v
	return s
}
325036
func (i *Instance) installRules(cfg *ACLInfo, containerInfo *policy.PUInfo) error {
	var err error
	var appACLIPset, netACLIPset []aclIPset
	policyrules := containerInfo.Policy

	if err := i.updateProxySet(containerInfo.Policy, cfg.ProxySetName); err != nil {
		return err
	}

	if appACLIPset, err = i.createACLIPSets(cfg.ContextID, policyrules.ApplicationACLs()); err != nil {
		return err
	}

	if netACLIPset, err = i.createACLIPSets(cfg.ContextID, policyrules.NetworkACLs()); err != nil {
		return err
	}

	// Install the PU specific chain first.
	if err := i.addContainerChain(cfg.AppChain, cfg.NetChain); err != nil {
		return err
	}

	// If its a remote and thus container, configure container rules.
	if i.mode == constants.RemoteContainer || i.mode == constants.Sidecar {
		if err := i.configureContainerRules(cfg); err != nil {
			return err
		}
	}

	// If its a Linux process configure the Linux rules.
	if i.mode == constants.LocalServer {
		if err := i.configureLinuxRules(cfg); err != nil {
			return err
		}
	}

	isHostPU := extractors.IsHostPU(containerInfo.Runtime, i.mode)

	if err := i.addExternalACLs(cfg.ContextID, cfg.AppChain, cfg.NetChain, appACLIPset, true); err != nil {
		return err
	}

	if err := i.addExternalACLs(cfg.ContextID, cfg.NetChain, cfg.AppChain, netACLIPset, false); err != nil {
		return err
	}

	if err := i.addPacketTrap(cfg, isHostPU); err != nil {
		return err
	}

	return nil
}
395327
func (v *Oid) AppendSubIds(subs []int) (*Oid, error) {
	buf := bytes.NewBufferString(v.String())
	for _, i := range subs {
		buf.WriteString(".")
		buf.WriteString(strconv.Itoa(i))
	}
	return NewOid(buf.String())
}
1035671
func (o *OAuthSession) MySubreddits() ([]*Subreddit, error) {
	type Response struct {
		Data struct {
			Children []struct {
				Data *Subreddit
			}
		}
	}
	r := new(Response)
	err := o.getBody("https://oauth.reddit.com/subreddits/mine/subscriber", r)
	if err != nil {
		return nil, err
	}
	s := make([]*Subreddit, len(r.Data.Children))
	for i, child := range r.Data.Children {
		s[i] = child.Data
	}
	return s, nil
}
1341605
func (s *CaptionDestinationSettings) SetDvbSubDestinationSettings(v *DvbSubDestinationSettings) *CaptionDestinationSettings {
	s.DvbSubDestinationSettings = v
	return s
}
1048068
func AddSubnets(ctx context.ProviderCallContext, api NetworkBacking, args params.AddSubnetsParams) (params.ErrorResults, error) {
	results := params.ErrorResults{
		Results: make([]params.ErrorResult, len(args.Subnets)),
	}

	if len(args.Subnets) == 0 {
		return results, nil
	}

	cache := NewAddSubnetsCache(api)
	for i, arg := range args.Subnets {
		err := addOneSubnet(ctx, api, arg, cache)
		if err != nil {
			results.Results[i].Error = common.ServerError(err)
		}
	}
	return results, nil
}
189374
func InstallHandlers(r *router.Router, base router.MiddlewareChain) {
	if appengine.IsDevAppServer() {
		r.GET(pubSubPullURLPath, base, pubSubPull)
	}
	r.POST(pubSubPushURLPath, base, pubSubPush)
}