// ChangeMilestoneIssueStats updates the open/closed issues counter and progress
// for the milestone associated with the given issue.
763703
func ChangeMilestoneIssueStats(issue *Issue) (err error) {
	sess := x.NewSession()
	defer sess.Close()
	if err = sess.Begin(); err != nil {
		return err
	}

	if err = changeMilestoneIssueStats(sess, issue); err != nil {
		return err
	}

	return sess.Commit()
}
198978
func (_ *VMPowerOn) CheckChanges(a, e, changes *VMPowerOn) error {
	glog.Info("VMPowerOn.CheckChanges invoked!")
	return nil
}
872006
func UpdateIssueUsersByStatus(issueID int64, isClosed bool) error {
	return updateIssueUsersByStatus(x, issueID, isClosed)
}
287904
func (v *version) updateCompactionScore() {
	// We treat level-0 specially by bounding the number of files instead of
	// number of bytes for two reasons:
	//
	// (1) With larger write-buffer sizes, it is nice not to do too many
	// level-0 compactions.
	//
	// (2) The files in level-0 are merged on every read and therefore we
	// wish to avoid too many files when the individual file size is small
	// (perhaps because of a small write-buffer setting, or very high
	// compression ratios, or lots of overwrites/deletions).
	v.compactionScore = float64(len(v.files[0])) / l0CompactionTrigger
	v.compactionLevel = 0

	maxBytes := float64(10 * 1024 * 1024)
	for level := 1; level < numLevels-1; level++ {
		score := float64(totalSize(v.files[level])) / maxBytes
		if score > v.compactionScore {
			v.compactionScore = score
			v.compactionLevel = level
		}
		maxBytes *= 10
	}
}
1320769
func (_ *AttachISO) CheckChanges(a, e, changes *AttachISO) error {
	glog.Info("AttachISO.CheckChanges invoked!")
	return nil
}
1121276
func (observer *Observer) UpdateQueueStats(queue string) {
	queueStats := &QueueStat{ConsumerStats: make(map[string]*ConsumerStat)}

	queueStats.InputRateSecond = observer.fetchStat(queueInputRateKey(queue), 1)
	queueStats.InputSizeSecond = observer.fetchStat(queueInputSizeKey(queue), 1)
	queueStats.FailSizeSecond = observer.fetchStat(queueFailedSizeKey(queue), 1)

	queueStats.InputRateMinute = observer.fetchStat(queueInputRateKey(queue), 60)
	queueStats.InputSizeMinute = observer.fetchStat(queueInputSizeKey(queue), 60)
	queueStats.FailSizeMinute = observer.fetchStat(queueFailedSizeKey(queue), 60)

	queueStats.InputRateHour = observer.fetchStat(queueInputRateKey(queue), 3600)
	queueStats.InputSizeHour = observer.fetchStat(queueInputSizeKey(queue), 3600)
	queueStats.FailSizeHour = observer.fetchStat(queueFailedSizeKey(queue), 3600)

	queueStats.WorkRateSecond = 0
	queueStats.WorkRateMinute = 0
	queueStats.WorkRateHour = 0

	consumers, err := observer.getConsumers(queue)
	if err != nil {
		log.Fatalf("ERROR FETCHING CONSUMERS for %s %s", queue, err.Error())
		return
	}

	for _, consumer := range consumers {
		stat := &ConsumerStat{}

		stat.WorkRateSecond = observer.fetchStat(consumerWorkingRateKey(queue, consumer), 1)
		stat.WorkRateMinute = observer.fetchStat(consumerWorkingRateKey(queue, consumer), 60)
		stat.WorkRateHour = observer.fetchStat(consumerWorkingRateKey(queue, consumer), 3600)

		queueStats.WorkRateSecond += stat.WorkRateSecond
		queueStats.WorkRateMinute += stat.WorkRateMinute
		queueStats.WorkRateHour += stat.WorkRateHour

		queueStats.ConsumerStats[consumer] = stat
	}

	observer.Stats[queue] = queueStats
}
238565
func (tracker *issueTracker) getOrCreateMilestone(
	v *version.Version,
) (*github.Milestone, action.Action, error) {

	var (
		client = tracker.newClient()
		owner  = tracker.config.GitHubOwner
		repo   = tracker.config.GitHubRepository
		title  = v.BaseString()

		milestone *github.Milestone
		act       action.Action
		err       error
	)
	withRequestAllocated(func() {
		milestone, act, err = ghissues.GetOrCreateMilestoneForTitle(client, owner, repo, title)
	})
	return milestone, act, err
}
770540
func (r *Repository) GetMilestonesURL() string {
	if r == nil || r.MilestonesURL == nil {
		return ""
	}
	return *r.MilestonesURL
}
973695
func (kcs *kbfsCurrentStatus) PushStatusChange() {
	kcs.lock.Lock()
	defer kcs.lock.Unlock()
	close(kcs.invalidateChan)
	kcs.invalidateChan = make(chan StatusUpdate)
}
1162731
func (kcs *kbfsCurrentStatus) PushConnectionStatusChange(service string, err error) {
	kcs.lock.Lock()
	defer kcs.lock.Unlock()

	if err != nil {
		// Exit early if the service is already failed, to avoid an
		// invalidation.
		_, errExisted := kcs.failingServices[service]
		kcs.failingServices[service] = err
		if errExisted {
			return
		}
	} else {
		// Potentially exit early if nothing changes.
		_, exist := kcs.failingServices[service]
		if !exist {
			return
		}
		delete(kcs.failingServices, service)
	}

	close(kcs.invalidateChan)
	kcs.invalidateChan = make(chan StatusUpdate)
}
717247
func (k *KeybaseDaemonLocal) NotifyOnlineStatusChanged(ctx context.Context, online bool) error {
	return checkContext(ctx)
}
601086
func UpdateIsiQuotaHardThreshold(
	ctx context.Context,
	client api.Client,
	path string, size int64) (err error) {

	// PAPI call: PUT https://1.2.3.4:8080/platform/1/quota/quotas/Id
	//             { "enforced" : true,
	//               "thresholds_include_overhead" : false,
	//               "thresholds" : { "advisory" : null,
	//                                "hard" : 1234567890,
	//                                "soft" : null
	//                              }
	//             }
	var data = &IsiUpdateQuotaReq{
		Enforced:                  true,
		ThresholdsIncludeOverhead: false,
		Thresholds:                isiThresholdsReq{Advisory: nil, Hard: size, Soft: nil},
	}

	quota, err := GetIsiQuota(ctx, client, path)
	if err != nil {
		return err
	}

	var quotaResp IsiQuota
	err = client.Put(ctx, quotaPath, quota.Id, nil, nil, data, &quotaResp)
	return err
}
206166
func GetMilestonesByRepoID(repoID int64) ([]*Milestone, error) {
	miles := make([]*Milestone, 0, 10)
	return miles, x.Where("repo_id = ?", repoID).Find(&miles)
}
62974
func (mb *SquareMetrics) publishMetrics() {
	for range time.Tick(mb.interval) {
		err := mb.postMetrics()
		if err != nil && err != io.EOF {
			mb.logger.Printf("error reporting metrics: %s", err)
		}
	}
}
836540
func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error) {
	return GetMilestoneByRepoID(repo.ID, milestoneID)
}
193118
func (m *MilestoneStats) GetClosedMilestones() int {
	if m == nil || m.ClosedMilestones == nil {
		return 0
	}
	return *m.ClosedMilestones
}
459161
func (c *Condition) convertClinicalStatus() string {
	var status string
	statusConcept := c.StatusCode.FHIRCodeableConcept("")
	switch {
	case statusConcept.MatchesCode("http://snomed.info/sct", "55561003"):
		status = "active"
	case statusConcept.MatchesCode("http://snomed.info/sct", "73425007"):
		status = "remission"
	case statusConcept.MatchesCode("http://snomed.info/sct", "413322009"):
		status = "resolved"
	case statusConcept.MatchesCode("http://hl7.org/fhir/ValueSet/v3-ActStatus", "active"):
		status = "active"
	}

	// In order to remain consistent, fix the status if there is an end date (abatement)
	// and it doesn't match the start date (in which case we can't be sure it's really an end)
	if status == "" && c.EndTime != nil && c.StartTime != nil && *c.EndTime != *c.StartTime {
		status = "resolved"
	}

	return status
}