func WLock(client Registry, name string, ttl uint64) (LockHandle, error) {
	return rwLock(client, LockTypeWrite, name, ttl)
}
WLock is a function to acquire a write lock.

Inputs:
client     - etcd client object.
lockType   - type of the lock, read or write.
name       - name of the lock.
ttl        - time needed to complete the work after acquiring lock. If the
lock is not released within this time by calling Unlock, it is
automatically released.
Outputs:
LockHandle - lock handle to provide to UnLock.
error      - any etcd errors or ttl expiry.
package utils
import (
	"encoding/json"
	"errors"
	"flag"
	"path"
	"github.com/coreos/go-etcd/etcd"
	"github.com/golang/glog"
	"github.com/satori/go.uuid"
)
var (
	ErrLockID        = errors.New("Can't get lock id")
	ErrLockExpired   = errors.New("Lock request expired")
	ErrLockReqLost   = errors.New("Lock request lost")
	ErrLockEnq       = errors.New("Error enqueuing lock request")
	ErrLockGet       = errors.New("Error reading lock queue")
	ErrLockDelete    = errors.New("Error deleting lock")
	ErrLockMarshal   = errors.New("Marshal error")
	ErrLockUnmarshal = errors.New("Unmarshal error")
)
var QTTL = flag.Uint64("queue-ttl", 30, "Timeout in seconds for a lock queue entry")
var (
	lockID = uuid.NewV4().String()
	GetLockID = func() (string, error) {
		return lockID, nil
	}
)
const (
	kLocksDir = "/rwlocks"  
)
type LockType int
type LockHandle string
const (
	LockTypeRead LockType = iota
	LockTypeWrite
)
var LockTypes = map[LockType]string{
	LockTypeRead:  "read-lock",
	LockTypeWrite: "write-lock",
}
type LockState struct {
	LockType string
	Id       string
}
func RLock(client Registry, name string, ttl uint64) (LockHandle, error) {
	return rwLock(client, LockTypeRead, name, ttl)
}