// Apply decorators in the order provided
172395
func Apply(proposal *peer.Proposal, input *peer.ChaincodeInput,
	decorators ...Decorator) *peer.ChaincodeInput {
	for _, decorator := range decorators {
		input = decorator.Decorate(proposal, input)
	}

	return input
}
473591
func (cm *Validator) Apply(configEnv *cb.ConfigEnvelope) error {
	cm.AppliedConfigUpdateEnvelope = configEnv
	return cm.ApplyVal
}
176498
func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder {
	return encoder
}
1067442
func applyPackageSpecOverride(packageSpecs []PackageSpec, overrides []PackageSpecOverride, osDistro string) []PackageSpec {
	var override *PackageSpecOverride
	for _, o := range overrides {
		if o.OSDistro == osDistro {
			override = &o
			break
		}
	}
	if override == nil {
		return packageSpecs
	}

	// Remove packages in the spec that matches the overrides in
	// Subtractions.
	var out []PackageSpec
	subtractions := make(map[string]bool)
	for _, spec := range override.Subtractions {
		subtractions[spec.Name] = true
	}
	for _, spec := range packageSpecs {
		if _, ok := subtractions[spec.Name]; !ok {
			out = append(out, spec)
		}
	}

	// Add packages in the spec that matches the overrides in Additions.
	return append(out, override.Additions...)
}
556801
func (o *Options) applyDefaults() *Options {
	newOpts := *o
	if newOpts.Protocol == "" {
		newOpts.Protocol = "http"
	}
	if newOpts.APIVersion == 0 {
		newOpts.APIVersion = 1
	}
	if newOpts.HTTPClient == nil {
		transport := http.DefaultTransport
		if newOpts.Logger != nil {
			transport = httplogger.NewLoggedTransport(http.DefaultTransport, newOpts.Logger)
		}
		newOpts.HTTPClient = &http.Client{
			Transport: transport,
			Timeout:   60 * time.Second,
		}
	}
	return &newOpts
}
1302292
func (f StoreOpt) Apply(store *Store) error {
	if f != nil {
		return f(store)
	}
	return nil
}
331425
func (f *BoolFlag) Apply(set *flag.FlagSet) {
	f.set = set
	f.BoolFlag.Apply(set)
}
669493
func (o CookieOptions) apply(opts ...func(*CookieOptions)) CookieOptions {
	if len(opts) == 0 {
		return o
	}

	for _, opt := range opts {
		opt(&o)
	}

	return o
}
344002
func (r *Recover) Apply(next web.HandlerFunc) web.HandlerFunc {
	if r.StackSize == 0 {
		r.StackSize = 4 << 10 // 4 KB
	}

	pool := sync.Pool{
		New: func() interface{} {
			return make([]byte, r.StackSize)
		},
	}

	return func(ctx web.Context) error {
		defer func() {
			if e := recover(); e != nil {
				err := errors.Convert(e)
				if r.StackEnabled {
					stack := pool.Get().([]byte)
					length := runtime.Stack(stack, false)
					ctx.Logger().Errorf("PANIC: %s, stack: %s", err, stack[:length])
					pool.Put(stack)
				}
				ctx.Error(err)
			}
		}()

		return next(ctx)
	}
}
1195128
func (p *patcher) applyPatch(_ context.Context, _, currentObject runtime.Object) (objToUpdate runtime.Object, patchErr error) {
	// Make sure we actually have a persisted currentObject
	p.trace.Step("About to apply patch")
	currentObjectHasUID, err := hasUID(currentObject)
	if err != nil {
		return nil, err
	} else if !currentObjectHasUID {
		objToUpdate, patchErr = p.mechanism.createNewObject()
	} else {
		objToUpdate, patchErr = p.mechanism.applyPatchToCurrentObject(currentObject)
	}

	if patchErr != nil {
		return nil, patchErr
	}

	objToUpdateHasUID, err := hasUID(objToUpdate)
	if err != nil {
		return nil, err
	}
	if objToUpdateHasUID && !currentObjectHasUID {
		accessor, err := meta.Accessor(objToUpdate)
		if err != nil {
			return nil, err
		}
		return nil, errors.NewConflict(p.resource.GroupResource(), p.name, fmt.Errorf("uid mismatch: the provided object specified uid %s, and no existing object was found", accessor.GetUID()))
	}

	if err := checkName(objToUpdate, p.name, p.namespace, p.namer); err != nil {
		return nil, err
	}
	return objToUpdate, nil
}
883809
func Apply(params Params, opts []Opt) {
	for _, opt := range opts {
		opt(params)
	}
}
1023320
func (_class PoolPatchClass) Apply(sessionID SessionRef, self PoolPatchRef, host HostRef) (_retval string, _err error) {
	_method := "pool_patch.apply"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPoolPatchRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_hostArg, _err := convertHostRefToXen(fmt.Sprintf("%s(%s)", _method, "host"), host)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg, _hostArg)
	if _err != nil {
		return
	}
	_retval, _err = convertStringToGo(_method + " -> ", _result.Value)
	return
}
73988
func (r *RoleV3) ApplyTraits(traits map[string][]string) Role {
	return ApplyTraits(r, traits)
}
1146151
func (t *Template) Funcs(funcMap FuncMap) *Template {
	return t.replaceTmpl(t.tmpl.Funcs(template.FuncMap(funcMap)))
}
176482
func (b BuildDefaults) ApplyDefaults(pod *corev1.Pod) error {
	build, err := common.GetBuildFromPod(pod)
	if err != nil {
		return nil
	}

	if b.DefaultProxy != nil {
		b.applyPodProxyDefaults(pod, build.Spec.Strategy.CustomStrategy != nil)
	}

	if b.Config != nil {
		klog.V(4).Infof("Applying defaults to build %s/%s", build.Namespace, build.Name)
		b.applyBuildDefaults(build)

		klog.V(4).Infof("Applying defaults to pod %s/%s", pod.Namespace, pod.Name)
		b.applyPodDefaults(pod, build.Spec.Strategy.CustomStrategy != nil)
	}

	err = setPodLogLevelFromBuild(pod, build)
	if err != nil {
		return err
	}

	return common.SetBuildInPod(pod, build)
}
362437
func (m *nodeApplier) Apply(
	conn redcon.Conn,
	cmd redcon.Command,
	mutate func() (interface{}, error),
	respond func(interface{}) (interface{}, error),
) (interface{}, error) {
	var val interface{}
	var err error
	if mutate == nil {
		// no apply, just do a level guard.
		if err := (*Node)(m).raftLevelGuard(); err != nil {
			return nil, err
		}
	} else if conn == nil {
		// this is happening on a follower node.
		return mutate()
	} else {
		// this is happening on the leader node.
		// apply the command to the raft log.
		val, err = (*Node)(m).raftApplyCommand(cmd)
	}
	if err != nil {
		return nil, err
	}
	// responde
	return respond(val)
}
1255284
func (c *Client) applyOptions(opts ...ClientOption) error {
	for _, f := range opts {
		if err := f(c); err != nil {
			return err
		}
	}
	return nil
}