*: mv etcdhttp into api pkg

This commit is contained in:
Xiang Li 2016-04-04 16:31:35 -07:00
parent 19136afc2b
commit 2c50eb240e
20 changed files with 30 additions and 30 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ import (
) )
var ( 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 { type HTTPError struct {

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ import (
"github.com/coreos/etcd/auth" "github.com/coreos/etcd/auth"
"github.com/coreos/etcd/compactor" "github.com/coreos/etcd/compactor"
"github.com/coreos/etcd/discovery" "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" pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/etcdserver/stats" "github.com/coreos/etcd/etcdserver/stats"
"github.com/coreos/etcd/lease" "github.com/coreos/etcd/lease"

View File

@ -37,8 +37,8 @@ import (
"github.com/coreos/etcd/client" "github.com/coreos/etcd/client"
"github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/etcdserver" "github.com/coreos/etcd/etcdserver"
"github.com/coreos/etcd/etcdserver/api/v2http"
"github.com/coreos/etcd/etcdserver/api/v3rpc" "github.com/coreos/etcd/etcdserver/api/v3rpc"
"github.com/coreos/etcd/etcdserver/etcdhttp"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb" pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/pkg/testutil" "github.com/coreos/etcd/pkg/testutil"
"github.com/coreos/etcd/pkg/transport" "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.SyncTicker = time.Tick(500 * time.Millisecond)
m.s.Start() 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 { for _, ln := range m.PeerListeners {
hs := &httptest.Server{ hs := &httptest.Server{
@ -567,7 +567,7 @@ func (m *member) Launch() error {
for _, ln := range m.ClientListeners { for _, ln := range m.ClientListeners {
hs := &httptest.Server{ hs := &httptest.Server{
Listener: ln, 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 { if m.ClientTLSInfo == nil {
hs.Start() hs.Start()

View File

@ -28,7 +28,7 @@ import (
"time" "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/etcd/pkg/httputil"
"github.com/coreos/pkg/capnslog" "github.com/coreos/pkg/capnslog"
) )

2
test
View File

@ -18,7 +18,7 @@ source ./build
# Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt. # Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
PKGS=`ls pkg/*/*go | cut -f1,2 -d/ | sort | uniq` 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 # TODO: add it to race testing when the issue is resolved
# https://github.com/golang/go/issues/9946 # https://github.com/golang/go/issues/9946
NO_RACE_TESTABLE="rafthttp" NO_RACE_TESTABLE="rafthttp"