Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewReconciler ¶
func NewReconciler(upstream reconcile.Reconciler, cache ReconcileCacher, log logr.Logger) reconcile.Reconciler
NewReconciler returns a reconcile wrapper that will delay new reconcile.Requests after the cache expiry of the request string key. A successful reconciliation is defined as as one where no error is returned.
Types ¶
type ReconcileCache ¶
type ReconcileCache struct {
// contains filtered or unexported fields
}
ReconcileCache uses and underlying time to live last recently used cache to track high frequency requests. A reconciler should call ShouldProcess to determine if the key has expired. If the key has expired, a zero value time.Time and true is returned. If the key has not expired, the expiration and false is returned. Upon successful reconciliation a reconciler should call Reconciled to update the cache expiry.
func NewRequestCache ¶
func NewRequestCache(window time.Duration) (*ReconcileCache, error)
NewRequestCache creates a new instance of a ReconcileCache given a specified window of expiration.
func (*ReconcileCache) Reconciled ¶
func (cache *ReconcileCache) Reconciled(key string)
Reconciled updates the cache expiry for a given key.
func (*ReconcileCache) ShouldProcess ¶
func (cache *ReconcileCache) ShouldProcess(key string) (time.Time, bool)
ShouldProcess determines if the key has expired. If the key has expired, a zero value time.Time and true is returned. If the key has not expired, the expiration and false is returned.
type ReconcileCacher ¶
type ReconcileCacher interface { ShouldProcess(key string) (expiration time.Time, ok bool) Reconciled(key string) }
ReconcileCacher describes an interface for determining if a request should be reconciled through a call to ShouldProcess and if ok, reset the cool down through a call to Reconciled.