// NewGraduatingExpirationProvider returns an expiration provider
// that has an initial expiration and then expires in graduated increments
// with a maximum expiration time.
192161
func NewGraduatingExpirationProvider(initialExpiry, increments, maxExpiry time.Duration) ExpirationProvider {
	var iteration uint32
	return func() time.Duration {
		expiry := initialExpiry + time.Duration(iteration)*increments
		if expiry > maxExpiry {
			return maxExpiry
		}
		iteration++
		return expiry
	}
}
1075869
func NewInfluxProvider(in *influx.Influx, stop func()) Provider {
	return &influxProvider{
		in:   in,
		stop: stop,
	}
}
684414
func NewEstablishingController(crdInformer informers.CustomResourceDefinitionInformer,
	crdClient client.CustomResourceDefinitionsGetter) *EstablishingController {
	ec := &EstablishingController{
		crdClient: crdClient,
		crdLister: crdInformer.Lister(),
		crdSynced: crdInformer.Informer().HasSynced,
		queue:     workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "crdEstablishing"),
	}

	ec.syncFn = ec.sync

	return ec
}
68922
func NewProvider(pOps peer.Operations, pSup peer.Support, r Registrar) *Provider {
	return &Provider{
		Peer:        pOps,
		PeerSupport: pSup,
		Registrar:   r,
	}
}
451977
func NewLimiter(max float64, tbOptions *limiter.ExpirableOptions) *limiter.Limiter {
	return limiter.New(tbOptions).SetMax(max).SetBurst(int(math.Max(1, max)))
}
1029104
func NewProvider(name string, callback EnableCallback) (provider *Provider, err error) {
	return NewProviderWithID(name, providerIDFromName(name), callback)
}
1157245
func (l *LeaseOptions) ExpirationTime() time.Time {
	var expireTime time.Time
	if l.LeaseEnabled() {
		expireTime = time.Now().Add(l.LeaseTotal())
	}
	return expireTime
}
673723
func (m *ExpirationManager) updatePendingInternal(le *leaseEntry, leaseTotal time.Duration) {
	// Check for an existing timer
	pending, ok := m.pending[le.LeaseID]

	// If there is no expiry time, don't do anything
	if le.ExpireTime.IsZero() {
		// if the timer happened to exist, stop the time and delete it from the
		// pending timers.
		if ok {
			pending.timer.Stop()
			delete(m.pending, le.LeaseID)
		}
		return
	}

	// Create entry if it does not exist or reset if it does
	if ok {
		pending.timer.Reset(leaseTotal)
	} else {
		timer := time.AfterFunc(leaseTotal, func() {
			m.expireFunc(m.quitContext, m, le)
		})
		pending = pendingInfo{
			timer: timer,
		}
	}

	// Extend the timer by the lease total
	pending.exportLeaseTimes = m.leaseTimesForExport(le)

	m.pending[le.LeaseID] = pending
}
1298962
func (s *ADMMessage) SetExpiresAfter(v string) *ADMMessage {
	s.ExpiresAfter = &v
	return s
}
347627
func NewExpirationStore(keyFunc KeyFunc, expirationPolicy ExpirationPolicy) Store {
	return &ExpirationCache{
		cacheStorage:     NewThreadSafeStore(Indexers{}, Indices{}),
		keyFunc:          keyFunc,
		clock:            clock.RealClock{},
		expirationPolicy: expirationPolicy,
	}
}
886652
func NewDNSProvider() (*DNSProvider, error) {
	config := NewDefaultConfig()

	endpoint, err := url.Parse(env.GetOrDefaultString("EASYDNS_ENDPOINT", defaultEndpoint))
	if err != nil {
		return nil, fmt.Errorf("easydns: %v", err)
	}
	config.Endpoint = endpoint

	values, err := env.Get("EASYDNS_TOKEN", "EASYDNS_KEY")
	if err != nil {
		return nil, fmt.Errorf("easydns: %v", err)
	}

	config.Token = values["EASYDNS_TOKEN"]
	config.Key = values["EASYDNS_KEY"]

	return NewDNSProviderConfig(config)
}
514168
func (c *Configuration) InitACMEProvider() (*acmeprovider.Provider, error) {
	if c.ACME != nil {
		if len(c.ACME.Storage) == 0 {
			return nil, errors.New("unable to initialize ACME provider with no storage location for the certificates")
		}
		return &acmeprovider.Provider{
			Configuration: c.ACME,
		}, nil
	}
	return nil, nil
}
1259107
func NewProvider(ctx context.Context, issuer string) (*Provider, error) {
	wellKnown := strings.TrimSuffix(issuer, "/") + "/.well-known/openid-configuration"
	resp, err := contextClient(ctx).Get(wellKnown)
	if err != nil {
		return nil, err
	}
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("%s: %s", resp.Status, body)
	}
	defer resp.Body.Close()
	var p Provider
	if err := json.Unmarshal(body, &p); err != nil {
		return nil, fmt.Errorf("oidc: failed to decode provider discovery object: %v", err)
	}
	p.rawClaims = body
	if p.Issuer != issuer {
		return nil, fmt.Errorf("oidc: issuer did not match the issuer returned by provider, expected %q got %q", issuer, p.Issuer)
	}
	return &p, nil
}
1028041
func NewReprovider(ctx context.Context, tick time.Duration, rsys routing.ContentRouting, keyProvider KeyChanFunc) *Reprovider {
	return &Reprovider{
		ctx:     ctx,
		trigger: make(chan doneFunc),
		closing: make(chan struct{}),

		rsys:        rsys,
		keyProvider: keyProvider,
		tick:        tick,
	}
}
591271
func NewLimiterExpiringBuckets(max int64, ttl, bucketDefaultExpirationTTL, bucketExpireJobInterval time.Duration) *Limiter {
	limiter := NewLimiter(max, ttl).SetExpiring(bucketDefaultExpirationTTL, bucketExpireJobInterval)
	return limiter
}
299511
func (s Storage) expirationDuration(c context.Context) time.Duration {
	if info.IsDevAppServer(c) {
		return time.Second
	}
	return time.Minute
}
210637
func (ttles *TTLExpirationScheduler) OnBlobExpire(f expiryFunc) {
	ttles.Lock()
	defer ttles.Unlock()

	ttles.onBlobExpire = f
}