github.com/rochacon/deis@v1.0.2-0.20150903015341-6839b592a1ff/mesos/pkg/etcd/lock.go (about)

     1  package etcd
     2  
     3  import (
     4  	etcdlock "github.com/leeor/etcd-sync"
     5  )
     6  
     7  // AcquireLock creates a pseudo lock in etcd with a specific ttl
     8  func AcquireLock(c *Client, key string, ttl uint64) error {
     9  	c.lock = etcdlock.NewMutexFromClient(c.client, key, ttl)
    10  	return c.lock.Lock()
    11  }
    12  
    13  // ReleaseLock releases the existing lock
    14  func ReleaseLock(c *Client) {
    15  	c.lock.Unlock()
    16  }