Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrExist = errors.New("holder exists") ErrNotExist = errors.New("holder does not exist") )
Functions ¶
This section is empty.
Types ¶
type EtcdLockClient ¶
type EtcdLockClient struct {
// contains filtered or unexported fields
}
EtcdLockClient is a wrapper around the etcd client that provides simple primitives to operate on the internal semaphore and holders structs through etcd.
func NewEtcdLockClient ¶
func NewEtcdLockClient(ec etcd.EtcdClient) (client *EtcdLockClient, err error)
func (*EtcdLockClient) Get ¶
func (c *EtcdLockClient) Get(key string) (sem *Semaphore, err error)
Get fetches the Semaphore from etcd.
func (*EtcdLockClient) Init ¶
func (c *EtcdLockClient) Init() (err error)
Init sets an initial copy of the semaphore if it doesn't exist yet.
func (*EtcdLockClient) Set ¶
func (c *EtcdLockClient) Set(key string, sem *Semaphore) (err error)
Set sets a Semaphore in etcd.
func (*EtcdLockClient) SetKeyPrefix ¶
func (c *EtcdLockClient) SetKeyPrefix(prefix string)
type Lock ¶
type Lock struct {
// contains filtered or unexported fields
}
func New ¶
func New(holder, id string, client LockClient) (lock *Lock)
type LockClient ¶
Click to show internal directories.
Click to hide internal directories.