The locking logic was added to its own package as it may need to be used by other parts of the code. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
16 lines
320 B
Go
16 lines
320 B
Go
package locking
|
|
|
|
import "time"
|
|
|
|
// TODO(gabriel-samfira): needs owner attribute.
|
|
type Locker interface {
|
|
TryLock(key string) bool
|
|
Unlock(key string, remove bool)
|
|
Delete(key string)
|
|
}
|
|
|
|
type InstanceDeleteBackoff interface {
|
|
ShouldProcess(key string) (bool, time.Time)
|
|
Delete(key string)
|
|
RecordFailure(key string)
|
|
}
|