release_handler.go 482 B

123456789101112131415161718192021222324
  1. package v2
  2. import (
  3. "path"
  4. "net/http"
  5. "github.com/gorilla/mux"
  6. )
  7. // releaseLockHandler deletes the lock.
  8. func (h *handler) releaseLockHandler(w http.ResponseWriter, req *http.Request) {
  9. h.client.SyncCluster()
  10. vars := mux.Vars(req)
  11. keypath := path.Join(prefix, vars["key_with_index"])
  12. // Delete the lock.
  13. _, err := h.client.Delete(keypath, false)
  14. if err != nil {
  15. http.Error(w, "delete lock index error: " + err.Error(), http.StatusInternalServerError)
  16. return
  17. }
  18. }