// SetHistorySummary sets the HistorySummary field's value.
5338
func (s *AlarmHistoryItem) SetHistorySummary(v string) *AlarmHistoryItem {
	s.HistorySummary = &v
	return s
}
550902
func (historyDB *historyDB) NewHistoryQueryExecutor(blockStore blkstorage.BlockStore) (ledger.HistoryQueryExecutor, error) {
	return &LevelHistoryDBQueryExecutor{historyDB, blockStore}, nil
}
435482
func (d *JSONDecoder) DecodeHistory(data []byte) (*HistoryRequest, error) {
	var p HistoryRequest
	err := json.Unmarshal(data, &p)
	if err != nil {
		return nil, err
	}
	return &p, nil
}
1111147
func (r *Ref) SetMaxHistory(m uint) *Ref {
	r.maxHistory = m
	return r
}
986372
func (b *MiloBuildLegacy) BuildSummary() *BuildSummary {
	if b == nil {
		return nil
	}
	result := &BuildSummary{
		Link:          b.Summary.Label,
		Status:        b.Summary.Status,
		PendingTime:   b.Summary.PendingTime,
		ExecutionTime: b.Summary.ExecutionTime,
		Text:          b.Summary.Text,
		Blame:         b.Blame,
	}
	if b.Trigger != nil {
		result.Revision = &b.Trigger.Commit
	}
	return result
}
861620
func (s *UpdateAppOutput) SetAppSummary(v *AppSummary) *UpdateAppOutput {
	s.AppSummary = v
	return s
}
855131
func (h *apiExecutor) HistoryRemove(ctx context.Context, cmd *HistoryRemoveRequest) *HistoryRemoveResponse {
	defer func(started time.Time) {
		apiCommandDurationSummary.WithLabelValues(h.protocol, "history_remove").Observe(time.Since(started).Seconds())
	}(time.Now())

	resp := &HistoryRemoveResponse{}

	ch := cmd.Channel

	if ch == "" {
		resp.Error = ErrorBadRequest
		return resp
	}

	chOpts, ok := h.node.ChannelOpts(ch)
	if !ok {
		resp.Error = ErrorNamespaceNotFound
		return resp
	}

	if chOpts.HistorySize <= 0 || chOpts.HistoryLifetime <= 0 {
		resp.Error = ErrorNotAvailable
		return resp
	}

	err := h.node.RemoveHistory(ch)
	if err != nil {
		h.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, "error calling history remove", map[string]interface{}{"error": err.Error()}))
		resp.Error = ErrorInternal
		return resp
	}

	return resp
}
648176
func WithMaxHistory(max int32) HistoryOption {
	return func(opts *options) {
		opts.histReq.Max = max
	}
}
592887
func (b *boltArbitratorLog) WipeHistory() error {
	return b.db.Update(func(tx *bbolt.Tx) error {
		scopeBucket, err := tx.CreateBucketIfNotExists(b.scopeKey[:])
		if err != nil {
			return err
		}

		// Once we have the main top-level bucket, we'll delete the key
		// that stores the state of the arbitrator.
		if err := scopeBucket.Delete(stateKey[:]); err != nil {
			return err
		}

		// Next, we'll delete any lingering contract state within the
		// contracts bucket, and the bucket itself once we're done
		// clearing it out.
		contractBucket, err := scopeBucket.CreateBucketIfNotExists(
			contractsBucketKey,
		)
		if err != nil {
			return err
		}
		if err := contractBucket.ForEach(func(resKey, _ []byte) error {
			return contractBucket.Delete(resKey)
		}); err != nil {
			return err
		}
		if err := scopeBucket.DeleteBucket(contractsBucketKey); err != nil {
			fmt.Println("nah")
			return err
		}

		// Next, we'll delete storage of any lingering contract
		// resolutions.
		if err := scopeBucket.Delete(resolutionsKey); err != nil {
			return err
		}

		// Before we delta the enclosing bucket itself, we'll delta any
		// chain actions that are still stored.
		actionsBucket, err := scopeBucket.CreateBucketIfNotExists(
			actionsBucketKey,
		)
		if err != nil {
			return err
		}
		if err := actionsBucket.ForEach(func(resKey, _ []byte) error {
			return actionsBucket.Delete(resKey)
		}); err != nil {
			return err
		}
		if err := scopeBucket.DeleteBucket(actionsBucketKey); err != nil {
			return err
		}

		// Finally, we'll delete the enclosing bucket itself.
		return tx.DeleteBucket(b.scopeKey[:])
	})
}
1348364
func (s *AlarmHistoryItem) SetHistoryItemType(v string) *AlarmHistoryItem {
	s.HistoryItemType = &v
	return s
}
982707
func (g *HistoryGetter) StatusHistory(filter status.StatusHistoryFilter) ([]status.StatusInfo, error) {
	args := &statusHistoryArgs{
		db:        g.st.db(),
		globalKey: g.globalKey,
		filter:    filter,
	}
	return statusHistory(args)
}
335796
func (s *NonCompliantSummary) SetSeveritySummary(v *SeveritySummary) *NonCompliantSummary {
	s.SeveritySummary = v
	return s
}
1367792
func OptionHistory(x []string) Option {
	return func(p *Prompt) error {
		p.history.histories = x
		p.history.Clear()
		return nil
	}
}
1247571
func SetHistoryCapacity(capacity int) error { // int linenoiseHistorySetMaxLen(int len);
	res := C.linenoiseHistorySetMaxLen(C.int(capacity))
	if res != 1 {
		return errors.New("Could not set history max len.")
	}
	return nil
}
1134686
func getSummary(c context.Context, host string, project string, id int64) (*model.BuildSummary, error) {
	client, err := buildbucketClient(c, host, auth.AsProject, auth.WithProject(project))
	if err != nil {
		return nil, err
	}
	b, err := client.GetBuild(c, &buildbucketpb.GetBuildRequest{
		Id:     id,
		Fields: summaryBuildMask,
	})
	if err != nil {
		return nil, err
	}
	buildAddress := fmt.Sprintf("%d", b.Id)
	if b.Number != 0 {
		buildAddress = fmt.Sprintf("luci.%s.%s/%s/%d", b.Builder.Project, b.Builder.Bucket, b.Builder.Builder, b.Number)
	}

	// Note: The parent for buildbucket build summaries is currently a fake entity.
	// In the future, builds can be cached here, but we currently don't do that.
	buildKey := datastore.MakeKey(c, "buildbucket.Build", fmt.Sprintf("%s:%s", host, buildAddress))
	swarming := b.GetInfra().GetSwarming()

	bs := &model.BuildSummary{
		ProjectID:  b.Builder.Project,
		BuildKey:   buildKey,
		BuilderID:  BuilderID{*b.Builder}.String(),
		BuildID:    "buildbucket/" + buildAddress,
		BuildSet:   protoutil.BuildSets(b),
		ContextURI: []string{fmt.Sprintf("buildbucket://%s/build/%d", host, id)},
		Created:    mustTimestamp(b.CreateTime),
		Summary: model.Summary{
			Start:  mustTimestamp(b.StartTime),
			End:    mustTimestamp(b.EndTime),
			Status: statusMap[b.Status],
		},
		Version:      mustTimestamp(b.UpdateTime).UnixNano(),
		Experimental: b.GetInput().GetExperimental(),
	}
	if task := swarming.GetTaskId(); task != "" {
		bs.ContextURI = append(
			bs.ContextURI,
			fmt.Sprintf("swarming://%s/task/%s", swarming.GetHostname(), swarming.GetTaskId()))
	}
	return bs, nil
}
706164
func _baseHistory(fname string, size int) (*history, error) {
	file, err := os.OpenFile(fname, os.O_CREATE|os.O_RDWR, HistoryPerm)
	if err != nil {
		return nil, err
	}

	h := new(history)
	h.Cap = size
	h.filename = fname
	h.file = file
	h.li = list.New()

	return h, nil
}
757817
func (c *Client) StatusHistory(kind status.HistoryKind, tag names.Tag, filter status.StatusHistoryFilter) (status.History, error) {
	var results params.StatusHistoryResults
	args := params.StatusHistoryRequest{
		Kind: string(kind),
		Filter: params.StatusHistoryFilter{
			Size:    filter.Size,
			Date:    filter.FromDate,
			Delta:   filter.Delta,
			Exclude: filter.Exclude.Values(),
		},
		Tag: tag.String(),
	}
	bulkArgs := params.StatusHistoryRequests{Requests: []params.StatusHistoryRequest{args}}
	err := c.facade.FacadeCall("StatusHistory", bulkArgs, &results)
	if err != nil {
		return status.History{}, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return status.History{}, errors.Errorf("expected 1 result got %d", len(results.Results))
	}
	if results.Results[0].Error != nil {
		return status.History{}, errors.Annotatef(results.Results[0].Error, "while processing the request")
	}
	history := make(status.History, len(results.Results[0].History.Statuses))
	if results.Results[0].History.Error != nil {
		return status.History{}, results.Results[0].History.Error
	}
	for i, h := range results.Results[0].History.Statuses {
		history[i] = status.DetailedStatus{
			Status:  status.Status(h.Status),
			Info:    h.Info,
			Data:    h.Data,
			Since:   h.Since,
			Kind:    status.HistoryKind(h.Kind),
			Version: h.Version,
			// TODO(perrito666) make sure these are still used.
			Life: h.Life,
			Err:  h.Err,
		}
		// TODO(perrito666) https://launchpad.net/bugs/1577589
		if !history[i].Kind.Valid() {
			logger.Errorf("history returned an unknown status kind %q", h.Kind)
		}
	}
	return history, nil
}