// Ensure a deprecated item is only logged once instead of each time its used.
437175
func logDeprecatedf(logger aws.Logger, flag *int32, msg string) {
	if logger == nil {
		return
	}
	if atomic.CompareAndSwapInt32(flag, 0, 1) {
		logger.Log(msg)
	}
}
998637
func logSkippedDeps(tx *btcutil.Tx, deps map[chainhash.Hash]*txPrioItem) {
	if deps == nil {
		return
	}

	for _, item := range deps {
		log.Tracef("Skipping tx %s since it depends on %s\n",
			item.tx.Hash(), tx.Hash())
	}
}
193975
func EnsureDirExist(dir string) error {
	exist, err := IsDirExists(dir)
	if !exist || err != nil {
		return os.MkdirAll(dir, 0777)
	}
	return nil
}
523260
func (c *Conn) markForUse() {
	c.lastUsed = time.Now()
	atomic.AddInt32(&c.refCount, 1)
}
392913
func Ensure(fname string) (err error) {
  if ! checkfile(fname) {
    // does not exist generate file now
    err = Save(fname)
  }
  if err == nil {
    err = Load(fname)
  }
  return
}
90076
func EnsureValue(value reflect.Value) reflect.Value {
	switch value.Kind() {
	case reflect.Interface, reflect.Ptr:
		return value.Elem()
	default:
		return value
	}
}
918853
func (c *ReferenceCollection) EnsureLog(name string) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_reference_ensure_log(c.repo.ptr, cname)
	runtime.KeepAlive(c)
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}
906001
func (*Config) Ensure(c context.Context, req *config.EnsureRequest) (*config.Config, error) {
	if req.GetId() == "" {
		return nil, status.Errorf(codes.InvalidArgument, "ID is required")
	}
	cfg := &model.Config{
		ID:     req.Id,
		Config: *req.Config,
	}
	if err := datastore.Put(c, cfg); err != nil {
		return nil, errors.Annotate(err, "failed to store config").Err()
	}
	return &cfg.Config, nil
}
757125
func (*Projects) Ensure(c context.Context, req *projects.EnsureRequest) (*projects.Config, error) {
	if req.GetId() == "" {
		return nil, status.Errorf(codes.InvalidArgument, "ID is required")
	}
	p := &model.Project{
		ID:     req.Id,
		Config: *req.Project,
	}
	if err := datastore.Put(c, p); err != nil {
		return nil, errors.Annotate(err, "failed to store project").Err()
	}
	return &p.Config, nil
}
322319
func (r *PrevRevisions) Cleanup() {
	r.mu.Lock()
	defer r.mu.Unlock()

	r.revisions = make(map[string]datasync.KeyVal)
}
667167
func (l *logPrefixer) Debugf(format string, args ...interface{}) {
	l.Lock()
	l.log.Debugf(l.prefix(format), args...)
	l.Unlock()
}
317741
func (k *Kubernetes) EnsureDryRun() (bool, error) {
	d := &DryRun{
		new(multierror.Error),
	}

	if len(k.initTokens) == 0 {
		k.initTokens = k.NewInitTokens()
	}

	if d.changeNeeded(k.ensureDryRunMaxLeaseTTL()) {
		return true, d.ErrorOrNil()
	}

	for _, b := range k.backends() {
		if d.changeNeeded(b.EnsureDryRun()) {
			return true, d.ErrorOrNil()
		}
	}

	if d.changeNeeded(k.ensureDryRunPKIRolesEtcd(k.etcdKubernetesBackend)) {
		return true, d.ErrorOrNil()
	}

	if d.changeNeeded(k.ensureDryRunPKIRolesEtcd(k.etcdOverlayBackend)) {
		return true, d.ErrorOrNil()
	}

	if d.changeNeeded(k.ensureDryRunPKIRolesK8S(k.kubernetesBackend)) {
		return true, d.ErrorOrNil()
	}

	if d.changeNeeded(k.ensureDryRunPKIRolesK8SAPIProxy(k.kubernetesAPIProxyBackend)) {
		return true, d.ErrorOrNil()
	}

	if d.changeNeeded(k.ensureDryRunPolicies()) {
		return true, d.ErrorOrNil()
	}

	if d.changeNeeded(k.ensureDryRunInitTokens()) {
		return true, d.ErrorOrNil()
	}

	return false, d.ErrorOrNil()
}
10359
func (v *VersionCommand) doRepoCheck(updateLibs bool) (versionInfo string, needsUpdate bool) {
	var (
		title string
		localVersion *model.Version
	)
	for _, repo := range []string{"revel", "cmd", "modules"} {
		versonFromRepo, err := v.versionFromRepo(repo, "", "version.go")
		if err != nil {
			utils.Logger.Info("Failed to get version from repo", "repo", repo, "error", err)
		}
		switch repo {
		case "revel":
			title, repo, localVersion = "Revel Framework", "github.com/revel/revel", v.revelVersion
		case "cmd":
			title, repo, localVersion = "Revel Cmd", "github.com/revel/cmd/revel", v.cmdVersion
		case "modules":
			title, repo, localVersion = "Revel Modules", "github.com/revel/modules", v.modulesVersion
		}

		// Only do an update on the first loop, and if specified to update
		shouldUpdate := updateLibs && v.Command.Version.Update
		if v.Command.Version.Update {
			if  localVersion == nil || (versonFromRepo != nil && versonFromRepo.Newer(localVersion)) {
				needsUpdate = true
				if shouldUpdate {
					v.doUpdate(title, repo, localVersion, versonFromRepo)
					v.updateLocalVersions()
				}
			}
		}
		versionInfo = versionInfo + v.outputVersion(title, repo, localVersion, versonFromRepo)
	}
	return
}
503305
func (g *GenOpts) EnsureDefaults() error {
	if g.defaultsEnsured {
		return nil
	}
	DefaultSectionOpts(g)
	if g.LanguageOpts == nil {
		g.LanguageOpts = GoLangOpts()
	}
	// set defaults for flattening options
	g.FlattenOpts = &analysis.FlattenOpts{
		Minimal:      true,
		Verbose:      true,
		RemoveUnused: false,
		Expand:       false,
	}
	g.defaultsEnsured = true
	return nil
}
1051380
func ensureSpecTagGenerationsAreSet(stream, oldStream *imageapi.ImageStream) {
	oldTags := map[string]imageapi.TagReference{}
	if oldStream != nil && oldStream.Spec.Tags != nil {
		oldTags = oldStream.Spec.Tags
	}

	// set the generation for any spec tags that have changed, are nil, or are zero
	for tag, ref := range stream.Spec.Tags {
		if oldRef, ok := oldTags[tag]; !ok || tagRefChanged(oldRef, ref, stream.Namespace) {
			ref.Generation = nil
		}

		if ref.Generation != nil && *ref.Generation != 0 {
			continue
		}
		ref.Generation = &stream.Generation
		stream.Spec.Tags[tag] = ref
	}
}
1352180
func (b *BlockOpsStandard) TogglePrefetcher(enable bool) <-chan struct{} {
	return b.queue.TogglePrefetcher(enable, nil, nil)
}
1363577
func (m *Manager) requiresRefresh(tr *authenticationv1.TokenRequest) bool {
	if tr.Spec.ExpirationSeconds == nil {
		klog.Errorf("expiration seconds was nil for tr: %#v", tr)
		return false
	}
	now := m.clock.Now()
	exp := tr.Status.ExpirationTimestamp.Time
	iat := exp.Add(-1 * time.Duration(*tr.Spec.ExpirationSeconds) * time.Second)

	if now.After(iat.Add(maxTTL)) {
		return true
	}
	// Require a refresh if within 20% of the TTL from the expiration time.
	if now.After(exp.Add(-1 * time.Duration((*tr.Spec.ExpirationSeconds*20)/100) * time.Second)) {
		return true
	}
	return false
}