Przeglądaj źródła

*: mv etcdhttp into api pkg

Xiang Li 9 lat temu
rodzic
commit
2c50eb240e

+ 3 - 3
etcdmain/etcd.go

@@ -34,7 +34,7 @@ import (
 
 	"github.com/coreos/etcd/discovery"
 	"github.com/coreos/etcd/etcdserver"
-	"github.com/coreos/etcd/etcdserver/etcdhttp"
+	"github.com/coreos/etcd/etcdserver/api/v2http"
 	"github.com/coreos/etcd/pkg/cors"
 	"github.com/coreos/etcd/pkg/fileutil"
 	pkgioutil "github.com/coreos/etcd/pkg/ioutil"
@@ -363,10 +363,10 @@ func startEtcd(cfg *config) (<-chan struct{}, error) {
 		plog.Infof("cors = %s", cfg.corsInfo)
 	}
 	ch := http.Handler(&cors.CORSHandler{
-		Handler: etcdhttp.NewClientHandler(s, srvcfg.ReqTimeout()),
+		Handler: v2http.NewClientHandler(s, srvcfg.ReqTimeout()),
 		Info:    cfg.corsInfo,
 	})
-	ph := etcdhttp.NewPeerHandler(s)
+	ph := v2http.NewPeerHandler(s)
 
 	// Start the peer server in a goroutine
 	for _, l := range plns {

+ 2 - 2
etcdserver/etcdhttp/capability.go → etcdserver/api/v2http/capability.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"fmt"
@@ -21,7 +21,7 @@ import (
 	"time"
 
 	"github.com/coreos/etcd/etcdserver"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/go-semver/semver"
 )
 

+ 2 - 2
etcdserver/etcdhttp/client.go → etcdserver/api/v2http/client.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"encoding/json"
@@ -30,8 +30,8 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/etcdserver"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/etcdserver/auth"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
 	"github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/coreos/etcd/etcdserver/stats"
 	"github.com/coreos/etcd/pkg/types"

+ 2 - 2
etcdserver/etcdhttp/client_auth.go → etcdserver/api/v2http/client_auth.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"encoding/json"
@@ -21,8 +21,8 @@ import (
 	"strings"
 
 	"github.com/coreos/etcd/etcdserver"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/etcdserver/auth"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
 )
 
 type authHandler struct {

+ 1 - 1
etcdserver/etcdhttp/client_auth_test.go → etcdserver/api/v2http/client_auth_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"errors"

+ 2 - 2
etcdserver/etcdhttp/client_test.go → etcdserver/api/v2http/client_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"bytes"
@@ -30,7 +30,7 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/etcdserver"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/coreos/etcd/pkg/testutil"
 	"github.com/coreos/etcd/pkg/types"

+ 2 - 2
etcdserver/etcdhttp/doc.go → etcdserver/api/v2http/doc.go

@@ -12,5 +12,5 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-// Package etcdhttp provides etcd client and server implementations.
-package etcdhttp
+// Package v2http provides etcd client and server implementations.
+package v2http

+ 4 - 4
etcdserver/etcdhttp/http.go → etcdserver/api/v2http/http.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"errors"
@@ -23,8 +23,8 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/etcdserver"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/etcdserver/auth"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
 	"github.com/coreos/etcd/pkg/logutil"
 	"github.com/coreos/pkg/capnslog"
 )
@@ -35,9 +35,9 @@ const (
 )
 
 var (
-	plog      = capnslog.NewPackageLogger("github.com/coreos/etcd", "etcdhttp")
+	plog      = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver/api", "v2http")
 	mlog      = logutil.NewMergeLogger(plog)
-	errClosed = errors.New("etcdhttp: client closed connection")
+	errClosed = errors.New("v2http: client closed connection")
 )
 
 // writeError logs and writes the given Error to the ResponseWriter

+ 1 - 1
etcdserver/etcdhttp/http_test.go → etcdserver/api/v2http/http_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"errors"

+ 1 - 1
etcdserver/etcdhttp/httptypes/errors.go → etcdserver/api/v2http/httptypes/errors.go

@@ -22,7 +22,7 @@ import (
 )
 
 var (
-	plog = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver/etcdhttp", "httptypes")
+	plog = capnslog.NewPackageLogger("github.com/coreos/etcd/etcdserver/api/v2http", "httptypes")
 )
 
 type HTTPError struct {

+ 0 - 0
etcdserver/etcdhttp/httptypes/errors_test.go → etcdserver/api/v2http/httptypes/errors_test.go


+ 0 - 0
etcdserver/etcdhttp/httptypes/member.go → etcdserver/api/v2http/httptypes/member.go


+ 0 - 0
etcdserver/etcdhttp/httptypes/member_test.go → etcdserver/api/v2http/httptypes/member_test.go


+ 2 - 2
etcdserver/etcdhttp/metrics.go → etcdserver/api/v2http/metrics.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"strconv"
@@ -22,7 +22,7 @@ import (
 
 	etcdErr "github.com/coreos/etcd/error"
 	"github.com/coreos/etcd/etcdserver"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/prometheus/client_golang/prometheus"
 )

+ 1 - 1
etcdserver/etcdhttp/peer.go → etcdserver/api/v2http/peer.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"encoding/json"

+ 1 - 1
etcdserver/etcdhttp/peer_test.go → etcdserver/api/v2http/peer_test.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package etcdhttp
+package v2http
 
 import (
 	"encoding/json"

+ 1 - 1
etcdserver/server.go

@@ -31,7 +31,7 @@ import (
 	"github.com/coreos/etcd/auth"
 	"github.com/coreos/etcd/compactor"
 	"github.com/coreos/etcd/discovery"
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/coreos/etcd/etcdserver/stats"
 	"github.com/coreos/etcd/lease"

+ 3 - 3
integration/cluster.go

@@ -37,8 +37,8 @@ import (
 	"github.com/coreos/etcd/client"
 	"github.com/coreos/etcd/clientv3"
 	"github.com/coreos/etcd/etcdserver"
+	"github.com/coreos/etcd/etcdserver/api/v2http"
 	"github.com/coreos/etcd/etcdserver/api/v3rpc"
-	"github.com/coreos/etcd/etcdserver/etcdhttp"
 	pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/coreos/etcd/pkg/testutil"
 	"github.com/coreos/etcd/pkg/transport"
@@ -546,7 +546,7 @@ func (m *member) Launch() error {
 	m.s.SyncTicker = time.Tick(500 * time.Millisecond)
 	m.s.Start()
 
-	m.raftHandler = &testutil.PauseableHandler{Next: etcdhttp.NewPeerHandler(m.s)}
+	m.raftHandler = &testutil.PauseableHandler{Next: v2http.NewPeerHandler(m.s)}
 
 	for _, ln := range m.PeerListeners {
 		hs := &httptest.Server{
@@ -567,7 +567,7 @@ func (m *member) Launch() error {
 	for _, ln := range m.ClientListeners {
 		hs := &httptest.Server{
 			Listener: ln,
-			Config:   &http.Server{Handler: etcdhttp.NewClientHandler(m.s, m.ServerConfig.ReqTimeout())},
+			Config:   &http.Server{Handler: v2http.NewClientHandler(m.s, m.ServerConfig.ReqTimeout())},
 		}
 		if m.ClientTLSInfo == nil {
 			hs.Start()

+ 1 - 1
proxy/reverse.go

@@ -28,7 +28,7 @@ import (
 
 	"time"
 
-	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
+	"github.com/coreos/etcd/etcdserver/api/v2http/httptypes"
 	"github.com/coreos/etcd/pkg/httputil"
 	"github.com/coreos/pkg/capnslog"
 )

+ 1 - 1
test

@@ -18,7 +18,7 @@ source ./build
 
 # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
 PKGS=`ls pkg/*/*go  | cut -f1,2 -d/ | sort | uniq`
-TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/etcdhttp etcdserver/etcdhttp/httptypes $PKGS proxy raft snap storage storage/backend store version wal"
+TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/api/v2http etcdserver/api/v2http/httptypes $PKGS proxy raft snap storage storage/backend store version wal"
 # TODO: add it to race testing when the issue is resolved
 # https://github.com/golang/go/issues/9946
 NO_RACE_TESTABLE="rafthttp"