Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsAlreadyLocked ¶
func IsAlreadyUsed ¶
func IsInvalidArgument ¶
func IsNotLocked ¶
func IsNotOwner ¶
Types ¶
type GlobalMutex ¶
type GlobalMutex struct {
// contains filtered or unexported fields
}
func (*GlobalMutex) Lock ¶
func (gm *GlobalMutex) Lock() error
Lock tries to claim the given mutex. If successful, it returns nil, otherwise it returns an error. If the mutex is already locked, it returns directly with nil.
func (*GlobalMutex) Locked ¶
func (gm *GlobalMutex) Locked() bool
Locked returns true if this lock is claimed successfully.
func (*GlobalMutex) Unlock ¶
func (gm *GlobalMutex) Unlock() error
Unlock releases the given mutex. If the mutex was not locked, it returns nil right away.
type GlobalMutexService ¶
type GlobalMutexService interface { // New creates a new global mutex with a given name. // The mutex is initialized but not yet claimed. // name is the name of the new mutex. This name is accessible globally in the cluster // ttl is the amount of time before the mutex will automatically be released New(name string, ttl time.Duration) (*GlobalMutex, error) }
func NewEtcdGlobalMutexService ¶
func NewEtcdGlobalMutexService(etcdClient client.Client, prefix string) GlobalMutexService
NewEtcdGlobalMutexService returns a global mutex service implementation based on ETCD.
Click to show internal directories.
Click to hide internal directories.