mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Add mod/lock version.
This commit is contained in:
parent
f3d438a93f
commit
e76b7d1e8b
@ -1,4 +1,4 @@
|
|||||||
package lock
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
@ -1,4 +1,4 @@
|
|||||||
package lock
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
@ -1,4 +1,4 @@
|
|||||||
package lock
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
@ -1,4 +1,4 @@
|
|||||||
package lock
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
@ -1,4 +1,4 @@
|
|||||||
package lock
|
package v2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
@ -164,25 +164,25 @@ func TestModLockRenew(t *testing.T) {
|
|||||||
|
|
||||||
|
|
||||||
func testAcquireLock(s *server.Server, key string, ttl int) (string, error) {
|
func testAcquireLock(s *server.Server, key string, ttl int) (string, error) {
|
||||||
resp, err := tests.PostForm(fmt.Sprintf("%s/mod/lock/%s?ttl=%d", s.URL(), key, ttl), nil)
|
resp, err := tests.PostForm(fmt.Sprintf("%s/mod/lock/v2/%s?ttl=%d", s.URL(), key, ttl), nil)
|
||||||
ret := tests.ReadBody(resp)
|
ret := tests.ReadBody(resp)
|
||||||
return string(ret), err
|
return string(ret), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func testGetLockIndex(s *server.Server, key string) (string, error) {
|
func testGetLockIndex(s *server.Server, key string) (string, error) {
|
||||||
resp, err := tests.Get(fmt.Sprintf("%s/mod/lock/%s", s.URL(), key))
|
resp, err := tests.Get(fmt.Sprintf("%s/mod/lock/v2/%s", s.URL(), key))
|
||||||
ret := tests.ReadBody(resp)
|
ret := tests.ReadBody(resp)
|
||||||
return string(ret), err
|
return string(ret), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func testReleaseLock(s *server.Server, key string, index int) (string, error) {
|
func testReleaseLock(s *server.Server, key string, index int) (string, error) {
|
||||||
resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/lock/%s/%d", s.URL(), key, index), nil)
|
resp, err := tests.DeleteForm(fmt.Sprintf("%s/mod/lock/v2/%s/%d", s.URL(), key, index), nil)
|
||||||
ret := tests.ReadBody(resp)
|
ret := tests.ReadBody(resp)
|
||||||
return string(ret), err
|
return string(ret), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRenewLock(s *server.Server, key string, index int, ttl int) (string, error) {
|
func testRenewLock(s *server.Server, key string, index int, ttl int) (string, error) {
|
||||||
resp, err := tests.PutForm(fmt.Sprintf("%s/mod/lock/%s/%d?ttl=%d", s.URL(), key, index, ttl), nil)
|
resp, err := tests.PutForm(fmt.Sprintf("%s/mod/lock/v2/%s/%d?ttl=%d", s.URL(), key, index, ttl), nil)
|
||||||
ret := tests.ReadBody(resp)
|
ret := tests.ReadBody(resp)
|
||||||
return string(ret), err
|
return string(ret), err
|
||||||
}
|
}
|
@ -6,7 +6,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/coreos/etcd/mod/dashboard"
|
"github.com/coreos/etcd/mod/dashboard"
|
||||||
"github.com/coreos/etcd/mod/lock"
|
lock2 "github.com/coreos/etcd/mod/lock/v2"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,6 +23,6 @@ func HttpHandler(addr string) http.Handler {
|
|||||||
r.PathPrefix("/dashboard/").Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
|
r.PathPrefix("/dashboard/").Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
|
||||||
|
|
||||||
// TODO: Use correct addr.
|
// TODO: Use correct addr.
|
||||||
r.PathPrefix("/lock").Handler(http.StripPrefix("/lock", lock.NewHandler(addr)))
|
r.PathPrefix("/lock/v2").Handler(http.StripPrefix("/lock/v2", lock2.NewHandler(addr)))
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user