// MessageHistory gets all the messages, we store 3 at a time
352062
func (bps *Stats) MessageHistory() []string {
	strs := make([]string, 0, 3)
	for _, h := range bps.History.Records() {
		h1, _ := h.(*StatsHistoryRecord)
		if h1 != nil {
			strs = append(strs, h1.Message)
		}
	}
	return strs
}
564445
func (m *missionControl) ResetHistory() {
	m.Lock()
	m.failedEdges = make(map[EdgeLocator]time.Time)
	m.failedVertexes = make(map[route.Vertex]time.Time)
	m.Unlock()
}
366841
func getHistory(image string) ([]dockerHistory, error) {
	history := []dockerHistory{}
	res, err := get("images/" + image + "/history")
	if err != nil {
		return history, err
	}
	body, err := ioutil.ReadAll(res.Body)
	res.Body.Close()
	if err != nil {
		return history, err
	}
	err = json.Unmarshal(body, &history)
	if err != nil {
		return history, err
	}
	return history, nil
}
1355769
func NewHistory(author, comment, createdBy string, isEmptyLayer bool) History {
	return History{
		Author:     author,
		Created:    time.Now().UTC(),
		CreatedBy:  createdBy,
		Comment:    comment,
		EmptyLayer: isEmptyLayer,
	}
}
765397
func (t *Tab) NavigationHistory() (int, []*gcdapi.PageNavigationEntry, error) {
	return t.Page.GetNavigationHistory()
}
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
}
302264
func SWFHistoryEventTypes() []string {
	es := make([]string, 0, len(eventTypes))
	for k := range eventTypes {
		es = append(es, k)
	}
	return es
}
1197276
func (r Hardware) GetAlarmHistory(startDate *datatypes.Time, endDate *datatypes.Time, alarmId *string) (resp []datatypes.Container_Monitoring_Alarm_History, err error) {
	params := []interface{}{
		startDate,
		endDate,
		alarmId,
	}
	err = r.Session.DoRequest("SoftLayer_Hardware", "getAlarmHistory", params, &r.Options, &resp)
	return
}
280117
func (sl *Slack) ChannelsHistory(opt *ChannelsHistoryOpt) (*ChannelsHistoryResponse, error) {
	uv := sl.urlValues()
	err := opt.Bind(uv)
	if err != nil {
		return nil, err
	}
	body, err := sl.GetRequest(channelsHistoryApiEndpoint, uv)
	if err != nil {
		return nil, err
	}
	res := new(ChannelsHistoryResponse)
	err = json.Unmarshal(body, res)
	if err != nil {
		return nil, err
	}
	if !res.Ok {
		return nil, errors.New(res.Error)
	}
	return res, 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
}
272342
public static final void recordKeyHistory(List<Object> baseMessage, Object messageKey)
    {
        KeyHistory history = new KeyHistory();

        if (messageKey != null)
        {
            history.addKey(messageKey.toString());
        }

        baseMessage.add(0, history);
    }
1274951
func (self *Matrix) DoHistory(req *request.Request, ok bool) bool {
	if !req.IsReloadable() {
		self.tempHistoryLock.Lock()
		delete(self.tempHistory, req.Unique())
		self.tempHistoryLock.Unlock()

		if ok {
			self.history.UpsertSuccess(req.Unique())
			return false
		}
	}

	if ok {
		return false
	}

	self.failureLock.Lock()
	defer self.failureLock.Unlock()
	if _, ok := self.failures[req.Unique()]; !ok {
		// 首次失败时，在任务队列末尾重新执行一次
		self.failures[req.Unique()] = req
		logs.Log.Informational(" *     + 失败请求: [%v]\n", req.GetUrl())
		return true
	}
	// 失败两次后，加入历史失败记录
	self.history.UpsertFailure(req)
	return false
}
940399
func PrettyHistoryEvent(h *swf.HistoryEvent) string {
	var buffer bytes.Buffer
	buffer.WriteString("HistoryEvent{ ")
	if h.EventId != nil {
		buffer.WriteString(fmt.Sprintf("EventId: %d,", *h.EventId))
	}
	if h.EventTimestamp != nil {
		buffer.WriteString(fmt.Sprintf("EventTimestamp: %s, ", *h.EventTimestamp))
	}
	if h.EventType != nil {
		buffer.WriteString(fmt.Sprintf("EventType: %s,", *h.EventType))
	}
	buffer.WriteString(fmt.Sprintf(" %+v", eventTypes[*h.EventType](h)))
	buffer.WriteString(" }")
	return buffer.String()
}
1335024
func (p *terminalPrompter) SetHistory(history []string) {
	p.State.ReadHistory(strings.NewReader(strings.Join(history, "\n")))
}
1059391
func (r *Session) GetRemoteHistory(imgID, registry string) ([]string, error) {
	res, err := r.client.Get(registry + "images/" + imgID + "/ancestry")
	if err != nil {
		return nil, err
	}
	defer res.Body.Close()
	if res.StatusCode != 200 {
		if res.StatusCode == 401 {
			return nil, errcode.ErrorCodeUnauthorized.WithArgs()
		}
		return nil, newJSONError(fmt.Sprintf("Server error: %d trying to fetch remote history for %s", res.StatusCode, imgID), res)
	}

	var history []string
	if err := json.NewDecoder(res.Body).Decode(&history); err != nil {
		return nil, fmt.Errorf("Error while reading the http response: %v", err)
	}

	logrus.Debugf("Ancestry: %v", history)
	return history, nil
}
240085
func (remote *RemoteDebugger) GetNavigationHistory() (int, []NavigationEntry, error) {
	rawReply, err := remote.sendRawReplyRequest("Page.getNavigationHistory", nil)

	if err != nil {
		return 0, nil, err
	}

	var history struct {
		Current int64             `json:"currentIndex"`
		Entries []NavigationEntry `json:"entries"`
	}

	if err := json.Unmarshal(rawReply, &history); err != nil {
		return 0, nil, err
	}

	return int(history.Current), history.Entries, nil
}
1350541
func (rtm *Client) ChannelsHistory(channelID string, latest, oldest *time.Time, count int, unreads bool) (*ChannelsHistoryResponse, error) {
	unreadsValue := "0"
	if unreads {
		unreadsValue = "1"
	}

	if count == -1 {
		count = 1000
	} else if count < 1 {
		count = 1
	} else if count > 1000 {
		count = 1000
	}

	res := ChannelsHistoryResponse{}
	req := NewExternalRequest().
		AsPost().
		WithScheme(APIScheme).
		WithHost(APIEndpoint).
		WithPath("api/channels.history").
		WithPostData("token", rtm.Token).
		WithPostData("channel", channelID).
		WithPostData("count", string(count)).
		WithPostData("unreads", unreadsValue)

	if latest != nil {
		req = req.WithPostData("latest", Timestamp{time: *latest}.String())
	}

	if oldest != nil {
		req = req.WithPostData("oldest", Timestamp{time: *latest}.String())
	}

	err := req.JSON(&res)
	if err != nil {
		return nil, err
	}

	if len(res.Error) != 0 {
		return nil, exception.New(res.Error)
	}

	if !res.OK {
		return nil, exception.New("slack response `ok` is false.")
	}

	return &res, nil
}