mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
25 lines
475 B
Go
25 lines
475 B
Go
package v2
|
|
|
|
import (
|
|
"path"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
// releaseLockHandler deletes the lock.
|
|
func (h *handler) releaseLockHandler(w http.ResponseWriter, req *http.Request) {
|
|
h.client.SyncCluster()
|
|
|
|
vars := mux.Vars(req)
|
|
keypath := path.Join(prefix, vars["key_with_index"])
|
|
|
|
// Delete the lock.
|
|
_, err := h.client.Delete(keypath)
|
|
if err != nil {
|
|
http.Error(w, "delete lock index error: " + err.Error(), http.StatusInternalServerError)
|
|
return
|
|
}
|
|
}
|
|
|