Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketFunc ¶
var NamespaceBucket BucketFunc = func(key Key) BucketKey { namespace, _, _ := cache.SplitMetaNamespaceKey(key) return namespace }
var SingleBucket BucketFunc = func(key Key) BucketKey { return "" }
type GetSyncLimit ¶
type IsSDDeleted ¶
type LockName ¶
func DecodeLockName ¶
func GetLockName ¶
func GetLockName(sd *v1alpha1.SimpleDeployment) (*LockName, error)
func NewLockName ¶
func (*LockName) EncodeName ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewLockManager ¶
func NewLockManager(getSyncLimit GetSyncLimit, nextSD NextSD, isSDDeleted IsSDDeleted) *Manager
func (*Manager) Release ¶
func (cm *Manager) Release(sd *v1alpha1.SimpleDeployment)
func (*Manager) TryAcquire ¶
type PrioritySemaphore ¶
type PrioritySemaphore struct {
// contains filtered or unexported fields
}
func NewSemaphore ¶
func NewSemaphore(name string, limit int, nextSD NextSD) *PrioritySemaphore
type Throttler ¶
type Throttler interface { Init(wfs []v1alpha1.SimpleDeployment) error Add(key Key, priority int32, creationTime time.Time) // Admit returns if the item should be processed. Admit(key Key) bool // Remove notifies throttler that item processing is no longer needed Remove(key Key) }
Throttler allows the controller to limit number of items it is processing in parallel. Items are processed in priority order, and one processing starts, other items (including higher-priority items) will be kept pending until the processing is complete. Implementations should be idempotent.
func NewThrottler ¶
func NewThrottler(parallelism int, bucketFunc BucketFunc, queue QueueFunc) Throttler
NewThrottler returns a throttle that only runs `parallelism` items at once. When an item may need processing, `queue` is invoked.
Click to show internal directories.
Click to hide internal directories.