// applyReconcileSummaries reconciles summaries for all the jobs
962637
func (n *nomadFSM) applyReconcileSummaries(buf []byte, index uint64) interface{} {
	if err := n.state.ReconcileJobSummaries(index); err != nil {
		return err
	}
	return n.reconcileQueuedAllocations(index)
}
833596
func (h *QuasiNewtonHelper) ApplyQuasiInverseHession(dir *core.Vector) {
	count := len(h.sList)
	if count == 0 {
		return
	}
	alphas := make([]float64, count, count)
	for n := count - 1; n >= 0; n-- {
		alphas[n] = -dir.Dot(h.sList[n]) / h.roList[n]
		dir.ApplyElemWiseMultiplyAccumulation(h.yList[n], alphas[n])
	}
	lastY := h.yList[count-1]
	yDotY := lastY.Dot(lastY)
	scalar := h.roList[count-1] / yDotY
	dir.ApplyScale(scalar)

	for n := 0; n < count; n++ {
		beta := dir.Dot(h.yList[n]) / h.roList[n]
		dir.ApplyElemWiseMultiplyAccumulation(h.sList[n], -alphas[n]-beta)
	}
	return
}
1321685
func (s *ListPipelinesOutput) SetPipelineSummaries(v []*PipelineSummary) *ListPipelinesOutput {
	s.PipelineSummaries = v
	return s
}
280225
func (s *StopJobOutput) SetJobSummary(v *JobSummary) *StopJobOutput {
	s.JobSummary = v
	return s
}
996539
func (p *ReadOnlySchedulerClient) GetConfigSummary(ctx context.Context, job *JobKey) (r *Response, err error) {
  var _args62 ReadOnlySchedulerGetConfigSummaryArgs
  _args62.Job = job
  var _result63 ReadOnlySchedulerGetConfigSummaryResult
  if err = p.Client_().Call(ctx, "getConfigSummary", &_args62, &_result63); err != nil {
    return
  }
  return _result63.GetSuccess(), nil
}
307828
func (u *Updater) Apply() error {
	updateAvailable, err := u.HasUpdate(false)
	if err != nil {
		return err
	}
	if !updateAvailable {
		return nil
	}

	checksum, err := u.getSHA256(u.Filename)
	if err != nil {
		return err
	}

	newRelease, err := u.getFile(u.Filename)
	if err != nil {
		return err
	}
	defer newRelease.Close()

	return update.Apply(newRelease, update.Options{
		Checksum: checksum,
	})
}
588233
func (s *Server) reconcileJobSummaries() error {
	index, err := s.fsm.state.LatestIndex()
	if err != nil {
		return fmt.Errorf("unable to read latest index: %v", err)
	}
	s.logger.Debug("leader reconciling job summaries", "index", index)

	args := &structs.GenericResponse{}
	msg := structs.ReconcileJobSummariesRequestType | structs.IgnoreUnknownTypeFlag
	if _, _, err = s.raftApply(msg, args); err != nil {
		return fmt.Errorf("reconciliation of job summaries failed: %v", err)
	}

	return nil
}
140751
func (s *ListDatasetContentsOutput) SetDatasetContentSummaries(v []*DatasetContentSummary) *ListDatasetContentsOutput {
	s.DatasetContentSummaries = v
	return s
}
1339292
func (s *ListStackInstancesOutput) SetSummaries(v []*StackInstanceSummary) *ListStackInstancesOutput {
	s.Summaries = v
	return s
}
511626
func (s *ListBrokersResponse) SetBrokerSummaries(v []*BrokerSummary) *ListBrokersResponse {
	s.BrokerSummaries = v
	return s
}
792550
func (s *ListChangeSetsOutput) SetSummaries(v []*ChangeSetSummary) *ListChangeSetsOutput {
	s.Summaries = v
	return s
}
603783
func (actx *ApplyContext) ApplyPatch(patchReader savior.SeekSource) error {
	// XXX: this patch API does not support cancellation, so we just use a background
	// context
	ctx := context.Background()

	actx.actualOutputPath = actx.OutputPath
	if actx.OutputPool == nil {
		if actx.DryRun {
			if actx.actualOutputPath != "" {
				return fmt.Errorf("cannot specify both OutputPath and DryRun")
			}
		} else if actx.InPlace {
			// applying in-place is a bit tricky: we can't overwrite files in the
			// target directory (old) while we're reading the patch otherwise
			// we might be copying new bytes instead of old bytes into later files
			// so, we rebuild 'touched' files in a staging area
			stagePath := actx.StagePath
			if stagePath == "" {
				stagePath = actx.actualOutputPath + "-stage"
				actx.Consumer.Infof("No staging path specified, using: %s", stagePath)
			}
			err := os.MkdirAll(stagePath, os.FileMode(0755))
			if err != nil {
				return errors.WithStack(err)
			}

			defer os.RemoveAll(stagePath)
			actx.OutputPath = stagePath
		} else {
			os.MkdirAll(actx.OutputPath, os.FileMode(0755))
		}
	} else {
		if actx.actualOutputPath != "" {
			return fmt.Errorf("cannot specify both OutputPath and OutputPool")
		}
	}

	rawPatchWire := wire.NewReadContext(patchReader)
	err := rawPatchWire.ExpectMagic(PatchMagic)
	if err != nil {
		return errors.WithStack(err)
	}

	header := &PatchHeader{}
	err = rawPatchWire.ReadMessage(header)
	if err != nil {
		return errors.WithStack(err)
	}

	patchWire, err := DecompressWire(rawPatchWire, header.Compression)
	if err != nil {
		return errors.WithStack(err)
	}

	targetContainer := &tlc.Container{}
	err = patchWire.ReadMessage(targetContainer)
	if err != nil {
		return errors.WithStack(err)
	}
	actx.TargetContainer = targetContainer

	sourceContainer := &tlc.Container{}
	err = patchWire.ReadMessage(sourceContainer)
	if err != nil {
		return errors.WithStack(err)
	}
	actx.SourceContainer = sourceContainer

	if actx.VetApply != nil {
		err = actx.VetApply(actx)
		if err != nil {
			return errors.WithStack(err)
		}
	}

	var ghosts []Ghost

	// when not working with a custom output pool
	if actx.OutputPool == nil {
		if actx.DryRun {
			actx.OutputPool = nullpool.New(actx.SourceContainer)
		} else if actx.InPlace {
			// when working in-place, we have to keep track of which files were deleted
			// from one version to the other, so that we too may delete them in the end.
			ghosts = detectGhosts(actx.SourceContainer, actx.TargetContainer)
		} else {
			// when rebuilding in a fresh directory, there's no need to worry about
			// deleted files, because they won't even exist in the first place.
			err = sourceContainer.Prepare(actx.OutputPath)
			if err != nil {
				return errors.WithStack(err)
			}
		}
	}

	err = actx.patchAll(ctx, patchWire, actx.Signature)
	if err != nil {
		return errors.WithStack(err)
	}

	if actx.DryRun {
		// muffin to do
	} else if actx.InPlace {
		err = actx.ensureDirsAndSymlinks(actx.actualOutputPath)
		if err != nil {
			return errors.WithStack(err)
		}

		actx.Stats.StageSize, err = actx.mergeFolders(actx.actualOutputPath, actx.OutputPath)
		if err != nil {
			return errors.WithStack(err)
		}

		err = actx.deleteGhosts(actx.actualOutputPath, ghosts)
		if err != nil {
			return errors.WithStack(err)
		}
		actx.OutputPath = actx.actualOutputPath
	}

	return nil
}
519124
func (pb *pointBuilder) applySubstitutions(mbean string, fieldMap map[string]interface{}) {
	properties := makePropertyMap(mbean)

	for i, subKey := range pb.substitutions[1:] {

		symbol := fmt.Sprintf("$%d", i+1)
		substitution := properties[subKey]

		for fieldName, fieldValue := range fieldMap {
			newFieldName := strings.Replace(fieldName, symbol, substitution, -1)
			if fieldName != newFieldName {
				fieldMap[newFieldName] = fieldValue
				delete(fieldMap, fieldName)
			}
		}
	}
}
1095292
func (s *ListServiceActionsOutput) SetServiceActionSummaries(v []*ServiceActionSummary) *ListServiceActionsOutput {
	s.ServiceActionSummaries = v
	return s
}
1299343
func (s *GetComplianceSummaryByResourceTypeOutput) SetComplianceSummariesByResourceType(v []*ComplianceSummaryByResourceType) *GetComplianceSummaryByResourceTypeOutput {
	s.ComplianceSummariesByResourceType = v
	return s
}
776149
func (g *GossipSyncer) ApplyGossipFilter(filter *lnwire.GossipTimestampRange) error {
	g.Lock()

	g.remoteUpdateHorizon = filter

	startTime := time.Unix(int64(g.remoteUpdateHorizon.FirstTimestamp), 0)
	endTime := startTime.Add(
		time.Duration(g.remoteUpdateHorizon.TimestampRange) * time.Second,
	)

	g.Unlock()

	// Now that the remote peer has applied their filter, we'll query the
	// database for all the messages that are beyond this filter.
	newUpdatestoSend, err := g.cfg.channelSeries.UpdatesInHorizon(
		g.cfg.chainHash, startTime, endTime,
	)
	if err != nil {
		return err
	}

	log.Infof("GossipSyncer(%x): applying new update horizon: start=%v, "+
		"end=%v, backlog_size=%v", g.cfg.peerPub[:], startTime, endTime,
		len(newUpdatestoSend))

	// If we don't have any to send, then we can return early.
	if len(newUpdatestoSend) == 0 {
		return nil
	}

	// We'll conclude by launching a goroutine to send out any updates.
	g.wg.Add(1)
	go func() {
		defer g.wg.Done()

		for _, msg := range newUpdatestoSend {
			err := g.cfg.sendToPeerSync(msg)
			switch {
			case err == ErrGossipSyncerExiting:
				return

			case err == lnpeer.ErrPeerExiting:
				return

			case err != nil:
				log.Errorf("Unable to send message for "+
					"peer catch up: %v", err)
			}
		}
	}()

	return nil
}
974239
func (formatters FormatterArray) ApplyFormatter(msg *Message) error {
	for _, formatter := range formatters {
		if formatter.CanBeApplied(msg) {
			if err := formatter.ApplyFormatter(msg); err != nil {
				return err
			}
		}
	}
	return nil
}