// HasUpdate returns true if a new update is available
// the second output parameter is the latest ,full, version
346546
func (u *Updater) HasUpdate() (bool, string) {
	return u.currentVersion.LessThan(u.latestVersion), u.latestVersion.String()
}
112954
func (c *checker) CheckAndUpdate(p *predicate.Predicate) bool {
	if c.max && c.c <= 0 {
		return false
	}
	if p.Type() == predicate.Immutable {
		c.c--
		return true
	}

	if t, err := p.TimeAnchor(); err == nil {
		if c.ota != nil && !c.ota.Equal(*t) {
			return false
		}
		if c.o.LowerAnchor != nil && t.Before(*c.o.LowerAnchor) {
			return false
		}
		if c.o.UpperAnchor != nil && t.After(*c.o.UpperAnchor) {
			return false
		}
	}
	c.c--
	return true
}
264467
func (u *updater) Update(status error) {
	u.mu.Lock()
	defer u.mu.Unlock()

	u.status = status
}
369767
func (o *Object) computeUpdate() bool {
	//ensure only 1 update computation at a time
	o.mut.Lock()
	defer o.mut.Unlock()
	if o.checked {
		return false
	}
	//mark
	o.checked = true
	newBytes, err := json.Marshal(o.value)
	if err != nil {
		log.Printf("go-realtime: %s: marshal failed: %s", o.key, err)
		return false
	}
	//calculate change set
	ops, _ := jsonpatch.CreatePatch(o.bytes, newBytes)
	if len(o.bytes) > 0 && len(ops) == 0 {
		return false
	}
	delta, _ := json.Marshal(ops)
	prev := o.version
	o.version++
	//send this new change to each subscriber
	for _, u := range o.subscribers {
		update := &update{
			Key:     o.key,
			Version: o.version,
		}
		u.mut.Lock()
		//choose optimal update (send the smallest)
		if u.versions[o.key] == prev && len(o.bytes) > 0 && len(delta) < len(o.bytes) {
			update.Delta = true
			update.Data = delta
		} else {
			update.Delta = false
			update.Data = newBytes
		}
		//insert pending update
		u.pending = append(u.pending, update)
		//user now has this version
		u.versions[o.key] = o.version
		u.mut.Unlock()
	}
	o.bytes = newBytes
	return true
}
721681
func (*DatacentersTable) needsUpdate(row, cfg *Datacenter) bool {
	return row.Description != cfg.Description || row.State != cfg.State
}
1166065
func (strategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList {
	return validation.ValidateDeploymentConfigUpdate(obj.(*appsapi.DeploymentConfig), old.(*appsapi.DeploymentConfig))
}
831201
func (batch *UpdateBatch) Exists(ns string, key string) bool {
	nsUpdates, ok := batch.updates[ns]
	if !ok {
		return false
	}
	_, ok = nsUpdates.m[key]
	return ok
}
3547
func (i IndexFile) Has(name, version string) bool {
	_, err := i.Get(name, version)
	return err == nil
}
106394
func (db *Database) buildUpdate() string {
	var query bytes.Buffer
	query.WriteString(db.buildCTE())
	query.WriteString("UPDATE ")

	// Model only
	if len(db.tables) != 1 {
		db.panicLog("Please set a table with Model to Update")
	}
	query.WriteString(db.tables[0])
	query.WriteString(" SET ")

	updateSize := len(db.updateCreateFields)
	if updateSize == 0 {
		db.panicLog("Unable to detect fields to update")
	}

	for j, field := range db.updateCreateFields {
		query.WriteString(handleIdentifier(field))
		query.WriteString(" = $")
		query.WriteString(strconv.Itoa(db.varCount))
		db.varCount++
		if j != updateSize-1 {
			query.WriteString(", ")
		}
	}

	// Where (optional)
	if len(db.whereFields) > 0 {
		query.WriteString(db.buildWhere())
	}

	query.WriteString(db.buildReturning())

	qs := query.String()
	db.printLog(qs)
	return qs
}
499027
func (u *Updater) Update(ctx Context) (*Update, error) {
	options := ctx.UpdateOptions()
	update, err := u.update(ctx, options)
	report(ctx, err, update, options)
	return update, err
}
416023
func (batch *UpdateBatch) GetUpdates(ns string) map[string]*VersionedValue {
	nsUpdates, ok := batch.updates[ns]
	if !ok {
		return nil
	}
	return nsUpdates.m
}
536455
func checkUpdate(ctx *cli.Context) {
	// Do not print update messages, if quiet flag is set.
	if ctx.Bool("quiet") || ctx.GlobalBool("quiet") {
		// Its OK to ignore any errors during doUpdate() here.
		if updateMsg, _, currentReleaseTime, latestReleaseTime, err := getUpdateInfo(2 * time.Second); err == nil {
			printMsg(updateMessage{
				Status:  "success",
				Message: updateMsg,
			})
		} else {
			printMsg(updateMessage{
				Status:  "success",
				Message: prepareUpdateMessage("Run `mc update`", latestReleaseTime.Sub(currentReleaseTime)),
			})
		}
	}
}
1061561
func (s *sharedPullerState) AvailableUpdated() time.Time {
	s.mut.RLock()
	t := s.availableUpdated
	s.mut.RUnlock()
	return t
}
1135684
func (o *Object) Update() {
	o.mut.Lock()
	o.checked = false
	o.mut.Unlock()
}
1162069
func (j *Job) HasUpdateStrategy() bool {
	for _, tg := range j.TaskGroups {
		if tg.Update != nil {
			return true
		}
	}

	return false
}
803006
func HasUpdatedImages(dc *appsv1.DeploymentConfig, rc *v1.ReplicationController) (bool, []string) {
	updatedImages := []string{}
	rcImages := sets.NewString()
	for _, c := range rc.Spec.Template.Spec.Containers {
		rcImages.Insert(c.Image)
	}
	for _, c := range dc.Spec.Template.Spec.Containers {
		if !rcImages.Has(c.Image) {
			updatedImages = append(updatedImages, c.Image)
		}
	}
	if len(updatedImages) == 0 {
		return false, nil
	}
	return true, updatedImages
}
1176288
func IsPodUpdated(pod *v1.Pod, hash string, dsTemplateGeneration *int64) bool {
	// Compare with hash to see if the pod is updated, need to maintain backward compatibility of templateGeneration
	templateMatches := dsTemplateGeneration != nil &&
		pod.Labels[extensions.DaemonSetTemplateGenerationKey] == fmt.Sprint(dsTemplateGeneration)
	hashMatches := len(hash) > 0 && pod.Labels[extensions.DefaultDaemonSetUniqueLabelKey] == hash
	return hashMatches || templateMatches
}