mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
adapter, integration: split out grpc adapters from grpcproxy package
Break cyclic dependency: clientv3/naming <-> integration <-> v3client <-> grpcproxy <-> clientv3/naming
This commit is contained in:
parent
76aa7f6935
commit
b025cdd097
@ -22,6 +22,7 @@ import (
|
|||||||
"github.com/coreos/etcd/clientv3"
|
"github.com/coreos/etcd/clientv3"
|
||||||
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
||||||
"github.com/coreos/etcd/proxy/grpcproxy"
|
"github.com/coreos/etcd/proxy/grpcproxy"
|
||||||
|
"github.com/coreos/etcd/proxy/grpcproxy/adapter"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -48,9 +49,9 @@ func toGRPC(c *clientv3.Client) grpcAPI {
|
|||||||
lp, lpch := grpcproxy.NewLeaseProxy(c)
|
lp, lpch := grpcproxy.NewLeaseProxy(c)
|
||||||
grpc := grpcAPI{
|
grpc := grpcAPI{
|
||||||
pb.NewClusterClient(c.ActiveConnection()),
|
pb.NewClusterClient(c.ActiveConnection()),
|
||||||
grpcproxy.KvServerToKvClient(kvp),
|
adapter.KvServerToKvClient(kvp),
|
||||||
grpcproxy.LeaseServerToLeaseClient(lp),
|
adapter.LeaseServerToLeaseClient(lp),
|
||||||
grpcproxy.WatchServerToWatchClient(wp),
|
adapter.WatchServerToWatchClient(wp),
|
||||||
pb.NewMaintenanceClient(c.ActiveConnection()),
|
pb.NewMaintenanceClient(c.ActiveConnection()),
|
||||||
pb.NewAuthClient(c.ActiveConnection()),
|
pb.NewAuthClient(c.ActiveConnection()),
|
||||||
}
|
}
|
||||||
|
@ -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 grpcproxy
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
17
proxy/grpcproxy/adapter/doc.go
Normal file
17
proxy/grpcproxy/adapter/doc.go
Normal 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
|
@ -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 grpcproxy
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
@ -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 grpcproxy
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
@ -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 grpcproxy
|
package adapter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -23,7 +23,7 @@ import (
|
|||||||
"google.golang.org/grpc/metadata"
|
"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 }
|
type ws2wc struct{ wserv pb.WatchServer }
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user