Browse Source

Add mod/lock version.

Ben Johnson 12 years ago
parent
commit
e76b7d1e8b

+ 1 - 1
mod/lock/acquire_handler.go → mod/lock/v2/acquire_handler.go

@@ -1,4 +1,4 @@
-package lock
+package v2
 
 import (
 	"net/http"

+ 1 - 1
mod/lock/get_index_handler.go → mod/lock/v2/get_index_handler.go

@@ -1,4 +1,4 @@
-package lock
+package v2
 
 import (
 	"net/http"

+ 1 - 1
mod/lock/handler.go → mod/lock/v2/handler.go

@@ -1,4 +1,4 @@
-package lock
+package v2
 
 import (
 	"net/http"

+ 1 - 1
mod/lock/release_handler.go → mod/lock/v2/release_handler.go

@@ -1,4 +1,4 @@
-package lock
+package v2
 
 import (
 	"path"

+ 1 - 1
mod/lock/renew_handler.go → mod/lock/v2/renew_handler.go

@@ -1,4 +1,4 @@
-package lock
+package v2
 
 import (
 	"path"

+ 4 - 4
mod/lock/tests/handler_test.go → mod/lock/v2/tests/handler_test.go

@@ -164,25 +164,25 @@ func TestModLockRenew(t *testing.T) {
 
 
 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)
 	return string(ret), err
 }
 
 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)
 	return string(ret), err
 }
 
 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)
 	return string(ret), err
 }
 
 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)
 	return string(ret), err
 }

+ 2 - 2
mod/mod.go

@@ -6,7 +6,7 @@ import (
 	"path"
 
 	"github.com/coreos/etcd/mod/dashboard"
-	"github.com/coreos/etcd/mod/lock"
+	lock2 "github.com/coreos/etcd/mod/lock/v2"
 	"github.com/gorilla/mux"
 )
 
@@ -23,6 +23,6 @@ func HttpHandler(addr string) http.Handler {
 	r.PathPrefix("/dashboard/").Handler(http.StripPrefix("/dashboard/", dashboard.HttpHandler()))
 
 	// 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
 }

+ 1 - 1
test.sh

@@ -2,7 +2,7 @@
 set -e
 
 if [ -z "$PKG" ]; then
-    PKG="./store ./server ./server/v2/tests ./mod/lock/tests"
+    PKG="./store ./server ./server/v2/tests ./mod/lock/v2/tests"
 fi
 
 # Get GOPATH, etc from build