locking

package
v0.0.0-...-9be662f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	GetObject() interface{}
	GetExpiry() time.Time
}

type KubeLock

type KubeLock struct {
	// contains filtered or unexported fields
}

func NewKubeLock

func NewKubeLock(sec *api.Secret) (*KubeLock, error)

func (*KubeLock) GetExpiry

func (k *KubeLock) GetExpiry() time.Time

func (*KubeLock) GetObject

func (k *KubeLock) GetObject() interface{}

type KubeProvider

type KubeProvider struct {
	// contains filtered or unexported fields
}

func NewKubeProvider

func NewKubeProvider(kubeClient *client.Client) (*KubeProvider, error)

func (*KubeProvider) Lock

func (kp *KubeProvider) Lock(lock Interface) (Interface, error)

Lock will acquire a lock by attempting to create a secret with name `name` in the given namespace. If a lock with the same name already exists, it'll check the locks expiry time and if it's less than the current time, will acquire the lock for itself

func (*KubeProvider) Unlock

func (kp *KubeProvider) Unlock(lock Interface) (Interface, error)

type Locking

type Locking struct {
	Provider
}

func New

func New(provider Provider) (*Locking, error)

func (*Locking) LockAll

func (l *Locking) LockAll(locks ...Interface) ([]Interface, []error)

func (*Locking) UnlockAll

func (l *Locking) UnlockAll(locks ...Interface) ([]Interface, []error)

type Provider

type Provider interface {
	Lock(lock Interface) (Interface, error)
	Unlock(lock Interface) (Interface, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL