adapter, integration: split out grpc adapters from grpcproxy package

Break cyclic dependency:
clientv3/naming <-> integration <-> v3client <-> grpcproxy <-> clientv3/naming
This commit is contained in:
Anthony Romano 2017-03-09 20:39:47 -08:00
parent 76aa7f6935
commit b025cdd097
6 changed files with 26 additions and 8 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/coreos/etcd/clientv3"
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
"github.com/coreos/etcd/proxy/grpcproxy"
"github.com/coreos/etcd/proxy/grpcproxy/adapter"
)
var (
@ -48,9 +49,9 @@ func toGRPC(c *clientv3.Client) grpcAPI {
lp, lpch := grpcproxy.NewLeaseProxy(c)
grpc := grpcAPI{
pb.NewClusterClient(c.ActiveConnection()),
grpcproxy.KvServerToKvClient(kvp),
grpcproxy.LeaseServerToLeaseClient(lp),
grpcproxy.WatchServerToWatchClient(wp),
adapter.KvServerToKvClient(kvp),
adapter.LeaseServerToLeaseClient(lp),
adapter.WatchServerToWatchClient(wp),
pb.NewMaintenanceClient(c.ActiveConnection()),
pb.NewAuthClient(c.ActiveConnection()),
}

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package grpcproxy
package adapter
import (
"golang.org/x/net/context"

View File

@ -0,0 +1,17 @@
// Copyright 2017 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package adapter provides gRPC adapters between client and server
// gRPC interfaces without needing to go through a gRPC connection.
package adapter

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package grpcproxy
package adapter
import (
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package grpcproxy
package adapter
import (
"golang.org/x/net/context"

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package grpcproxy
package adapter
import (
"errors"
@ -23,7 +23,7 @@ import (
"google.golang.org/grpc/metadata"
)
var errAlreadySentHeader = errors.New("grpcproxy: already send header")
var errAlreadySentHeader = errors.New("adapter: already sent header")
type ws2wc struct{ wserv pb.WatchServer }