feat: Adapt config.load (#2531)
* Adapt config.load
* resolve circular dependencies
* add license
* add comment
* modify comment
* modify comment
* fix key
* modify comment
diff --git a/common/constant/key.go b/common/constant/key.go
index 8a32c50..e3dfa87 100644
--- a/common/constant/key.go
+++ b/common/constant/key.go
@@ -389,13 +389,13 @@
// reflection service
const (
- ReflectionServiceTypeName = "DubbogoServerReflectionServer"
+ ReflectionServiceTypeName = "ReflectionServer"
ReflectionServiceInterface = "grpc.reflection.v1alpha.ServerReflection"
)
// healthcheck service
const (
- HealthCheckServiceTypeName = "DubbogoHealthServer"
+ HealthCheckServiceTypeName = "HealthCheckServer"
HealthCheckServiceInterface = "grpc.health.v1.Health"
)
diff --git a/config/invoker_compat.go b/config/invoker_compat.go
new file mode 100644
index 0000000..585a4e7
--- /dev/null
+++ b/config/invoker_compat.go
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 config
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common"
+ "dubbo.apache.org/dubbo-go/v3/protocol"
+)
+
+// NewInfoInvoker is used to resolve circular dependencies temporarily.
+// source: server/compat.go func compatNewInfoInvoker(url *common.URL, info interface{}, svc common.RPCService) protocol.Invoker
+var NewInfoInvoker func(url *common.URL, info interface{}, svc common.RPCService) protocol.Invoker
diff --git a/config/provider_config.go b/config/provider_config.go
index 6788930..3a99e9f 100644
--- a/config/provider_config.go
+++ b/config/provider_config.go
@@ -28,6 +28,8 @@
"github.com/dubbogo/gost/log/logger"
perrors "github.com/pkg/errors"
+
+ tripleConstant "github.com/dubbogo/triple/pkg/common/constant"
)
import (
@@ -121,33 +123,33 @@
serviceConfig.adaptiveService = c.AdaptiveService
}
- //for k, v := range rc.Protocols {
- // if v.Name == tripleConstant.TRIPLE {
- // // Auto create grpc based health check service.
- // healthService := NewServiceConfigBuilder().
- // SetProtocolIDs(k).
- // SetNotRegister(true).
- // SetInterface(constant.HealthCheckServiceInterface).
- // Build()
- // if err := healthService.Init(rc); err != nil {
- // return err
- // }
- // c.Services[constant.HealthCheckServiceTypeName] = healthService
- //
- // // Auto create reflection service configure only when provider with triple service is configured.
- // tripleReflectionService := NewServiceConfigBuilder().
- // SetProtocolIDs(k).
- // SetNotRegister(true).
- // SetInterface(constant.ReflectionServiceInterface).
- // Build()
- // if err := tripleReflectionService.Init(rc); err != nil {
- // return err
- // }
- // // Maybe only register once, If setting this service, break from traversing Protocols.
- // c.Services[constant.ReflectionServiceTypeName] = tripleReflectionService
- // break
- // }
- //}
+ for k, v := range rc.Protocols {
+ if v.Name == tripleConstant.TRIPLE {
+ // Auto create grpc based health check service.
+ healthService := NewServiceConfigBuilder().
+ SetProtocolIDs(k).
+ SetNotRegister(true).
+ SetInterface(constant.HealthCheckServiceInterface).
+ Build()
+ if err := healthService.Init(rc); err != nil {
+ return err
+ }
+ c.Services[constant.HealthCheckServiceTypeName] = healthService
+
+ // Auto create reflection service configure only when provider with triple service is configured.
+ tripleReflectionService := NewServiceConfigBuilder().
+ SetProtocolIDs(k).
+ SetNotRegister(true).
+ SetInterface(constant.ReflectionServiceInterface).
+ Build()
+ if err := tripleReflectionService.Init(rc); err != nil {
+ return err
+ }
+ // Maybe only register once, If setting this service, break from traversing Protocols.
+ c.Services[constant.ReflectionServiceTypeName] = tripleReflectionService
+ break
+ }
+ }
if err := c.check(); err != nil {
return err
diff --git a/config/service.go b/config/service.go
index 513048a..2068016 100644
--- a/config/service.go
+++ b/config/service.go
@@ -32,8 +32,9 @@
var (
conServicesLock = sync.Mutex{} // used to guard conServices map.
conServices = map[string]common.RPCService{} // service name -> service
- proServicesLock = sync.Mutex{} // used to guard proServices map
+ proServicesLock = sync.Mutex{} // used to guard proServices map and proServicesInfo map
proServices = map[string]common.RPCService{} // service name -> service
+ proServicesInfo = map[string]interface{}{} // service name -> service info
interfaceNameConServicesLock = sync.Mutex{} // used to guard interfaceNameConServices map
interfaceNameConServices = map[string]common.RPCService{} // interfaceName -> service
)
@@ -49,7 +50,7 @@
conServices[ref] = service
}
-// SetProviderService is called by init() of implement of RPCService
+// SetProviderService is called by init() of implementation of RPCService
func SetProviderService(service common.RPCService) {
ref := common.GetReference(service)
proServicesLock.Lock()
@@ -60,6 +61,18 @@
proServices[ref] = service
}
+// SetProviderServiceWithInfo is called by init() of implementation of RPCService
+func SetProviderServiceWithInfo(service common.RPCService, info interface{}) {
+ ref := common.GetReference(service)
+ proServicesLock.Lock()
+ defer func() {
+ proServicesLock.Unlock()
+ logger.Debugf("A provider service %s was registered successfully.", ref)
+ }()
+ proServices[ref] = service
+ proServicesInfo[ref] = info
+}
+
// GetConsumerService gets ConsumerService by @name
func GetConsumerService(name string) common.RPCService {
conServicesLock.Lock()
@@ -79,6 +92,12 @@
return proServices
}
+func GetProviderServiceInfo(name string) interface{} {
+ proServicesLock.Lock()
+ defer proServicesLock.Unlock()
+ return proServicesInfo[name]
+}
+
// GetConsumerServiceMap gets ProviderServiceMap
func GetConsumerServiceMap() map[string]common.RPCService {
return conServices
diff --git a/config/service_config.go b/config/service_config.go
index 461546b..e54e119 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -257,9 +257,10 @@
return nil
}
+ var invoker protocol.Invoker
ports := getRandomPort(protocolConfigs)
nextPort := ports.Front()
- proxyFactory := extension.GetProxyFactory(s.ProxyFactoryKey)
+
for _, proto := range protocolConfigs {
// registry the service reflect
methods, err := common.ServiceMap.Register(s.Interface, proto.Name, s.Group, s.Version, s.rpcService)
@@ -290,6 +291,11 @@
common.WithParamsValue(constant.MaxServerSendMsgSize, proto.MaxServerSendMsgSize),
common.WithParamsValue(constant.MaxServerRecvMsgSize, proto.MaxServerRecvMsgSize),
)
+ info := GetProviderServiceInfo(s.id)
+ if info != nil {
+ ivkURL.SetAttribute(constant.ServiceInfoKey, info)
+ }
+
if len(s.Tag) > 0 {
ivkURL.AddParam(constant.Tagkey, s.Tag)
}
@@ -311,7 +317,9 @@
for _, regUrl := range regUrls {
setRegistrySubURL(ivkURL, regUrl)
- invoker := proxyFactory.GetInvoker(regUrl)
+
+ invoker = s.generatorInvoker(regUrl, info)
+
exporter := s.cacheProtocol.Export(invoker)
if exporter == nil {
return perrors.New(fmt.Sprintf("Registry protocol new exporter error, registry is {%v}, url is {%v}", regUrl, ivkURL))
@@ -329,7 +337,7 @@
logger.Warnf("SetMetadataServiceURL error = %s", err)
}
}
- invoker := proxyFactory.GetInvoker(ivkURL)
+ s.generatorInvoker(ivkURL, info)
exporter := extension.GetProtocol(protocolwrapper.FILTER).Export(invoker)
if exporter == nil {
return perrors.New(fmt.Sprintf("Filter protocol without registry new exporter error, url is {%v}", ivkURL))
@@ -342,6 +350,14 @@
return nil
}
+func (s *ServiceConfig) generatorInvoker(regUrl *common.URL, info interface{}) protocol.Invoker {
+ proxyFactory := extension.GetProxyFactory(s.ProxyFactoryKey)
+ if info == nil {
+ return proxyFactory.GetInvoker(regUrl)
+ }
+ return NewInfoInvoker(regUrl, info, s.rpcService)
+}
+
// setRegistrySubURL set registry sub url is ivkURl
func setRegistrySubURL(ivkURL *common.URL, regUrl *common.URL) {
ivkURL.AddParam(constant.RegistryKey, regUrl.GetParam(constant.RegistryKey, ""))
diff --git a/protocol/dubbo3/health/serverhealth.go b/protocol/dubbo3/health/serverhealth.go
deleted file mode 100644
index 31e6afb..0000000
--- a/protocol/dubbo3/health/serverhealth.go
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 health provides a service that exposes server's health and it must be
-// imported to enable support for client-side health checks.
-package health
-
-import (
- "context"
- "sync"
-)
-
-import (
- "github.com/dubbogo/gost/log/logger"
-
- "github.com/dubbogo/grpc-go/codes"
- "github.com/dubbogo/grpc-go/status"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- healthpb "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/health/triple_health_v1"
-)
-
-// Server implements `service Health`.
-type DubbogoHealthServer struct {
- 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[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus
-}
-
-var healthServer *DubbogoHealthServer
-
-// NewServer returns a new Server.
-func NewServer() *DubbogoHealthServer {
- return &DubbogoHealthServer{
- statusMap: map[string]healthpb.HealthCheckResponse_ServingStatus{"": healthpb.HealthCheckResponse_SERVING},
- updates: make(map[string]map[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus),
- }
-}
-
-// Check implements `service Health`.
-func (s *DubbogoHealthServer) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) {
- s.mu.RLock()
- defer s.mu.RUnlock()
- if servingStatus, ok := s.statusMap[in.Service]; ok {
- return &healthpb.HealthCheckResponse{
- Status: servingStatus,
- }, nil
- }
- return nil, status.Error(codes.NotFound, "unknown service")
-}
-
-// Watch implements `service Health`.
-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)
- s.mu.Lock()
- // Puts the initial status to the channel.
- if servingStatus, ok := s.statusMap[service]; ok {
- update <- servingStatus
- } else {
- update <- healthpb.HealthCheckResponse_SERVICE_UNKNOWN
- }
-
- // Registers the update channel to the correct place in the updates map.
- if _, ok := s.updates[service]; !ok {
- s.updates[service] = make(map[healthpb.Health_WatchServer]chan healthpb.HealthCheckResponse_ServingStatus)
- }
- s.updates[service][stream] = update
- defer func() {
- s.mu.Lock()
- delete(s.updates[service], stream)
- s.mu.Unlock()
- }()
- s.mu.Unlock()
-
- var lastSentStatus healthpb.HealthCheckResponse_ServingStatus = -1
- for {
- select {
- // Status updated. Sends the up-to-date status to the client.
- case servingStatus := <-update:
- if lastSentStatus == servingStatus {
- continue
- }
- lastSentStatus = servingStatus
- err := stream.Send(&healthpb.HealthCheckResponse{Status: servingStatus})
- if err != nil {
- return status.Error(codes.Canceled, "Stream has ended.")
- }
- // Context done. Removes the update channel from the updates map.
- case <-stream.Context().Done():
- return status.Error(codes.Canceled, "Stream has ended.")
- }
- }
-}
-
-// SetServingStatus is called when need to reset the serving status of a service
-// or insert a new service entry into the statusMap.
-func (s *DubbogoHealthServer) SetServingStatus(service string, servingStatus healthpb.HealthCheckResponse_ServingStatus) {
- s.mu.Lock()
- defer s.mu.Unlock()
- if s.shutdown {
- logger.Infof("health: status changing for %s to %v is ignored because health service is shutdown", service, servingStatus)
- return
- }
-
- s.setServingStatusLocked(service, servingStatus)
-}
-
-func (s *DubbogoHealthServer) setServingStatusLocked(service string, servingStatus healthpb.HealthCheckResponse_ServingStatus) {
- s.statusMap[service] = servingStatus
- for _, update := range s.updates[service] {
- // Clears previous updates, that are not sent to the client, from the channel.
- // This can happen if the client is not reading and the server gets flow control limited.
- select {
- case <-update:
- default:
- }
- // Puts the most recent update to the channel.
- update <- servingStatus
- }
-}
-
-// Shutdown sets all serving status to NOT_SERVING, and configures the server to
-// ignore all future status changes.
-//
-// This changes serving status for all services. To set status for a particular
-// services, call SetServingStatus().
-func (s *DubbogoHealthServer) Shutdown() {
- s.mu.Lock()
- defer s.mu.Unlock()
- s.shutdown = true
- for service := range s.statusMap {
- s.setServingStatusLocked(service, healthpb.HealthCheckResponse_NOT_SERVING)
- }
-}
-
-// Resume sets all serving status to SERVING, and configures the server to
-// accept all future status changes.
-//
-// This changes serving status for all services. To set status for a particular
-// services, call SetServingStatus().
-func (s *DubbogoHealthServer) Resume() {
- s.mu.Lock()
- defer s.mu.Unlock()
- s.shutdown = false
- for service := range s.statusMap {
- s.setServingStatusLocked(service, healthpb.HealthCheckResponse_SERVING)
- }
-}
-
-// Set health check interface.
-func init() {
- healthServer = NewServer()
- config.SetProviderService(healthServer)
-}
-
-func SetServingStatusServing(service string) {
- healthServer.SetServingStatus(service, healthpb.HealthCheckResponse_SERVING)
-}
-
-func SetServingStatusNotServing(service string) {
- healthServer.SetServingStatus(service, healthpb.HealthCheckResponse_NOT_SERVING)
-}
diff --git a/protocol/dubbo3/health/triple_health_v1/health.pb.go b/protocol/dubbo3/health/triple_health_v1/health.pb.go
deleted file mode 100644
index 5eaa416..0000000
--- a/protocol/dubbo3/health/triple_health_v1/health.pb.go
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// The canonical version of this proto can be found at
-// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.30.0
-// protoc v3.21.12
-// source: health.proto
-
-package triple_health_v1
-
-import (
- reflect "reflect"
- sync "sync"
-)
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type HealthCheckResponse_ServingStatus int32
-
-const (
- HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0
- HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1
- HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2
- HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 // Used only by the Watch method.
-)
-
-// Enum value maps for HealthCheckResponse_ServingStatus.
-var (
- HealthCheckResponse_ServingStatus_name = map[int32]string{
- 0: "UNKNOWN",
- 1: "SERVING",
- 2: "NOT_SERVING",
- 3: "SERVICE_UNKNOWN",
- }
- HealthCheckResponse_ServingStatus_value = map[string]int32{
- "UNKNOWN": 0,
- "SERVING": 1,
- "NOT_SERVING": 2,
- "SERVICE_UNKNOWN": 3,
- }
-)
-
-func (x HealthCheckResponse_ServingStatus) Enum() *HealthCheckResponse_ServingStatus {
- p := new(HealthCheckResponse_ServingStatus)
- *p = x
- return p
-}
-
-func (x HealthCheckResponse_ServingStatus) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (HealthCheckResponse_ServingStatus) Descriptor() protoreflect.EnumDescriptor {
- return file_health_proto_enumTypes[0].Descriptor()
-}
-
-func (HealthCheckResponse_ServingStatus) Type() protoreflect.EnumType {
- return &file_health_proto_enumTypes[0]
-}
-
-func (x HealthCheckResponse_ServingStatus) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead.
-func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) {
- return file_health_proto_rawDescGZIP(), []int{1, 0}
-}
-
-type HealthCheckRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
-}
-
-func (x *HealthCheckRequest) Reset() {
- *x = HealthCheckRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_health_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *HealthCheckRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*HealthCheckRequest) ProtoMessage() {}
-
-func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
- mi := &file_health_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
-func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
- return file_health_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *HealthCheckRequest) GetService() string {
- if x != nil {
- return x.Service
- }
- return ""
-}
-
-type HealthCheckResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=dubbogo.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
-}
-
-func (x *HealthCheckResponse) Reset() {
- *x = HealthCheckResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_health_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *HealthCheckResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*HealthCheckResponse) ProtoMessage() {}
-
-func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
- mi := &file_health_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
-func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
- return file_health_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus {
- if x != nil {
- return x.Status
- }
- return HealthCheckResponse_UNKNOWN
-}
-
-var File_health_proto protoreflect.FileDescriptor
-
-var file_health_proto_rawDesc = []byte{
- 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11,
- 0x64, 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76,
- 0x31, 0x22, 0x2e, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69,
- 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
- 0x65, 0x22, 0xb4, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63,
- 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x06, 0x73, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x64, 0x75, 0x62, 0x62,
- 0x6f, 0x67, 0x6f, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65,
- 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52,
- 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69,
- 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e,
- 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47,
- 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e,
- 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55,
- 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x32, 0xba, 0x01, 0x0a, 0x06, 0x48, 0x65, 0x61,
- 0x6c, 0x74, 0x68, 0x12, 0x56, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x25, 0x2e, 0x64,
- 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31,
- 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2e, 0x68, 0x65,
- 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68,
- 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x57,
- 0x61, 0x74, 0x63, 0x68, 0x12, 0x25, 0x2e, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2e, 0x68,
- 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43,
- 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x64, 0x75,
- 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e,
- 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
- 0x63, 0x6f, 0x6d, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x70, 0x63,
- 0x2d, 0x67, 0x6f, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2f, 0x74, 0x72, 0x69, 0x70, 0x6c,
- 0x65, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x33,
-}
-
-var (
- file_health_proto_rawDescOnce sync.Once
- file_health_proto_rawDescData = file_health_proto_rawDesc
-)
-
-func file_health_proto_rawDescGZIP() []byte {
- file_health_proto_rawDescOnce.Do(func() {
- file_health_proto_rawDescData = protoimpl.X.CompressGZIP(file_health_proto_rawDescData)
- })
- return file_health_proto_rawDescData
-}
-
-var file_health_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_health_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
-var file_health_proto_goTypes = []interface{}{
- (HealthCheckResponse_ServingStatus)(0), // 0: dubbogo.health.v1.HealthCheckResponse.ServingStatus
- (*HealthCheckRequest)(nil), // 1: dubbogo.health.v1.HealthCheckRequest
- (*HealthCheckResponse)(nil), // 2: dubbogo.health.v1.HealthCheckResponse
-}
-var file_health_proto_depIdxs = []int32{
- 0, // 0: dubbogo.health.v1.HealthCheckResponse.status:type_name -> dubbogo.health.v1.HealthCheckResponse.ServingStatus
- 1, // 1: dubbogo.health.v1.Health.Check:input_type -> dubbogo.health.v1.HealthCheckRequest
- 1, // 2: dubbogo.health.v1.Health.Watch:input_type -> dubbogo.health.v1.HealthCheckRequest
- 2, // 3: dubbogo.health.v1.Health.Check:output_type -> dubbogo.health.v1.HealthCheckResponse
- 2, // 4: dubbogo.health.v1.Health.Watch:output_type -> dubbogo.health.v1.HealthCheckResponse
- 3, // [3:5] is the sub-list for method output_type
- 1, // [1:3] is the sub-list for method input_type
- 1, // [1:1] is the sub-list for extension type_name
- 1, // [1:1] is the sub-list for extension extendee
- 0, // [0:1] is the sub-list for field type_name
-}
-
-func init() { file_health_proto_init() }
-func file_health_proto_init() {
- if File_health_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_health_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*HealthCheckRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_health_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*HealthCheckResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_health_proto_rawDesc,
- NumEnums: 1,
- NumMessages: 2,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_health_proto_goTypes,
- DependencyIndexes: file_health_proto_depIdxs,
- EnumInfos: file_health_proto_enumTypes,
- MessageInfos: file_health_proto_msgTypes,
- }.Build()
- File_health_proto = out.File
- file_health_proto_rawDesc = nil
- file_health_proto_goTypes = nil
- file_health_proto_depIdxs = nil
-}
diff --git a/protocol/dubbo3/health/triple_health_v1/health.proto b/protocol/dubbo3/health/triple_health_v1/health.proto
deleted file mode 100644
index b636b80..0000000
--- a/protocol/dubbo3/health/triple_health_v1/health.proto
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// The canonical version of this proto can be found at
-// https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
-
-syntax = "proto3";
-
-package dubbogo.health.v1;
-
-option go_package = "github.com/dubbogo/grpc-go/health/triple_health_v1";
-
-message HealthCheckRequest {
- string service = 1;
-}
-
-message HealthCheckResponse {
- enum ServingStatus {
- UNKNOWN = 0;
- SERVING = 1;
- NOT_SERVING = 2;
- SERVICE_UNKNOWN = 3; // Used only by the Watch method.
- }
- ServingStatus status = 1;
-}
-
-service Health {
- // If the requested service is unknown, the call will fail with status
- // NOT_FOUND.
- rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
-
- // Performs a watch for the serving status of the requested service.
- // The server will immediately send back a message indicating the current
- // serving status. It will then subsequently send a new message whenever
- // the service's serving status changes.
- //
- // If the requested service is unknown when the call is received, the
- // server will send a message setting the serving status to
- // SERVICE_UNKNOWN but will *not* terminate the call. If at some
- // future point, the serving status of the service becomes known, the
- // server will send a new message with the service's serving status.
- //
- // If the call terminates with status UNIMPLEMENTED, then clients
- // should assume this method is not supported and should not retry the
- // call. If the call terminates with any other status (including OK),
- // clients should retry the call with appropriate exponential backoff.
- rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
-}
\ No newline at end of file
diff --git a/protocol/dubbo3/health/triple_health_v1/health_triple.pb.go b/protocol/dubbo3/health/triple_health_v1/health_triple.pb.go
deleted file mode 100644
index d177190..0000000
--- a/protocol/dubbo3/health/triple_health_v1/health_triple.pb.go
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// Code generated by protoc-gen-go-triple. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-triple v1.0.8
-// - protoc v3.21.12
-// source: health.proto
-
-package triple_health_v1
-
-import (
- context "context"
- fmt "fmt"
-)
-
-import (
- grpc_go "github.com/dubbogo/grpc-go"
- codes "github.com/dubbogo/grpc-go/codes"
- metadata "github.com/dubbogo/grpc-go/metadata"
- status "github.com/dubbogo/grpc-go/status"
-
- common "github.com/dubbogo/triple/pkg/common"
- constant "github.com/dubbogo/triple/pkg/common/constant"
- triple "github.com/dubbogo/triple/pkg/triple"
-)
-
-import (
- constant1 "dubbo.apache.org/dubbo-go/v3/common/constant"
- protocol "dubbo.apache.org/dubbo-go/v3/protocol"
- dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
- invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc_go.SupportPackageIsVersion7
-
-// HealthClient is the client API for Health service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type HealthClient interface {
- // If the requested service is unknown, the call will fail with status
- // NOT_FOUND.
- Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc_go.CallOption) (*HealthCheckResponse, common.ErrorWithAttachment)
- // Performs a watch for the serving status of the requested service.
- // The server will immediately send back a message indicating the current
- // serving status. It will then subsequently send a new message whenever
- // the service's serving status changes.
- //
- // If the requested service is unknown when the call is received, the
- // server will send a message setting the serving status to
- // SERVICE_UNKNOWN but will *not* terminate the call. If at some
- // future point, the serving status of the service becomes known, the
- // server will send a new message with the service's serving status.
- //
- // If the call terminates with status UNIMPLEMENTED, then clients
- // should assume this method is not supported and should not retry the
- // call. If the call terminates with any other status (including OK),
- // clients should retry the call with appropriate exponential backoff.
- Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc_go.CallOption) (Health_WatchClient, error)
-}
-
-type healthClient struct {
- cc *triple.TripleConn
-}
-
-type HealthClientImpl struct {
- Check func(ctx context.Context, in *HealthCheckRequest) (*HealthCheckResponse, error)
- Watch func(ctx context.Context, in *HealthCheckRequest) (Health_WatchClient, error)
-}
-
-func (c *HealthClientImpl) GetDubboStub(cc *triple.TripleConn) HealthClient {
- return NewHealthClient(cc)
-}
-
-func (c *HealthClientImpl) XXX_InterfaceName() string {
- return "dubbogo.health.v1.Health"
-}
-
-func NewHealthClient(cc *triple.TripleConn) HealthClient {
- return &healthClient{cc}
-}
-
-func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc_go.CallOption) (*HealthCheckResponse, common.ErrorWithAttachment) {
- out := new(HealthCheckResponse)
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/Check", in, out)
-}
-
-func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc_go.CallOption) (Health_WatchClient, error) {
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- stream, err := c.cc.NewStream(ctx, "/"+interfaceKey+"/Watch", opts...)
- if err != nil {
- return nil, err
- }
- x := &healthWatchClient{stream}
- if err := x.ClientStream.SendMsg(in); err != nil {
- return nil, err
- }
- if err := x.ClientStream.CloseSend(); err != nil {
- return nil, err
- }
- return x, nil
-}
-
-type Health_WatchClient interface {
- Recv() (*HealthCheckResponse, error)
- grpc_go.ClientStream
-}
-
-type healthWatchClient struct {
- grpc_go.ClientStream
-}
-
-func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) {
- m := new(HealthCheckResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// HealthServer is the server API for Health service.
-// All implementations must embed UnimplementedHealthServer
-// for forward compatibility
-type HealthServer interface {
- // If the requested service is unknown, the call will fail with status
- // NOT_FOUND.
- Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
- // Performs a watch for the serving status of the requested service.
- // The server will immediately send back a message indicating the current
- // serving status. It will then subsequently send a new message whenever
- // the service's serving status changes.
- //
- // If the requested service is unknown when the call is received, the
- // server will send a message setting the serving status to
- // SERVICE_UNKNOWN but will *not* terminate the call. If at some
- // future point, the serving status of the service becomes known, the
- // server will send a new message with the service's serving status.
- //
- // If the call terminates with status UNIMPLEMENTED, then clients
- // should assume this method is not supported and should not retry the
- // call. If the call terminates with any other status (including OK),
- // clients should retry the call with appropriate exponential backoff.
- Watch(*HealthCheckRequest, Health_WatchServer) error
- mustEmbedUnimplementedHealthServer()
-}
-
-// UnimplementedHealthServer must be embedded to have forward compatible implementations.
-type UnimplementedHealthServer struct {
- proxyImpl protocol.Invoker
-}
-
-func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
-}
-func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error {
- return status.Errorf(codes.Unimplemented, "method Watch not implemented")
-}
-func (s *UnimplementedHealthServer) XXX_SetProxyImpl(impl protocol.Invoker) {
- s.proxyImpl = impl
-}
-
-func (s *UnimplementedHealthServer) XXX_GetProxyImpl() protocol.Invoker {
- return s.proxyImpl
-}
-
-func (s *UnimplementedHealthServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
- return &Health_ServiceDesc
-}
-func (s *UnimplementedHealthServer) XXX_InterfaceName() string {
- return "dubbogo.health.v1.Health"
-}
-
-func (UnimplementedHealthServer) mustEmbedUnimplementedHealthServer() {}
-
-// UnsafeHealthServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to HealthServer will
-// result in compilation errors.
-type UnsafeHealthServer interface {
- mustEmbedUnimplementedHealthServer()
-}
-
-func RegisterHealthServer(s grpc_go.ServiceRegistrar, srv HealthServer) {
- s.RegisterService(&Health_ServiceDesc, srv)
-}
-
-func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
- in := new(HealthCheckRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- base := srv.(dubbo3.Dubbo3GrpcService)
- args := []interface{}{}
- args = append(args, in)
- md, _ := metadata.FromIncomingContext(ctx)
- invAttachment := make(map[string]interface{}, len(md))
- for k, v := range md {
- invAttachment[k] = v
- }
- invo := invocation.NewRPCInvocation("Check", args, invAttachment)
- if interceptor == nil {
- result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
- return result, result.Error()
- }
- info := &grpc_go.UnaryServerInfo{
- Server: srv,
- FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
- return result, result.Error()
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Health_Watch_Handler(srv interface{}, stream grpc_go.ServerStream) error {
- _, ok := srv.(dubbo3.Dubbo3GrpcService)
- ctx := stream.Context()
- md, _ := metadata.FromIncomingContext(ctx)
- invAttachment := make(map[string]interface{}, len(md))
- for k, v := range md {
- invAttachment[k] = v
- }
- stream.(grpc_go.CtxSetterStream).SetContext(context.WithValue(ctx, constant1.AttachmentKey, invAttachment))
- invo := invocation.NewRPCInvocation("Watch", nil, nil)
- if !ok {
- fmt.Println(invo)
- return nil
- }
- m := new(HealthCheckRequest)
- if err := stream.RecvMsg(m); err != nil {
- return err
- }
- return srv.(HealthServer).Watch(m, &healthWatchServer{stream})
-}
-
-type Health_WatchServer interface {
- Send(*HealthCheckResponse) error
- grpc_go.ServerStream
-}
-
-type healthWatchServer struct {
- grpc_go.ServerStream
-}
-
-func (x *healthWatchServer) Send(m *HealthCheckResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-// Health_ServiceDesc is the grpc_go.ServiceDesc for Health service.
-// It's only intended for direct use with grpc_go.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var Health_ServiceDesc = grpc_go.ServiceDesc{
- ServiceName: "dubbogo.health.v1.Health",
- HandlerType: (*HealthServer)(nil),
- Methods: []grpc_go.MethodDesc{
- {
- MethodName: "Check",
- Handler: _Health_Check_Handler,
- },
- },
- Streams: []grpc_go.StreamDesc{
- {
- StreamName: "Watch",
- Handler: _Health_Watch_Handler,
- ServerStreams: true,
- },
- },
- Metadata: "health.proto",
-}
diff --git a/protocol/dubbo3/reflection/serverreflection.go b/protocol/dubbo3/reflection/serverreflection.go
deleted file mode 100644
index 4d0ff1d..0000000
--- a/protocol/dubbo3/reflection/serverreflection.go
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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 reflection implements server reflection service.
-
-The service implemented is defined in:
-https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto.
-*/
-package reflection
-
-import (
- "bytes"
- "compress/gzip"
- "fmt"
- "io"
- "io/ioutil"
- "reflect"
- "sort"
- "strings"
- "sync"
-)
-
-import (
- "github.com/dubbogo/grpc-go"
- "github.com/dubbogo/grpc-go/codes"
- "github.com/dubbogo/grpc-go/status"
-
- "github.com/golang/protobuf/proto"
- dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
-)
-
-import (
- "dubbo.apache.org/dubbo-go/v3/config"
- rpb "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3/reflection/triple_reflection_v1alpha"
-)
-
-// GRPCServer is the interface provided by a gRPC server. It is implemented by
-// *grpc.Server, but could also be implemented by other concrete types. It acts
-// as a registry, for accumulating the services exposed by the server.
-type GRPCServer interface {
- grpc.ServiceRegistrar
- GetServiceInfo() map[string]grpc.ServiceInfo
-}
-
-var _ GRPCServer = (*grpc.Server)(nil)
-
-type DubbogoServerReflectionServer struct {
- rpb.UnimplementedServerReflectionServer
- s GRPCServer
-
- initSymbols sync.Once
- serviceNames []string
- symbols map[string]*dpb.FileDescriptorProto // map of fully-qualified names to files
-}
-
-func (r *DubbogoServerReflectionServer) SetGRPCServer(s *grpc.Server) {
- r.s = s
-}
-
-// protoMessage is used for type assertion on proto messages.
-// Generated proto message implements function Descriptor(), but Descriptor()
-// is not part of interface proto.Message. This interface is needed to
-// call Descriptor().
-type protoMessage interface {
- Descriptor() ([]byte, []int)
-}
-
-func (s *DubbogoServerReflectionServer) getSymbols() (svcNames []string, symbolIndex map[string]*dpb.FileDescriptorProto) {
- s.initSymbols.Do(func() {
- serviceInfo := s.s.GetServiceInfo()
-
- s.symbols = map[string]*dpb.FileDescriptorProto{}
- s.serviceNames = make([]string, 0, len(serviceInfo))
- processed := map[string]struct{}{}
- for svc, info := range serviceInfo {
- s.serviceNames = append(s.serviceNames, svc)
- fdenc, ok := parseMetadata(info.Metadata)
- if !ok {
- continue
- }
- fd, err := decodeFileDesc(fdenc)
- if err != nil {
- continue
- }
- s.processFile(fd, processed)
- }
- sort.Strings(s.serviceNames)
- })
-
- return s.serviceNames, s.symbols
-}
-
-func (s *DubbogoServerReflectionServer) processFile(fd *dpb.FileDescriptorProto, processed map[string]struct{}) {
- filename := fd.GetName()
- if _, ok := processed[filename]; ok {
- return
- }
- processed[filename] = struct{}{}
-
- prefix := fd.GetPackage()
-
- for _, msg := range fd.MessageType {
- s.processMessage(fd, prefix, msg)
- }
- for _, en := range fd.EnumType {
- s.processEnum(fd, prefix, en)
- }
- for _, ext := range fd.Extension {
- s.processField(fd, prefix, ext)
- }
- for _, svc := range fd.Service {
- svcName := fqn(prefix, svc.GetName())
- s.symbols[svcName] = fd
- for _, meth := range svc.Method {
- name := fqn(svcName, meth.GetName())
- s.symbols[name] = fd
- }
- }
-
- for _, dep := range fd.Dependency {
- fdenc := proto.FileDescriptor(dep)
- fdDep, err := decodeFileDesc(fdenc)
- if err != nil {
- continue
- }
- s.processFile(fdDep, processed)
- }
-}
-
-func (s *DubbogoServerReflectionServer) processMessage(fd *dpb.FileDescriptorProto, prefix string, msg *dpb.DescriptorProto) {
- msgName := fqn(prefix, msg.GetName())
- s.symbols[msgName] = fd
-
- for _, nested := range msg.NestedType {
- s.processMessage(fd, msgName, nested)
- }
- for _, en := range msg.EnumType {
- s.processEnum(fd, msgName, en)
- }
- for _, ext := range msg.Extension {
- s.processField(fd, msgName, ext)
- }
- for _, fld := range msg.Field {
- s.processField(fd, msgName, fld)
- }
- for _, oneof := range msg.OneofDecl {
- oneofName := fqn(msgName, oneof.GetName())
- s.symbols[oneofName] = fd
- }
-}
-
-func (s *DubbogoServerReflectionServer) processEnum(fd *dpb.FileDescriptorProto, prefix string, en *dpb.EnumDescriptorProto) {
- enName := fqn(prefix, en.GetName())
- s.symbols[enName] = fd
-
- for _, val := range en.Value {
- valName := fqn(enName, val.GetName())
- s.symbols[valName] = fd
- }
-}
-
-func (s *DubbogoServerReflectionServer) processField(fd *dpb.FileDescriptorProto, prefix string, fld *dpb.FieldDescriptorProto) {
- fldName := fqn(prefix, fld.GetName())
- s.symbols[fldName] = fd
-}
-
-func fqn(prefix, name string) string {
- if prefix == "" {
- return name
- }
- return prefix + "." + name
-}
-
-// fileDescForType gets the file descriptor for the given type.
-// The given type should be a proto message.
-func (s *DubbogoServerReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) {
- m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(protoMessage)
- if !ok {
- return nil, fmt.Errorf("failed to create message from type: %v", st)
- }
- enc, _ := m.Descriptor()
-
- return decodeFileDesc(enc)
-}
-
-// decodeFileDesc does decompression and unmarshaling on the given
-// file descriptor byte slice.
-func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
- raw, err := decompress(enc)
- if err != nil {
- return nil, fmt.Errorf("failed to decompress enc: %v", err)
- }
-
- fd := new(dpb.FileDescriptorProto)
- if err := proto.Unmarshal(raw, fd); err != nil {
- return nil, fmt.Errorf("bad descriptor: %v", err)
- }
- return fd, nil
-}
-
-// decompress does gzip decompression.
-func decompress(b []byte) ([]byte, error) {
- r, err := gzip.NewReader(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
- }
- out, err := ioutil.ReadAll(r)
- if err != nil {
- return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
- }
- return out, nil
-}
-
-func typeForName(name string) (reflect.Type, error) {
- pt := proto.MessageType(name)
- if pt == nil {
- return nil, fmt.Errorf("unknown type: %q", name)
- }
- st := pt.Elem()
-
- return st, nil
-}
-
-func fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) {
- m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message)
- if !ok {
- return nil, fmt.Errorf("failed to create message from type: %v", st)
- }
-
- var extDesc *proto.ExtensionDesc
- for id, desc := range proto.RegisteredExtensions(m) {
- if id == ext {
- extDesc = desc
- break
- }
- }
-
- if extDesc == nil {
- return nil, fmt.Errorf("failed to find registered extension for extension number %v", ext)
- }
-
- return decodeFileDesc(proto.FileDescriptor(extDesc.Filename))
-}
-
-func (s *DubbogoServerReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) {
- m, ok := reflect.Zero(reflect.PtrTo(st)).Interface().(proto.Message)
- if !ok {
- return nil, fmt.Errorf("failed to create message from type: %v", st)
- }
-
- exts := proto.RegisteredExtensions(m)
- out := make([]int32, 0, len(exts))
- for id := range exts {
- out = append(out, id)
- }
- return out, nil
-}
-
-// fileDescWithDependencies returns a slice of serialized fileDescriptors in
-// wire format ([]byte). The fileDescriptors will include fd and all the
-// transitive dependencies of fd with names not in sentFileDescriptors.
-func fileDescWithDependencies(fd *dpb.FileDescriptorProto, sentFileDescriptors map[string]bool) ([][]byte, error) {
- r := [][]byte{}
- queue := []*dpb.FileDescriptorProto{fd}
- for len(queue) > 0 {
- currentfd := queue[0]
- queue = queue[1:]
- if sent := sentFileDescriptors[currentfd.GetName()]; len(r) == 0 || !sent {
- sentFileDescriptors[currentfd.GetName()] = true
- currentfdEncoded, err := proto.Marshal(currentfd)
- if err != nil {
- return nil, err
- }
- r = append(r, currentfdEncoded)
- }
- for _, dep := range currentfd.Dependency {
- fdenc := proto.FileDescriptor(dep)
- fdDep, err := decodeFileDesc(fdenc)
- if err != nil {
- continue
- }
- queue = append(queue, fdDep)
- }
- }
- return r, nil
-}
-
-// fileDescEncodingByFilename finds the file descriptor for given filename,
-// finds all of its previously unsent transitive dependencies, does marshaling
-// on them, and returns the marshaled result.
-func (s *DubbogoServerReflectionServer) fileDescEncodingByFilename(name string, sentFileDescriptors map[string]bool) ([][]byte, error) {
- enc := proto.FileDescriptor(name)
- if enc == nil {
- return nil, fmt.Errorf("unknown file: %v", name)
- }
- fd, err := decodeFileDesc(enc)
- if err != nil {
- return nil, err
- }
- return fileDescWithDependencies(fd, sentFileDescriptors)
-}
-
-// parseMetadata finds the file descriptor bytes specified meta.
-// For SupportPackageIsVersion4, m is the name of the proto file, we
-// call proto.FileDescriptor to get the byte slice.
-// For SupportPackageIsVersion3, m is a byte slice itself.
-func parseMetadata(meta interface{}) ([]byte, bool) {
- // Check if meta is the file name.
- if fileNameForMeta, ok := meta.(string); ok {
- return proto.FileDescriptor(fileNameForMeta), true
- }
-
- // Check if meta is the byte slice.
- if enc, ok := meta.([]byte); ok {
- return enc, true
- }
-
- return nil, false
-}
-
-// fileDescEncodingContainingSymbol finds the file descriptor containing the
-// given symbol, finds all of its previously unsent transitive dependencies,
-// does marshaling on them, and returns the marshaled result. The given symbol
-// can be a type, a service or a method.
-func (s *DubbogoServerReflectionServer) fileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error) {
- _, symbols := s.getSymbols()
- //
- if strings.HasPrefix(name, "grpc.") {
- name = "triple." + strings.TrimPrefix(name, "grpc.")
- }
-
- fd := symbols[name]
- if fd == nil {
- // Check if it's a type name that was not present in the
- // transitive dependencies of the registered services.
- if st, err := typeForName(name); err == nil {
- fd, err = s.fileDescForType(st)
- if err != nil {
- return nil, err
- }
- }
- }
-
- if fd == nil {
- return nil, fmt.Errorf("unknown symbol: %v", name)
- }
-
- return fileDescWithDependencies(fd, sentFileDescriptors)
-}
-
-// fileDescEncodingContainingExtension finds the file descriptor containing
-// given extension, finds all of its previously unsent transitive dependencies,
-// does marshaling on them, and returns the marshaled result.
-func (s *DubbogoServerReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error) {
- st, err := typeForName(typeName)
- if err != nil {
- return nil, err
- }
- fd, err := fileDescContainingExtension(st, extNum)
- if err != nil {
- return nil, err
- }
- return fileDescWithDependencies(fd, sentFileDescriptors)
-}
-
-// allExtensionNumbersForTypeName returns all extension numbers for the given type.
-func (s *DubbogoServerReflectionServer) allExtensionNumbersForTypeName(name string) ([]int32, error) {
- st, err := typeForName(name)
- if err != nil {
- return nil, err
- }
- extNums, err := s.allExtensionNumbersForType(st)
- if err != nil {
- return nil, err
- }
- return extNums, nil
-}
-
-// ServerReflectionInfo is the reflection service handler.
-func (s *DubbogoServerReflectionServer) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error {
- sentFileDescriptors := make(map[string]bool)
- for {
- in, err := stream.Recv()
- if err == io.EOF {
- return nil
- }
- if err != nil {
- return err
- }
-
- out := &rpb.ServerReflectionResponse{
- ValidHost: in.Host,
- OriginalRequest: in,
- }
- switch req := in.MessageRequest.(type) {
- case *rpb.ServerReflectionRequest_FileByFilename:
- b, err := s.fileDescEncodingByFilename(req.FileByFilename, sentFileDescriptors)
- if err != nil {
- out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{
- ErrorResponse: &rpb.ErrorResponse{
- ErrorCode: int32(codes.NotFound),
- ErrorMessage: err.Error(),
- },
- }
- } else {
- out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{
- FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: b},
- }
- }
- case *rpb.ServerReflectionRequest_FileContainingSymbol:
- b, err := s.fileDescEncodingContainingSymbol(req.FileContainingSymbol, sentFileDescriptors)
- if err != nil {
- out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{
- ErrorResponse: &rpb.ErrorResponse{
- ErrorCode: int32(codes.NotFound),
- ErrorMessage: err.Error(),
- },
- }
- } else {
- out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{
- FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: b},
- }
- }
- case *rpb.ServerReflectionRequest_FileContainingExtension:
- typeName := req.FileContainingExtension.ContainingType
- extNum := req.FileContainingExtension.ExtensionNumber
- b, err := s.fileDescEncodingContainingExtension(typeName, extNum, sentFileDescriptors)
- if err != nil {
- out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{
- ErrorResponse: &rpb.ErrorResponse{
- ErrorCode: int32(codes.NotFound),
- ErrorMessage: err.Error(),
- },
- }
- } else {
- out.MessageResponse = &rpb.ServerReflectionResponse_FileDescriptorResponse{
- FileDescriptorResponse: &rpb.FileDescriptorResponse{FileDescriptorProto: b},
- }
- }
- case *rpb.ServerReflectionRequest_AllExtensionNumbersOfType:
- extNums, err := s.allExtensionNumbersForTypeName(req.AllExtensionNumbersOfType)
- if err != nil {
- out.MessageResponse = &rpb.ServerReflectionResponse_ErrorResponse{
- ErrorResponse: &rpb.ErrorResponse{
- ErrorCode: int32(codes.NotFound),
- ErrorMessage: err.Error(),
- },
- }
- } else {
- out.MessageResponse = &rpb.ServerReflectionResponse_AllExtensionNumbersResponse{
- AllExtensionNumbersResponse: &rpb.ExtensionNumberResponse{
- BaseTypeName: req.AllExtensionNumbersOfType,
- ExtensionNumber: extNums,
- },
- }
- }
- case *rpb.ServerReflectionRequest_ListServices:
- svcNames, _ := s.getSymbols()
- serviceResponses := make([]*rpb.ServiceResponse, len(svcNames))
- for i, n := range svcNames {
- serviceResponses[i] = &rpb.ServiceResponse{
- Name: n,
- }
- }
- out.MessageResponse = &rpb.ServerReflectionResponse_ListServicesResponse{
- ListServicesResponse: &rpb.ListServiceResponse{
- Service: serviceResponses,
- },
- }
- default:
- return status.Errorf(codes.InvalidArgument, "invalid MessageRequest: %v", in.MessageRequest)
- }
-
- if err := stream.Send(out); err != nil {
- return err
- }
- }
-}
-func init() {
- config.SetProviderService(&DubbogoServerReflectionServer{})
-}
diff --git a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.pb.go b/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.pb.go
deleted file mode 100644
index 7ad0663..0000000
--- a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.pb.go
+++ /dev/null
@@ -1,954 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// Service exported by server reflection
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.26.0
-// protoc v3.14.0
-// source: reflection.proto
-
-package triple_reflection_v1alpha
-
-import (
- reflect "reflect"
- sync "sync"
-)
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// The message sent by the client when calling ServerReflectionInfo method.
-type ServerReflectionRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
- // To use reflection service, the client should set one of the following
- // fields in message_request. The server distinguishes requests by their
- // defined field and then handles them using corresponding methods.
- //
- // Types that are assignable to MessageRequest:
- // *ServerReflectionRequest_FileByFilename
- // *ServerReflectionRequest_FileContainingSymbol
- // *ServerReflectionRequest_FileContainingExtension
- // *ServerReflectionRequest_AllExtensionNumbersOfType
- // *ServerReflectionRequest_ListServices
- MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"`
-}
-
-func (x *ServerReflectionRequest) Reset() {
- *x = ServerReflectionRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ServerReflectionRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ServerReflectionRequest) ProtoMessage() {}
-
-func (x *ServerReflectionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ServerReflectionRequest.ProtoReflect.Descriptor instead.
-func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *ServerReflectionRequest) GetHost() string {
- if x != nil {
- return x.Host
- }
- return ""
-}
-
-func (m *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest {
- if m != nil {
- return m.MessageRequest
- }
- return nil
-}
-
-func (x *ServerReflectionRequest) GetFileByFilename() string {
- if x, ok := x.GetMessageRequest().(*ServerReflectionRequest_FileByFilename); ok {
- return x.FileByFilename
- }
- return ""
-}
-
-func (x *ServerReflectionRequest) GetFileContainingSymbol() string {
- if x, ok := x.GetMessageRequest().(*ServerReflectionRequest_FileContainingSymbol); ok {
- return x.FileContainingSymbol
- }
- return ""
-}
-
-func (x *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest {
- if x, ok := x.GetMessageRequest().(*ServerReflectionRequest_FileContainingExtension); ok {
- return x.FileContainingExtension
- }
- return nil
-}
-
-func (x *ServerReflectionRequest) GetAllExtensionNumbersOfType() string {
- if x, ok := x.GetMessageRequest().(*ServerReflectionRequest_AllExtensionNumbersOfType); ok {
- return x.AllExtensionNumbersOfType
- }
- return ""
-}
-
-func (x *ServerReflectionRequest) GetListServices() string {
- if x, ok := x.GetMessageRequest().(*ServerReflectionRequest_ListServices); ok {
- return x.ListServices
- }
- return ""
-}
-
-type isServerReflectionRequest_MessageRequest interface {
- isServerReflectionRequest_MessageRequest()
-}
-
-type ServerReflectionRequest_FileByFilename struct {
- // Find a proto file by the file name.
- FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"`
-}
-
-type ServerReflectionRequest_FileContainingSymbol struct {
- // Find the proto file that declares the given fully-qualified symbol name.
- // This field should be a fully-qualified symbol name
- // (e.g. <package>.<service>[.<method>] or <package>.<type>).
- FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"`
-}
-
-type ServerReflectionRequest_FileContainingExtension struct {
- // Find the proto file which defines an extension extending the given
- // message type with the given field number.
- FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"`
-}
-
-type ServerReflectionRequest_AllExtensionNumbersOfType struct {
- // Finds the tag numbers used by all known extensions of extendee_type, and
- // appends them to ExtensionNumberResponse in an undefined order.
- // Its corresponding method is best-effort: it's not guaranteed that the
- // reflection service will implement this method, and it's not guaranteed
- // that this method will provide all extensions. Returns
- // StatusCode::UNIMPLEMENTED if it's not implemented.
- // This field should be a fully-qualified type name. The format is
- // <package>.<type>
- AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"`
-}
-
-type ServerReflectionRequest_ListServices struct {
- // List the full names of registered services. The content will not be
- // checked.
- ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"`
-}
-
-func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {}
-
-func (*ServerReflectionRequest_FileContainingSymbol) isServerReflectionRequest_MessageRequest() {}
-
-func (*ServerReflectionRequest_FileContainingExtension) isServerReflectionRequest_MessageRequest() {}
-
-func (*ServerReflectionRequest_AllExtensionNumbersOfType) isServerReflectionRequest_MessageRequest() {
-}
-
-func (*ServerReflectionRequest_ListServices) isServerReflectionRequest_MessageRequest() {}
-
-// The type name and extension number sent by the client when requesting
-// file_containing_extension.
-type ExtensionRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Fully-qualified type name. The format should be <package>.<type>
- ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"`
- ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"`
-}
-
-func (x *ExtensionRequest) Reset() {
- *x = ExtensionRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ExtensionRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ExtensionRequest) ProtoMessage() {}
-
-func (x *ExtensionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ExtensionRequest.ProtoReflect.Descriptor instead.
-func (*ExtensionRequest) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *ExtensionRequest) GetContainingType() string {
- if x != nil {
- return x.ContainingType
- }
- return ""
-}
-
-func (x *ExtensionRequest) GetExtensionNumber() int32 {
- if x != nil {
- return x.ExtensionNumber
- }
- return 0
-}
-
-// The message sent by the server to answer ServerReflectionInfo method.
-type ServerReflectionResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"`
- OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"`
- // The server sets one of the following fields according to the
- // message_request in the request.
- //
- // Types that are assignable to MessageResponse:
- // *ServerReflectionResponse_FileDescriptorResponse
- // *ServerReflectionResponse_AllExtensionNumbersResponse
- // *ServerReflectionResponse_ListServicesResponse
- // *ServerReflectionResponse_ErrorResponse
- MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"`
-}
-
-func (x *ServerReflectionResponse) Reset() {
- *x = ServerReflectionResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ServerReflectionResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ServerReflectionResponse) ProtoMessage() {}
-
-func (x *ServerReflectionResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ServerReflectionResponse.ProtoReflect.Descriptor instead.
-func (*ServerReflectionResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *ServerReflectionResponse) GetValidHost() string {
- if x != nil {
- return x.ValidHost
- }
- return ""
-}
-
-func (x *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest {
- if x != nil {
- return x.OriginalRequest
- }
- return nil
-}
-
-func (m *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse {
- if m != nil {
- return m.MessageResponse
- }
- return nil
-}
-
-func (x *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse {
- if x, ok := x.GetMessageResponse().(*ServerReflectionResponse_FileDescriptorResponse); ok {
- return x.FileDescriptorResponse
- }
- return nil
-}
-
-func (x *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse {
- if x, ok := x.GetMessageResponse().(*ServerReflectionResponse_AllExtensionNumbersResponse); ok {
- return x.AllExtensionNumbersResponse
- }
- return nil
-}
-
-func (x *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse {
- if x, ok := x.GetMessageResponse().(*ServerReflectionResponse_ListServicesResponse); ok {
- return x.ListServicesResponse
- }
- return nil
-}
-
-func (x *ServerReflectionResponse) GetErrorResponse() *ErrorResponse {
- if x, ok := x.GetMessageResponse().(*ServerReflectionResponse_ErrorResponse); ok {
- return x.ErrorResponse
- }
- return nil
-}
-
-type isServerReflectionResponse_MessageResponse interface {
- isServerReflectionResponse_MessageResponse()
-}
-
-type ServerReflectionResponse_FileDescriptorResponse struct {
- // This message is used to answer file_by_filename, file_containing_symbol,
- // file_containing_extension requests with transitive dependencies.
- // As the repeated label is not allowed in oneof fields, we use a
- // FileDescriptorResponse message to encapsulate the repeated fields.
- // The reflection service is allowed to avoid sending FileDescriptorProtos
- // that were previously sent in response to earlier requests in the stream.
- FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"`
-}
-
-type ServerReflectionResponse_AllExtensionNumbersResponse struct {
- // This message is used to answer all_extension_numbers_of_type requests.
- AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"`
-}
-
-type ServerReflectionResponse_ListServicesResponse struct {
- // This message is used to answer list_services requests.
- ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"`
-}
-
-type ServerReflectionResponse_ErrorResponse struct {
- // This message is used when an error occurs.
- ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"`
-}
-
-func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() {
-}
-
-func (*ServerReflectionResponse_AllExtensionNumbersResponse) isServerReflectionResponse_MessageResponse() {
-}
-
-func (*ServerReflectionResponse_ListServicesResponse) isServerReflectionResponse_MessageResponse() {}
-
-func (*ServerReflectionResponse_ErrorResponse) isServerReflectionResponse_MessageResponse() {}
-
-// Serialized FileDescriptorProto messages sent by the server answering
-// a file_by_filename, file_containing_symbol, or file_containing_extension
-// request.
-type FileDescriptorResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Serialized FileDescriptorProto messages. We avoid taking a dependency on
- // descriptor.proto, which uses proto2 only features, by making them opaque
- // bytes instead.
- FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"`
-}
-
-func (x *FileDescriptorResponse) Reset() {
- *x = FileDescriptorResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *FileDescriptorResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*FileDescriptorResponse) ProtoMessage() {}
-
-func (x *FileDescriptorResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use FileDescriptorResponse.ProtoReflect.Descriptor instead.
-func (*FileDescriptorResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *FileDescriptorResponse) GetFileDescriptorProto() [][]byte {
- if x != nil {
- return x.FileDescriptorProto
- }
- return nil
-}
-
-// A list of extension numbers sent by the server answering
-// all_extension_numbers_of_type request.
-type ExtensionNumberResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Full name of the base type, including the package name. The format
- // is <package>.<type>
- BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"`
- ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"`
-}
-
-func (x *ExtensionNumberResponse) Reset() {
- *x = ExtensionNumberResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ExtensionNumberResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ExtensionNumberResponse) ProtoMessage() {}
-
-func (x *ExtensionNumberResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ExtensionNumberResponse.ProtoReflect.Descriptor instead.
-func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *ExtensionNumberResponse) GetBaseTypeName() string {
- if x != nil {
- return x.BaseTypeName
- }
- return ""
-}
-
-func (x *ExtensionNumberResponse) GetExtensionNumber() []int32 {
- if x != nil {
- return x.ExtensionNumber
- }
- return nil
-}
-
-// A list of ServiceResponse sent by the server answering list_services request.
-type ListServiceResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // The information of each service may be expanded in the future, so we use
- // ServiceResponse message to encapsulate it.
- Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"`
-}
-
-func (x *ListServiceResponse) Reset() {
- *x = ListServiceResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ListServiceResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ListServiceResponse) ProtoMessage() {}
-
-func (x *ListServiceResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ListServiceResponse.ProtoReflect.Descriptor instead.
-func (*ListServiceResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *ListServiceResponse) GetService() []*ServiceResponse {
- if x != nil {
- return x.Service
- }
- return nil
-}
-
-// The information of a single service used by ListServiceResponse to answer
-// list_services request.
-type ServiceResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Full name of a registered service, including its package name. The format
- // is <package>.<service>
- Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-}
-
-func (x *ServiceResponse) Reset() {
- *x = ServiceResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ServiceResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ServiceResponse) ProtoMessage() {}
-
-func (x *ServiceResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead.
-func (*ServiceResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *ServiceResponse) GetName() string {
- if x != nil {
- return x.Name
- }
- return ""
-}
-
-// The error code and error message sent by the server when an error occurs.
-type ErrorResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // This field uses the error codes defined in grpc::StatusCode.
- ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
- ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
-}
-
-func (x *ErrorResponse) Reset() {
- *x = ErrorResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_reflection_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *ErrorResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*ErrorResponse) ProtoMessage() {}
-
-func (x *ErrorResponse) ProtoReflect() protoreflect.Message {
- mi := &file_reflection_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.
-func (*ErrorResponse) Descriptor() ([]byte, []int) {
- return file_reflection_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *ErrorResponse) GetErrorCode() int32 {
- if x != nil {
- return x.ErrorCode
- }
- return 0
-}
-
-func (x *ErrorResponse) GetErrorMessage() string {
- if x != nil {
- return x.ErrorMessage
- }
- return ""
-}
-
-var File_reflection_proto protoreflect.FileDescriptor
-
-var file_reflection_proto_rawDesc = []byte{
- 0x0a, 0x10, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x12, 0x19, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x22, 0xfa, 0x02,
- 0x0a, 0x17, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69,
- 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73,
- 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x2a, 0x0a,
- 0x10, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x62, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
- 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x42,
- 0x79, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x69, 0x6c,
- 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x79, 0x6d,
- 0x62, 0x6f, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x14, 0x66, 0x69, 0x6c,
- 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x53, 0x79, 0x6d, 0x62, 0x6f,
- 0x6c, 0x12, 0x69, 0x0a, 0x19, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69,
- 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x05,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x72, 0x65,
- 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
- 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x48, 0x00, 0x52, 0x17, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
- 0x69, 0x6e, 0x67, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x1d,
- 0x61, 0x6c, 0x6c, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75,
- 0x6d, 0x62, 0x65, 0x72, 0x73, 0x5f, 0x6f, 0x66, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20,
- 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x19, 0x61, 0x6c, 0x6c, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73,
- 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x4f, 0x66, 0x54, 0x79, 0x70, 0x65,
- 0x12, 0x25, 0x0a, 0x0d, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0c, 0x6c, 0x69, 0x73, 0x74, 0x53,
- 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x42, 0x11, 0x0a, 0x0f, 0x6d, 0x65, 0x73, 0x73, 0x61,
- 0x67, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x10, 0x45, 0x78,
- 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27,
- 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x74, 0x79, 0x70,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
- 0x69, 0x6e, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e,
- 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
- 0x05, 0x52, 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62,
- 0x65, 0x72, 0x22, 0xd1, 0x04, 0x0a, 0x18, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66,
- 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
- 0x1d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x5d,
- 0x0a, 0x10, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c,
- 0x65, 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61,
- 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66, 0x6c, 0x65,
- 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0f, 0x6f, 0x72,
- 0x69, 0x67, 0x69, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x6d, 0x0a,
- 0x18, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72,
- 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32,
- 0x31, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74,
- 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x46, 0x69, 0x6c, 0x65,
- 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x48, 0x00, 0x52, 0x16, 0x66, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x79, 0x0a, 0x1e,
- 0x61, 0x6c, 0x6c, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x75,
- 0x6d, 0x62, 0x65, 0x72, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x72, 0x65,
- 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
- 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x1b, 0x61, 0x6c, 0x6c, 0x45,
- 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x16, 0x6c, 0x69, 0x73, 0x74, 0x5f,
- 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65,
- 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c,
- 0x70, 0x68, 0x61, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x14, 0x6c, 0x69, 0x73, 0x74, 0x53,
- 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
- 0x51, 0x0a, 0x0e, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65,
- 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c,
- 0x70, 0x68, 0x61, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x48, 0x00, 0x52, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x42, 0x12, 0x0a, 0x10, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x72, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4c, 0x0a, 0x16, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65,
- 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x12, 0x32, 0x0a, 0x15, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
- 0x74, 0x6f, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52,
- 0x13, 0x66, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x50,
- 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6a, 0x0a, 0x17, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f,
- 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
- 0x24, 0x0a, 0x0e, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x54, 0x79, 0x70,
- 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69,
- 0x6f, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52,
- 0x0f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
- 0x22, 0x5b, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69,
- 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c,
- 0x65, 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61,
- 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x25, 0x0a,
- 0x0f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x53, 0x0a, 0x0d, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63,
- 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72,
- 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65,
- 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72,
- 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x98, 0x01, 0x0a, 0x10, 0x53, 0x65,
- 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x83,
- 0x01, 0x0a, 0x14, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74,
- 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x32, 0x2e, 0x74, 0x72, 0x69, 0x70, 0x6c, 0x65,
- 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x61, 0x6c,
- 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x66, 0x6c, 0x65, 0x63,
- 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x74, 0x72,
- 0x69, 0x70, 0x6c, 0x65, 0x2e, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
- 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
- 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x28, 0x01, 0x30, 0x01, 0x42, 0x41, 0x5a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
- 0x6f, 0x6d, 0x2f, 0x64, 0x75, 0x62, 0x62, 0x6f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2d,
- 0x67, 0x6f, 0x2f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x74, 0x72,
- 0x69, 0x70, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
- 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_reflection_proto_rawDescOnce sync.Once
- file_reflection_proto_rawDescData = file_reflection_proto_rawDesc
-)
-
-func file_reflection_proto_rawDescGZIP() []byte {
- file_reflection_proto_rawDescOnce.Do(func() {
- file_reflection_proto_rawDescData = protoimpl.X.CompressGZIP(file_reflection_proto_rawDescData)
- })
- return file_reflection_proto_rawDescData
-}
-
-var file_reflection_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
-var file_reflection_proto_goTypes = []interface{}{
- (*ServerReflectionRequest)(nil), // 0: triple.reflection.v1alpha.ServerReflectionRequest
- (*ExtensionRequest)(nil), // 1: triple.reflection.v1alpha.ExtensionRequest
- (*ServerReflectionResponse)(nil), // 2: triple.reflection.v1alpha.ServerReflectionResponse
- (*FileDescriptorResponse)(nil), // 3: triple.reflection.v1alpha.FileDescriptorResponse
- (*ExtensionNumberResponse)(nil), // 4: triple.reflection.v1alpha.ExtensionNumberResponse
- (*ListServiceResponse)(nil), // 5: triple.reflection.v1alpha.ListServiceResponse
- (*ServiceResponse)(nil), // 6: triple.reflection.v1alpha.ServiceResponse
- (*ErrorResponse)(nil), // 7: triple.reflection.v1alpha.ErrorResponse
-}
-var file_reflection_proto_depIdxs = []int32{
- 1, // 0: triple.reflection.v1alpha.ServerReflectionRequest.file_containing_extension:type_name -> triple.reflection.v1alpha.ExtensionRequest
- 0, // 1: triple.reflection.v1alpha.ServerReflectionResponse.original_request:type_name -> triple.reflection.v1alpha.ServerReflectionRequest
- 3, // 2: triple.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response:type_name -> triple.reflection.v1alpha.FileDescriptorResponse
- 4, // 3: triple.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response:type_name -> triple.reflection.v1alpha.ExtensionNumberResponse
- 5, // 4: triple.reflection.v1alpha.ServerReflectionResponse.list_services_response:type_name -> triple.reflection.v1alpha.ListServiceResponse
- 7, // 5: triple.reflection.v1alpha.ServerReflectionResponse.error_response:type_name -> triple.reflection.v1alpha.ErrorResponse
- 6, // 6: triple.reflection.v1alpha.ListServiceResponse.service:type_name -> triple.reflection.v1alpha.ServiceResponse
- 0, // 7: triple.reflection.v1alpha.ServerReflection.ServerReflectionInfo:input_type -> triple.reflection.v1alpha.ServerReflectionRequest
- 2, // 8: triple.reflection.v1alpha.ServerReflection.ServerReflectionInfo:output_type -> triple.reflection.v1alpha.ServerReflectionResponse
- 8, // [8:9] is the sub-list for method output_type
- 7, // [7:8] is the sub-list for method input_type
- 7, // [7:7] is the sub-list for extension type_name
- 7, // [7:7] is the sub-list for extension extendee
- 0, // [0:7] is the sub-list for field type_name
-}
-
-func init() { file_reflection_proto_init() }
-func file_reflection_proto_init() {
- if File_reflection_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_reflection_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ServerReflectionRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ExtensionRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ServerReflectionResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*FileDescriptorResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ExtensionNumberResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ListServiceResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ServiceResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_reflection_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ErrorResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- file_reflection_proto_msgTypes[0].OneofWrappers = []interface{}{
- (*ServerReflectionRequest_FileByFilename)(nil),
- (*ServerReflectionRequest_FileContainingSymbol)(nil),
- (*ServerReflectionRequest_FileContainingExtension)(nil),
- (*ServerReflectionRequest_AllExtensionNumbersOfType)(nil),
- (*ServerReflectionRequest_ListServices)(nil),
- }
- file_reflection_proto_msgTypes[2].OneofWrappers = []interface{}{
- (*ServerReflectionResponse_FileDescriptorResponse)(nil),
- (*ServerReflectionResponse_AllExtensionNumbersResponse)(nil),
- (*ServerReflectionResponse_ListServicesResponse)(nil),
- (*ServerReflectionResponse_ErrorResponse)(nil),
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_reflection_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 8,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_reflection_proto_goTypes,
- DependencyIndexes: file_reflection_proto_depIdxs,
- MessageInfos: file_reflection_proto_msgTypes,
- }.Build()
- File_reflection_proto = out.File
- file_reflection_proto_rawDesc = nil
- file_reflection_proto_goTypes = nil
- file_reflection_proto_depIdxs = nil
-}
diff --git a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.proto b/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.proto
deleted file mode 100644
index c96efeb..0000000
--- a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection.proto
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// Service exported by server reflection
-
-syntax = "proto3";
-
-option go_package = "github.com/dubbogo/grpc-go/reflection/triple_reflection_v1alpha";
-
-package triple.reflection.v1alpha;
-
-service ServerReflection {
- // The reflection service is structured as a bidirectional stream, ensuring
- // all related requests go to a single server.
- rpc ServerReflectionInfo(stream ServerReflectionRequest)
- returns (stream ServerReflectionResponse);
-}
-
-// The message sent by the client when calling ServerReflectionInfo method.
-message ServerReflectionRequest {
- string host = 1;
- // To use reflection service, the client should set one of the following
- // fields in message_request. The server distinguishes requests by their
- // defined field and then handles them using corresponding methods.
- oneof message_request {
- // Find a proto file by the file name.
- string file_by_filename = 3;
-
- // Find the proto file that declares the given fully-qualified symbol name.
- // This field should be a fully-qualified symbol name
- // (e.g. <package>.<service>[.<method>] or <package>.<type>).
- string file_containing_symbol = 4;
-
- // Find the proto file which defines an extension extending the given
- // message type with the given field number.
- ExtensionRequest file_containing_extension = 5;
-
- // Finds the tag numbers used by all known extensions of extendee_type, and
- // appends them to ExtensionNumberResponse in an undefined order.
- // Its corresponding method is best-effort: it's not guaranteed that the
- // reflection service will implement this method, and it's not guaranteed
- // that this method will provide all extensions. Returns
- // StatusCode::UNIMPLEMENTED if it's not implemented.
- // This field should be a fully-qualified type name. The format is
- // <package>.<type>
- string all_extension_numbers_of_type = 6;
-
- // List the full names of registered services. The content will not be
- // checked.
- string list_services = 7;
- }
-}
-
-// The type name and extension number sent by the client when requesting
-// file_containing_extension.
-message ExtensionRequest {
- // Fully-qualified type name. The format should be <package>.<type>
- string containing_type = 1;
- int32 extension_number = 2;
-}
-
-// The message sent by the server to answer ServerReflectionInfo method.
-message ServerReflectionResponse {
- string valid_host = 1;
- ServerReflectionRequest original_request = 2;
- // The server sets one of the following fields according to the
- // message_request in the request.
- oneof message_response {
- // This message is used to answer file_by_filename, file_containing_symbol,
- // file_containing_extension requests with transitive dependencies.
- // As the repeated label is not allowed in oneof fields, we use a
- // FileDescriptorResponse message to encapsulate the repeated fields.
- // The reflection service is allowed to avoid sending FileDescriptorProtos
- // that were previously sent in response to earlier requests in the stream.
- FileDescriptorResponse file_descriptor_response = 4;
-
- // This message is used to answer all_extension_numbers_of_type requests.
- ExtensionNumberResponse all_extension_numbers_response = 5;
-
- // This message is used to answer list_services requests.
- ListServiceResponse list_services_response = 6;
-
- // This message is used when an error occurs.
- ErrorResponse error_response = 7;
- }
-}
-
-// Serialized FileDescriptorProto messages sent by the server answering
-// a file_by_filename, file_containing_symbol, or file_containing_extension
-// request.
-message FileDescriptorResponse {
- // Serialized FileDescriptorProto messages. We avoid taking a dependency on
- // descriptor.proto, which uses proto2 only features, by making them opaque
- // bytes instead.
- repeated bytes file_descriptor_proto = 1;
-}
-
-// A list of extension numbers sent by the server answering
-// all_extension_numbers_of_type request.
-message ExtensionNumberResponse {
- // Full name of the base type, including the package name. The format
- // is <package>.<type>
- string base_type_name = 1;
- repeated int32 extension_number = 2;
-}
-
-// A list of ServiceResponse sent by the server answering list_services request.
-message ListServiceResponse {
- // The information of each service may be expanded in the future, so we use
- // ServiceResponse message to encapsulate it.
- repeated ServiceResponse service = 1;
-}
-
-// The information of a single service used by ListServiceResponse to answer
-// list_services request.
-message ServiceResponse {
- // Full name of a registered service, including its package name. The format
- // is <package>.<service>
- string name = 1;
-}
-
-// The error code and error message sent by the server when an error occurs.
-message ErrorResponse {
- // This field uses the error codes defined in grpc::StatusCode.
- int32 error_code = 1;
- string error_message = 2;
-}
diff --git a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection_triple.pb.go b/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection_triple.pb.go
deleted file mode 100644
index d85ad76..0000000
--- a/protocol/dubbo3/reflection/triple_reflection_v1alpha/reflection_triple.pb.go
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-
-// Code generated by protoc-gen-go-triple. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-triple v1.0.8
-// - protoc v3.14.0
-// source: reflection.proto
-
-package triple_reflection_v1alpha
-
-import (
- context "context"
- fmt "fmt"
-)
-
-import (
- grpc_go "github.com/dubbogo/grpc-go"
- codes "github.com/dubbogo/grpc-go/codes"
- metadata "github.com/dubbogo/grpc-go/metadata"
- status "github.com/dubbogo/grpc-go/status"
-
- constant "github.com/dubbogo/triple/pkg/common/constant"
- triple "github.com/dubbogo/triple/pkg/triple"
-)
-
-import (
- constant1 "dubbo.apache.org/dubbo-go/v3/common/constant"
- protocol "dubbo.apache.org/dubbo-go/v3/protocol"
- dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3"
- invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc_go.SupportPackageIsVersion7
-
-// ServerReflectionClient is the client API for ServerReflection service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type ServerReflectionClient interface {
- // The reflection service is structured as a bidirectional stream, ensuring
- // all related requests go to a single server.
- ServerReflectionInfo(ctx context.Context, opts ...grpc_go.CallOption) (ServerReflection_ServerReflectionInfoClient, error)
-}
-
-type serverReflectionClient struct {
- cc *triple.TripleConn
-}
-
-type ServerReflectionClientImpl struct {
- ServerReflectionInfo func(ctx context.Context) (ServerReflection_ServerReflectionInfoClient, error)
-}
-
-func (c *ServerReflectionClientImpl) GetDubboStub(cc *triple.TripleConn) ServerReflectionClient {
- return NewServerReflectionClient(cc)
-}
-
-func (c *ServerReflectionClientImpl) XXX_InterfaceName() string {
- return "triple.reflection.v1alpha.ServerReflection"
-}
-
-func NewServerReflectionClient(cc *triple.TripleConn) ServerReflectionClient {
- return &serverReflectionClient{cc}
-}
-
-func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc_go.CallOption) (ServerReflection_ServerReflectionInfoClient, error) {
- interfaceKey := ctx.Value(constant.InterfaceKey).(string)
- stream, err := c.cc.NewStream(ctx, "/"+interfaceKey+"/ServerReflectionInfo", opts...)
- if err != nil {
- return nil, err
- }
- x := &serverReflectionServerReflectionInfoClient{stream}
- return x, nil
-}
-
-type ServerReflection_ServerReflectionInfoClient interface {
- Send(*ServerReflectionRequest) error
- Recv() (*ServerReflectionResponse, error)
- grpc_go.ClientStream
-}
-
-type serverReflectionServerReflectionInfoClient struct {
- grpc_go.ClientStream
-}
-
-func (x *serverReflectionServerReflectionInfoClient) Send(m *ServerReflectionRequest) error {
- return x.ClientStream.SendMsg(m)
-}
-
-func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) {
- m := new(ServerReflectionResponse)
- if err := x.ClientStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// ServerReflectionServer is the server API for ServerReflection service.
-// All implementations must embed UnimplementedServerReflectionServer
-// for forward compatibility
-type ServerReflectionServer interface {
- // The reflection service is structured as a bidirectional stream, ensuring
- // all related requests go to a single server.
- ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error
- mustEmbedUnimplementedServerReflectionServer()
-}
-
-// UnimplementedServerReflectionServer must be embedded to have forward compatible implementations.
-type UnimplementedServerReflectionServer struct {
- proxyImpl protocol.Invoker
-}
-
-func (UnimplementedServerReflectionServer) ServerReflectionInfo(ServerReflection_ServerReflectionInfoServer) error {
- return status.Errorf(codes.Unimplemented, "method ServerReflectionInfo not implemented")
-}
-func (s *UnimplementedServerReflectionServer) XXX_SetProxyImpl(impl protocol.Invoker) {
- s.proxyImpl = impl
-}
-
-func (s *UnimplementedServerReflectionServer) XXX_GetProxyImpl() protocol.Invoker {
- return s.proxyImpl
-}
-
-func (s *UnimplementedServerReflectionServer) XXX_ServiceDesc() *grpc_go.ServiceDesc {
- return &ServerReflection_ServiceDesc
-}
-func (s *UnimplementedServerReflectionServer) XXX_InterfaceName() string {
- return "triple.reflection.v1alpha.ServerReflection"
-}
-
-func (UnimplementedServerReflectionServer) mustEmbedUnimplementedServerReflectionServer() {}
-
-// UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to ServerReflectionServer will
-// result in compilation errors.
-type UnsafeServerReflectionServer interface {
- mustEmbedUnimplementedServerReflectionServer()
-}
-
-func RegisterServerReflectionServer(s grpc_go.ServiceRegistrar, srv ServerReflectionServer) {
- s.RegisterService(&ServerReflection_ServiceDesc, srv)
-}
-
-func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc_go.ServerStream) error {
- _, ok := srv.(dubbo3.Dubbo3GrpcService)
- ctx := stream.Context()
- md, _ := metadata.FromIncomingContext(ctx)
- invAttachment := make(map[string]interface{}, len(md))
- for k, v := range md {
- invAttachment[k] = v
- }
- stream.(grpc_go.CtxSetterStream).SetContext(context.WithValue(ctx, constant1.AttachmentKey, invAttachment))
- invo := invocation.NewRPCInvocation("ServerReflectionInfo", nil, nil)
- if !ok {
- fmt.Println(invo)
- return nil
- }
- return srv.(ServerReflectionServer).ServerReflectionInfo(&serverReflectionServerReflectionInfoServer{stream})
-}
-
-type ServerReflection_ServerReflectionInfoServer interface {
- Send(*ServerReflectionResponse) error
- Recv() (*ServerReflectionRequest, error)
- grpc_go.ServerStream
-}
-
-type serverReflectionServerReflectionInfoServer struct {
- grpc_go.ServerStream
-}
-
-func (x *serverReflectionServerReflectionInfoServer) Send(m *ServerReflectionResponse) error {
- return x.ServerStream.SendMsg(m)
-}
-
-func (x *serverReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) {
- m := new(ServerReflectionRequest)
- if err := x.ServerStream.RecvMsg(m); err != nil {
- return nil, err
- }
- return m, nil
-}
-
-// ServerReflection_ServiceDesc is the grpc_go.ServiceDesc for ServerReflection service.
-// It's only intended for direct use with grpc_go.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var ServerReflection_ServiceDesc = grpc_go.ServiceDesc{
- ServiceName: "triple.reflection.v1alpha.ServerReflection",
- HandlerType: (*ServerReflectionServer)(nil),
- Methods: []grpc_go.MethodDesc{},
- Streams: []grpc_go.StreamDesc{
- {
- StreamName: "ServerReflectionInfo",
- Handler: _ServerReflection_ServerReflectionInfo_Handler,
- ServerStreams: true,
- ClientStreams: true,
- },
- },
- Metadata: "reflection.proto",
-}
diff --git a/protocol/triple/health/healthServer.go b/protocol/triple/health/healthServer.go
index 7ec228c..af2e69e 100644
--- a/protocol/triple/health/healthServer.go
+++ b/protocol/triple/health/healthServer.go
@@ -30,6 +30,8 @@
)
import (
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/config"
"dubbo.apache.org/dubbo-go/v3/protocol/triple/health/triple_health"
"dubbo.apache.org/dubbo-go/v3/server"
)
@@ -53,6 +55,10 @@
}
}
+func (srv *HealthTripleServer) Reference() string {
+ return constant.HealthCheckServiceTypeName
+}
+
func (srv *HealthTripleServer) Check(ctx context.Context, req *triple_health.HealthCheckRequest) (*triple_health.HealthCheckResponse, error) {
srv.mu.RLock()
defer srv.mu.RUnlock()
@@ -168,8 +174,13 @@
server.SetProServices(&server.ServiceDefinition{
Handler: healthServer,
Info: &triple_health.Health_ServiceInfo,
- Opts: []server.ServiceOption{server.WithNotRegister()},
+ Opts: []server.ServiceOption{server.WithNotRegister(),
+ server.WithInterface(constant.HealthCheckServiceInterface)},
})
+
+ // In order to adapt config.Load
+ // Plans for future removal
+ config.SetProviderServiceWithInfo(healthServer, &triple_health.Health_ServiceInfo)
}
func SetServingStatusServing(service string) {
diff --git a/protocol/triple/health/triple_health/health.proto b/protocol/triple/health/triple_health/health.proto
index 22b8b42..e3ef667 100644
--- a/protocol/triple/health/triple_health/health.proto
+++ b/protocol/triple/health/triple_health/health.proto
@@ -20,7 +20,7 @@
syntax = "proto3";
-package dubbo.health.v1;
+package grpc.health.v1;
option go_package = "dubbo.apache.org/dubbo-go/v3/protocol/triple/health/triple_health";
diff --git a/protocol/triple/health/triple_health/health.triple.go b/protocol/triple/health/triple_health/health.triple.go
index 25a2264..6d299cd 100644
--- a/protocol/triple/health/triple_health/health.triple.go
+++ b/protocol/triple/health/triple_health/health.triple.go
@@ -43,7 +43,7 @@
const (
// HealthName is the fully-qualified name of the Health service.
- HealthName = "dubbo.health.v1.Health"
+ HealthName = "grpc.health.v1.Health"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
@@ -55,9 +55,9 @@
// period.
const (
// HealthCheckProcedure is the fully-qualified name of the Health's Check RPC.
- HealthCheckProcedure = "/dubbo.health.v1.Health/Check"
+ HealthCheckProcedure = "/grpc.health.v1.Health/Check"
// HealthWatchProcedure is the fully-qualified name of the Health's Watch RPC.
- HealthWatchProcedure = "/dubbo.health.v1.Health/Watch"
+ HealthWatchProcedure = "/grpc.health.v1.Health/Watch"
)
var (
@@ -68,15 +68,15 @@
_ Health_WatchServer = (*HealthWatchServer)(nil)
)
-// Health is a client for the dubbo.health.v1.Health service.
+// Health is a client for the grpc.health.v1.Health service.
type Health interface {
Check(ctx context.Context, req *HealthCheckRequest, opts ...client.CallOption) (*HealthCheckResponse, error)
Watch(ctx context.Context, req *HealthCheckRequest, opts ...client.CallOption) (Health_WatchClient, error)
}
-// NewHealth constructs a client for the dubbo.health.v1.Health service.
+// NewHealth constructs a client for the grpc.health.v1.Health service.
func NewHealth(cli *client.Client, opts ...client.ReferenceOption) (Health, error) {
- conn, err := cli.DialWithInfo("dubbo.health.v1.Health", &Health_ClientInfo, opts...)
+ conn, err := cli.DialWithInfo("grpc.health.v1.Health", &Health_ClientInfo, opts...)
if err != nil {
return nil, err
}
@@ -143,7 +143,7 @@
}
var Health_ClientInfo = client.ClientInfo{
- InterfaceName: "dubbo.health.v1.Health",
+ InterfaceName: "grpc.health.v1.Health",
MethodNames: []string{"Check", "Watch"},
ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) {
dubboCli := dubboCliRaw.(*HealthImpl)
@@ -151,7 +151,7 @@
},
}
-// HealthHandler is an implementation of the dubbo.health.v1.Health service.
+// HealthHandler is an implementation of the grpc.health.v1.Health service.
type HealthHandler interface {
Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
Watch(context.Context, *HealthCheckRequest, Health_WatchServer) error
@@ -181,7 +181,7 @@
}
var Health_ServiceInfo = server.ServiceInfo{
- InterfaceName: "dubbo.health.v1.Health",
+ InterfaceName: "grpc.health.v1.Health",
ServiceType: (*HealthHandler)(nil),
Methods: []server.MethodInfo{
{
diff --git a/protocol/triple/internal/client/health_client/main.go b/protocol/triple/internal/client/health_client/main.go
index 0b36574..7fc0dc2 100644
--- a/protocol/triple/internal/client/health_client/main.go
+++ b/protocol/triple/internal/client/health_client/main.go
@@ -43,11 +43,11 @@
panic(err)
}
- check, err := svc.Check(context.Background(), &health.HealthCheckRequest{Service: "dubbo.health.v1.Health"})
+ check, err := svc.Check(context.Background(), &health.HealthCheckRequest{Service: "grpc.health.v1.Health"})
if err != nil {
logger.Error(err)
} else {
- logger.Info("dubbo.health.v1.Health's health", check.String())
+ logger.Info("grpc.health.v1.Health's health", check.String())
}
check, err = svc.Check(context.Background(), &health.HealthCheckRequest{Service: "greet.GreetService"})
if err != nil {
@@ -61,7 +61,7 @@
logger.Error(err)
} else {
if watch.Recv() {
- logger.Info("dubbo.health.v1.Health's health", watch.Msg().String())
+ logger.Info("grpc.health.v1.Health's health", watch.Msg().String())
}
}
watch, err = svc.Watch(context.Background(), &health.HealthCheckRequest{Service: "greet.GreetService"})
diff --git a/protocol/triple/reflection/serverreflection.go b/protocol/triple/reflection/serverreflection.go
index de2816b..ae7bd09 100644
--- a/protocol/triple/reflection/serverreflection.go
+++ b/protocol/triple/reflection/serverreflection.go
@@ -37,6 +37,8 @@
)
import (
+ "dubbo.apache.org/dubbo-go/v3/common/constant"
+ "dubbo.apache.org/dubbo-go/v3/config"
rpb "dubbo.apache.org/dubbo-go/v3/protocol/triple/reflection/triple_reflection"
"dubbo.apache.org/dubbo-go/v3/server"
)
@@ -82,6 +84,10 @@
extResolver ExtensionResolver
}
+func (srv *ReflectionServer) Reference() string {
+ return constant.ReflectionServiceTypeName
+}
+
// fileDescWithDependencies returns a slice of serialized fileDescriptors in
// wire format ([]byte). The fileDescriptors will include fd and all the
// transitive dependencies of fd with names not in sentFileDescriptors.
@@ -269,17 +275,21 @@
}
}
-var reflectionServe *ReflectionServer
+var reflectionServer *ReflectionServer
func init() {
- reflectionServe = NewServer()
+ reflectionServer = NewServer()
server.SetProServices(&server.ServiceDefinition{
- Handler: reflectionServe,
+ Handler: reflectionServer,
Info: &rpb.ServerReflection_ServiceInfo,
- Opts: []server.ServiceOption{server.WithNotRegister()},
+ Opts: []server.ServiceOption{server.WithNotRegister(),
+ server.WithInterface(constant.ReflectionServiceInterface)},
})
+ // In order to adapt config.Load
+ // Plans for future removal
+ config.SetProviderServiceWithInfo(reflectionServer, &rpb.ServerReflection_ServiceInfo)
}
func Register(s ServiceInfoProvider) {
- reflectionServe.s = s
+ reflectionServer.s = s
}
diff --git a/protocol/triple/reflection/triple_reflection/reflection.proto b/protocol/triple/reflection/triple_reflection/reflection.proto
index db96af2..d5a0f63 100644
--- a/protocol/triple/reflection/triple_reflection/reflection.proto
+++ b/protocol/triple/reflection/triple_reflection/reflection.proto
@@ -19,7 +19,7 @@
syntax = "proto3";
-package dubbo.reflection.v1alpha;
+package grpc.reflection.v1alpha;
option go_package = "dubbo.apache.org/dubbo-go/v3/protocol/triple/reflection/triple_reflection";
diff --git a/protocol/triple/reflection/triple_reflection/reflection.triple.go b/protocol/triple/reflection/triple_reflection/reflection.triple.go
index 005ab39..6ec3df1 100644
--- a/protocol/triple/reflection/triple_reflection/reflection.triple.go
+++ b/protocol/triple/reflection/triple_reflection/reflection.triple.go
@@ -43,7 +43,7 @@
const (
// ServerReflectionName is the fully-qualified name of the ServerReflection service.
- ServerReflectionName = "dubbo.reflection.v1alpha.ServerReflection"
+ ServerReflectionName = "grpc.reflection.v1alpha.ServerReflection"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
@@ -55,7 +55,7 @@
// period.
const (
// ServerReflectionServerReflectionInfoProcedure is the fully-qualified name of the ServerReflection's ServerReflectionInfo RPC.
- ServerReflectionServerReflectionInfoProcedure = "/dubbo.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
+ ServerReflectionServerReflectionInfoProcedure = "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
)
var (
@@ -66,14 +66,14 @@
_ ServerReflection_ServerReflectionInfoServer = (*ServerReflectionServerReflectionInfoServer)(nil)
)
-// ServerReflection is a client for the dubbo.reflection.v1alpha.ServerReflection service.
+// ServerReflection is a client for the grpc.reflection.v1alpha.ServerReflection service.
type ServerReflection interface {
ServerReflectionInfo(ctx context.Context, opts ...client.CallOption) (ServerReflection_ServerReflectionInfoClient, error)
}
-// NewServerReflection constructs a client for the dubbo.reflection.v1alpha.ServerReflection service.
+// NewServerReflection constructs a client for the grpc.reflection.v1alpha.ServerReflection service.
func NewServerReflection(cli *client.Client, opts ...client.ReferenceOption) (ServerReflection, error) {
- conn, err := cli.DialWithInfo("dubbo.reflection.v1alpha.ServerReflection", &ServerReflection_ClientInfo, opts...)
+ conn, err := cli.DialWithInfo("grpc.reflection.v1alpha.ServerReflection", &ServerReflection_ClientInfo, opts...)
if err != nil {
return nil, err
}
@@ -129,7 +129,7 @@
}
var ServerReflection_ClientInfo = client.ClientInfo{
- InterfaceName: "dubbo.reflection.v1alpha.ServerReflection",
+ InterfaceName: "grpc.reflection.v1alpha.ServerReflection",
MethodNames: []string{"ServerReflectionInfo"},
ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) {
dubboCli := dubboCliRaw.(*ServerReflectionImpl)
@@ -137,7 +137,7 @@
},
}
-// ServerReflectionHandler is an implementation of the dubbo.reflection.v1alpha.ServerReflection service.
+// ServerReflectionHandler is an implementation of the grpc.reflection.v1alpha.ServerReflection service.
type ServerReflectionHandler interface {
ServerReflectionInfo(context.Context, ServerReflection_ServerReflectionInfoServer) error
}
@@ -178,7 +178,7 @@
}
var ServerReflection_ServiceInfo = server.ServiceInfo{
- InterfaceName: "dubbo.reflection.v1alpha.ServerReflection",
+ InterfaceName: "grpc.reflection.v1alpha.ServerReflection",
ServiceType: (*ServerReflectionHandler)(nil),
Methods: []server.MethodInfo{
{
diff --git a/server/action.go b/server/action.go
index f32b3db..31bfaca 100644
--- a/server/action.go
+++ b/server/action.go
@@ -168,7 +168,6 @@
var invoker protocol.Invoker
ports := getRandomPort(protocolConfigs)
nextPort := ports.Front()
- proxyFactory := extension.GetProxyFactory(svcOpts.ProxyFactoryKey)
for _, proto := range protocolConfigs {
// *important* Register should have been replaced by processing of ServiceInfo.
// but many modules like metadata need to make use of information from ServiceMap.
@@ -226,11 +225,7 @@
for _, regUrl := range regUrls {
setRegistrySubURL(ivkURL, regUrl)
- if info == nil {
- invoker = proxyFactory.GetInvoker(regUrl)
- } else {
- invoker = newInfoInvoker(regUrl, info, svcOpts.rpcService)
- }
+ svcOpts.generatorInvoker(regUrl, info)
exporter := svcOpts.cacheProtocol.Export(invoker)
if exporter == nil {
return perrors.New(fmt.Sprintf("Registry protocol new exporter error, registry is {%v}, url is {%v}", regUrl, ivkURL))
@@ -248,11 +243,7 @@
logger.Warnf("SetMetadataServiceURL error = %svcOpts", err)
}
}
- if info == nil {
- invoker = proxyFactory.GetInvoker(ivkURL)
- } else {
- invoker = newInfoInvoker(ivkURL, info, svcOpts.rpcService)
- }
+ svcOpts.generatorInvoker(ivkURL, info)
exporter := extension.GetProtocol(protocolwrapper.FILTER).Export(invoker)
if exporter == nil {
return perrors.New(fmt.Sprintf("Filter protocol without registry new exporter error, url is {%v}", ivkURL))
@@ -268,6 +259,14 @@
return nil
}
+func (svcOpts *ServiceOptions) generatorInvoker(url *common.URL, info *ServiceInfo) protocol.Invoker {
+ proxyFactory := extension.GetProxyFactory(svcOpts.ProxyFactoryKey)
+ if info == nil {
+ return proxyFactory.GetInvoker(url)
+ }
+ return newInfoInvoker(url, info, svcOpts.rpcService)
+}
+
// setRegistrySubURL set registry sub url is ivkURl
func setRegistrySubURL(ivkURL *common.URL, regUrl *common.URL) {
ivkURL.AddParam(constant.RegistryKey, regUrl.GetParam(constant.RegistryKey, ""))
diff --git a/server/compat.go b/server/compat.go
index 9e34254..d5b02ed 100644
--- a/server/compat.go
+++ b/server/compat.go
@@ -18,8 +18,10 @@
package server
import (
+ "dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/config"
"dubbo.apache.org/dubbo-go/v3/global"
+ "dubbo.apache.org/dubbo-go/v3/protocol"
)
// these functions are used to resolve circular dependencies temporarily.
@@ -88,3 +90,12 @@
MaxServerRecvMsgSize: c.MaxServerRecvMsgSize,
}
}
+
+func init() {
+ config.NewInfoInvoker = compatNewInfoInvoker
+}
+
+// these functions are used to resolve circular dependencies temporarily.
+func compatNewInfoInvoker(url *common.URL, info interface{}, svc common.RPCService) protocol.Invoker {
+ return newInfoInvoker(url, info.(*ServiceInfo), svc)
+}