Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pkg imported more than once #2353

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions protocol/dubbo3/health/serverhealth.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ import (
import (
"dubbo.apache.org/dubbo-go/v3/config"
healthpb "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health/triple_health_v1"
healthtriple "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health/triple_health_v1"
)

// Server implements `service Health`.
type DubbogoHealthServer struct {
healthtriple.UnimplementedHealthServer
healthpb.UnimplementedHealthServer
mu sync.RWMutex
// If shutdown is true, it's expected all serving status is NOT_SERVING, and
// will stay in NOT_SERVING.
shutdown bool
// statusMap stores the serving status of the services this Server monitors.
statusMap map[string]healthpb.HealthCheckResponse_ServingStatus
updates map[string]map[healthtriple.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus
updates map[string]map[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus
}

var healthServer *DubbogoHealthServer
Expand All @@ -55,7 +54,7 @@ var healthServer *DubbogoHealthServer
func NewServer() *DubbogoHealthServer {
return &DubbogoHealthServer{
statusMap: map[string]healthpb.HealthCheckResponse_ServingStatus{"": healthpb.HealthCheckResponse_SERVING},
updates: make(map[string]map[healthtriple.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus),
updates: make(map[string]map[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus),
}
}

Expand All @@ -72,7 +71,7 @@ func (s *DubbogoHealthServer) Check(ctx context.Context, in *healthpb.HealthChec
}

// Watch implements `service Health`.
func (s *DubbogoHealthServer) Watch(in *healthpb.HealthCheckRequest, stream healthtriple.Health_WatchServer) error {
func (s *DubbogoHealthServer) Watch(in *healthpb.HealthCheckRequest, stream healthpb.Health_WatchServer) error {
service := in.Service
// update channel is used for getting service status updates.
update := make(chan healthpb.HealthCheckResponse_ServingStatus, 1)
Expand All @@ -86,7 +85,7 @@ func (s *DubbogoHealthServer) Watch(in *healthpb.HealthCheckRequest, stream heal

// Registers the update channel to the correct place in the updates map.
if _, ok := s.updates[service]; !ok {
s.updates[service] = make(map[healthtriple.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus)
s.updates[service] = make(map[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus)
}
s.updates[service][stream] = update
defer func() {
Expand Down
3 changes: 1 addition & 2 deletions xds/client/controller/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
)

import (
controllerversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version"
resourceversion "dubbo.apache.org/dubbo-go/v3/xds/client/controller/version"
"dubbo.apache.org/dubbo-go/v3/xds/client/load"
"dubbo.apache.org/dubbo-go/v3/xds/client/resource"
Expand Down Expand Up @@ -380,7 +379,7 @@ func (t *Controller) processAckInfo(ack *ackAction, stream grpc.ClientStream) (t

// reportLoad starts an LRS stream to report load data to the management server.
// It blocks until the context is canceled.
func (t *Controller) reportLoad(ctx context.Context, cc *grpc.ClientConn, opts controllerversion.LoadReportingOptions) {
func (t *Controller) reportLoad(ctx context.Context, cc *grpc.ClientConn, opts resourceversion.LoadReportingOptions) {
retries := 0
for {
if ctx.Err() != nil {
Expand Down
5 changes: 2 additions & 3 deletions xds/client/controller/version/v2/loadreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
import (
v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
v2endpointpb "github.com/envoyproxy/go-control-plane/envoy/api/v2/endpoint"
lrsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v2"
lrspb "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v2"

"github.com/golang/protobuf/proto"
Expand All @@ -50,10 +49,10 @@ import (

const clientFeatureLRSSendAllClusters = "envoy.lrs.supports_send_all_clusters"

type lrsStream lrsgrpc.LoadReportingService_StreamLoadStatsClient
type lrsStream lrspb.LoadReportingService_StreamLoadStatsClient

func (v2c *client) NewLoadStatsStream(ctx context.Context, cc *grpc.ClientConn) (grpc.ClientStream, error) {
c := lrsgrpc.NewLoadReportingServiceClient(cc)
c := lrspb.NewLoadReportingServiceClient(cc)
return c.StreamLoadStats(ctx)
}

Expand Down
5 changes: 2 additions & 3 deletions xds/client/controller/version/v3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
dubbogoLogger "github.com/dubbogo/gost/log/logger"

v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3adsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
v3discoverypb "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"

"github.com/golang/protobuf/proto"
Expand Down Expand Up @@ -78,7 +77,7 @@ func newClient(opts controllerversion.BuildOptions) (controllerversion.MetadataW
return v3c, nil
}

type adsStream v3adsgrpc.AggregatedDiscoveryService_StreamAggregatedResourcesClient
type adsStream v3discoverypb.AggregatedDiscoveryService_StreamAggregatedResourcesClient

// client performs the actual xDS RPCs using the xDS v3 API. It creates a
// single ADS stream on which the different types of xDS requests and responses
Expand All @@ -89,7 +88,7 @@ type client struct {
}

func (v3c *client) NewStream(ctx context.Context, cc *grpc.ClientConn) (grpc.ClientStream, error) {
return v3adsgrpc.NewAggregatedDiscoveryServiceClient(cc).StreamAggregatedResources(ctx, grpc.WaitForReady(true))
return v3discoverypb.NewAggregatedDiscoveryServiceClient(cc).StreamAggregatedResources(ctx, grpc.WaitForReady(true))
}

// SetMetadata update client metadata
Expand Down
5 changes: 2 additions & 3 deletions xds/client/controller/version/v3/loadreport.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import (
import (
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3endpointpb "github.com/envoyproxy/go-control-plane/envoy/config/endpoint/v3"
lrsgrpc "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3"
lrspb "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3"

"github.com/golang/protobuf/proto"
Expand All @@ -50,10 +49,10 @@ import (

const clientFeatureLRSSendAllClusters = "envoy.lrs.supports_send_all_clusters"

type lrsStream lrsgrpc.LoadReportingService_StreamLoadStatsClient
type lrsStream lrspb.LoadReportingService_StreamLoadStatsClient

func (v3c *client) NewLoadStatsStream(ctx context.Context, cc *grpc.ClientConn) (grpc.ClientStream, error) {
c := lrsgrpc.NewLoadReportingServiceClient(cc)
c := lrspb.NewLoadReportingServiceClient(cc)
return c.StreamLoadStats(ctx)
}

Expand Down
3 changes: 1 addition & 2 deletions xds/csds/csds.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
v3adminpb "github.com/envoyproxy/go-control-plane/envoy/admin/v3"
v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3statusgrpc "github.com/envoyproxy/go-control-plane/envoy/service/status/v3"
v3statuspb "github.com/envoyproxy/go-control-plane/envoy/service/status/v3"

"github.com/golang/protobuf/proto"
Expand Down Expand Up @@ -91,7 +90,7 @@ func NewClientStatusDiscoveryServer() (*ClientStatusDiscoveryServer, error) {
}

// StreamClientStatus implementations interface ClientStatusDiscoveryServiceServer.
func (s *ClientStatusDiscoveryServer) StreamClientStatus(stream v3statusgrpc.ClientStatusDiscoveryService_StreamClientStatusServer) error {
func (s *ClientStatusDiscoveryServer) StreamClientStatus(stream v3statuspb.ClientStatusDiscoveryService_StreamClientStatusServer) error {
for {
req, err := stream.Recv()
if err == io.EOF {
Expand Down