Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrResourceLocked = errors.New("resource is locked") ErrResourceNotLocked = errors.New("resource is not locked") )
Functions ¶
This section is empty.
Types ¶
type InMem ¶
type InMem struct {
// contains filtered or unexported fields
}
func (*InMem) ForceUnlockAfter ¶
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
type Locker ¶
type Locker interface { // Lock locks the resource by its name // It returns an error if the resource is already locked // // Example: // Lock("Deployment/my-namespace/my-deployment") // // This will lock the resource Deployment/my-namespace/my-deployment if it's not already locked Lock(name string) error // IsLocked checks if the resource is locked // // Example: // IsLocked("Deployment/my-namespace/my-deployment") // // This will return true if the resource Deployment/my-namespace/my-deployment is locked IsLocked(name string) bool // Unlock unlocks the resource by its name // It returns an error if the resource is not locked // // Example: // Unlock("Deployment/my-namespace/my-deployment") // // This will unlock the resource Deployment/my-namespace/my-deployment if it's locked Unlock(name string) error // ForceUnlockAfter unlocks all resources after the given duration // // Example: // ForceUnlockAfter(5 * time.Minute) // // This will unlock all resources after 5 minutes after a lock is acquired ForceUnlockAfter(duration time.Duration) }
Click to show internal directories.
Click to hide internal directories.