fix api metadata

pull/906/head
longXboy 4 years ago
parent 7e7bbdbed6
commit d8edff0b84
  1. 2
      api/metadata/server.go
  2. 8
      api/metadata/service.go
  3. 0
      api/proto/kratos/api/annotations.pb.go
  4. 0
      api/proto/kratos/api/annotations.proto
  5. 149
      api/proto/kratos/api/metadata.pb.go
  6. 0
      api/proto/kratos/api/metadata.proto
  7. 4
      api/proto/kratos/api/metadata_grpc.pb.go
  8. 0
      api/proto/kratos/api/metadata_http.pb.go
  9. 4
      transport/grpc/server.go

@ -3,7 +3,7 @@ package metadata
import ( import (
"context" "context"
"github.com/go-kratos/kratos/v2/api/kratos/api" "github.com/go-kratos/kratos/v2/api/proto/kratos/api"
"google.golang.org/grpc" "google.golang.org/grpc"
anypb "google.golang.org/protobuf/types/known/anypb" anypb "google.golang.org/protobuf/types/known/anypb"
) )

@ -6,7 +6,6 @@ import (
"context" "context"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"strings"
"sync" "sync"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
@ -112,13 +111,6 @@ func (s *Service) listServices() (map[string]*descriptorpb.FileDescriptorSet, er
func fileDescriptorProto(path string) (*dpb.FileDescriptorProto, error) { func fileDescriptorProto(path string) (*dpb.FileDescriptorProto, error) {
fdenc := proto.FileDescriptor(path) fdenc := proto.FileDescriptor(path)
// fix proto path
if len(fdenc) == 0 {
idx := strings.LastIndex(path, "/")
if idx > 0 && idx+1 < len(path) {
fdenc = proto.FileDescriptor(path[idx+1:])
}
}
fdDep, err := decodeFileDesc(fdenc) fdDep, err := decodeFileDesc(fdenc)
if err != nil { if err != nil {
return nil, err return nil, err

@ -2,7 +2,7 @@
// versions: // versions:
// protoc-gen-go v1.26.0 // protoc-gen-go v1.26.0
// protoc v3.15.8 // protoc v3.15.8
// source: metadata.proto // source: kratos/api/metadata.proto
package api package api
@ -34,7 +34,7 @@ type ListServicesReply struct {
func (x *ListServicesReply) Reset() { func (x *ListServicesReply) Reset() {
*x = ListServicesReply{} *x = ListServicesReply{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_metadata_proto_msgTypes[0] mi := &file_kratos_api_metadata_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -47,7 +47,7 @@ func (x *ListServicesReply) String() string {
func (*ListServicesReply) ProtoMessage() {} func (*ListServicesReply) ProtoMessage() {}
func (x *ListServicesReply) ProtoReflect() protoreflect.Message { func (x *ListServicesReply) ProtoReflect() protoreflect.Message {
mi := &file_metadata_proto_msgTypes[0] mi := &file_kratos_api_metadata_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -60,7 +60,7 @@ func (x *ListServicesReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListServicesReply.ProtoReflect.Descriptor instead. // Deprecated: Use ListServicesReply.ProtoReflect.Descriptor instead.
func (*ListServicesReply) Descriptor() ([]byte, []int) { func (*ListServicesReply) Descriptor() ([]byte, []int) {
return file_metadata_proto_rawDescGZIP(), []int{0} return file_kratos_api_metadata_proto_rawDescGZIP(), []int{0}
} }
func (x *ListServicesReply) GetServices() []string { func (x *ListServicesReply) GetServices() []string {
@ -81,7 +81,7 @@ type GetServiceMetaRequest struct {
func (x *GetServiceMetaRequest) Reset() { func (x *GetServiceMetaRequest) Reset() {
*x = GetServiceMetaRequest{} *x = GetServiceMetaRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_metadata_proto_msgTypes[1] mi := &file_kratos_api_metadata_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -94,7 +94,7 @@ func (x *GetServiceMetaRequest) String() string {
func (*GetServiceMetaRequest) ProtoMessage() {} func (*GetServiceMetaRequest) ProtoMessage() {}
func (x *GetServiceMetaRequest) ProtoReflect() protoreflect.Message { func (x *GetServiceMetaRequest) ProtoReflect() protoreflect.Message {
mi := &file_metadata_proto_msgTypes[1] mi := &file_kratos_api_metadata_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -107,7 +107,7 @@ func (x *GetServiceMetaRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetServiceMetaRequest.ProtoReflect.Descriptor instead. // Deprecated: Use GetServiceMetaRequest.ProtoReflect.Descriptor instead.
func (*GetServiceMetaRequest) Descriptor() ([]byte, []int) { func (*GetServiceMetaRequest) Descriptor() ([]byte, []int) {
return file_metadata_proto_rawDescGZIP(), []int{1} return file_kratos_api_metadata_proto_rawDescGZIP(), []int{1}
} }
func (x *GetServiceMetaRequest) GetName() string { func (x *GetServiceMetaRequest) GetName() string {
@ -128,7 +128,7 @@ type GetServiceMetaReply struct {
func (x *GetServiceMetaReply) Reset() { func (x *GetServiceMetaReply) Reset() {
*x = GetServiceMetaReply{} *x = GetServiceMetaReply{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_metadata_proto_msgTypes[2] mi := &file_kratos_api_metadata_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -141,7 +141,7 @@ func (x *GetServiceMetaReply) String() string {
func (*GetServiceMetaReply) ProtoMessage() {} func (*GetServiceMetaReply) ProtoMessage() {}
func (x *GetServiceMetaReply) ProtoReflect() protoreflect.Message { func (x *GetServiceMetaReply) ProtoReflect() protoreflect.Message {
mi := &file_metadata_proto_msgTypes[2] mi := &file_kratos_api_metadata_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -154,7 +154,7 @@ func (x *GetServiceMetaReply) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetServiceMetaReply.ProtoReflect.Descriptor instead. // Deprecated: Use GetServiceMetaReply.ProtoReflect.Descriptor instead.
func (*GetServiceMetaReply) Descriptor() ([]byte, []int) { func (*GetServiceMetaReply) Descriptor() ([]byte, []int) {
return file_metadata_proto_rawDescGZIP(), []int{2} return file_kratos_api_metadata_proto_rawDescGZIP(), []int{2}
} }
func (x *GetServiceMetaReply) GetProtoSet() *descriptorpb.FileDescriptorSet { func (x *GetServiceMetaReply) GetProtoSet() *descriptorpb.FileDescriptorSet {
@ -164,71 +164,72 @@ func (x *GetServiceMetaReply) GetProtoSet() *descriptorpb.FileDescriptorSet {
return nil return nil
} }
var File_metadata_proto protoreflect.FileDescriptor var File_kratos_api_metadata_proto protoreflect.FileDescriptor
var file_metadata_proto_rawDesc = []byte{ var file_kratos_api_metadata_proto_rawDesc = []byte{
0x0a, 0x0e, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x0a, 0x19, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x65, 0x74,
0x12, 0x0a, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x19, 0x67, 0x6f, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x6b, 0x72, 0x61,
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70,
0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69,
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x22, 0x55, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65,
0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3e, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x53, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x52, 0x08, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x32, 0xda, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x1a, 0x1d, 0x2e, 0x6b, 0x72, 0x61,
0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x0b, 0x12, 0x09, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x76, 0x0a, 0x0e,
0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x21,
0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x47,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x55, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x70,
0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x3e, 0x0a, 0x08, 0x6c, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, 0x2f, 0x73, 0x65, 0x72,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x6d, 0x65, 0x74, 0x61,
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x64, 0x61, 0x74, 0x61, 0x42, 0x58, 0x0a, 0x15, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x69, 0x74, 0x68,
0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x53, 0x75, 0x62, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x50, 0x01, 0x5a,
0x65, 0x74, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x53, 0x65, 0x74, 0x32, 0xda, 0x01, 0x0a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x6f, 0x2d, 0x6b,
0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x56, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x76, 0x32, 0x2f,
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x3b, 0x61,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x1a, 0x70, 0x69, 0xa2, 0x02, 0x09, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x41, 0x50, 0x49, 0x62, 0x06,
0x1d, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x11,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x73, 0x12, 0x76, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d,
0x65, 0x74, 0x61, 0x12, 0x21, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4d, 0x65,
0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12,
0x18, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d,
0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x42, 0x58, 0x0a, 0x15, 0x63, 0x6f, 0x6d,
0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2e, 0x61,
0x70, 0x69, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x67, 0x6f, 0x2d, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f,
0x73, 0x2f, 0x76, 0x32, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2f,
0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0xa2, 0x02, 0x09, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73,
0x41, 0x50, 0x49, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
file_metadata_proto_rawDescOnce sync.Once file_kratos_api_metadata_proto_rawDescOnce sync.Once
file_metadata_proto_rawDescData = file_metadata_proto_rawDesc file_kratos_api_metadata_proto_rawDescData = file_kratos_api_metadata_proto_rawDesc
) )
func file_metadata_proto_rawDescGZIP() []byte { func file_kratos_api_metadata_proto_rawDescGZIP() []byte {
file_metadata_proto_rawDescOnce.Do(func() { file_kratos_api_metadata_proto_rawDescOnce.Do(func() {
file_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_metadata_proto_rawDescData) file_kratos_api_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_kratos_api_metadata_proto_rawDescData)
}) })
return file_metadata_proto_rawDescData return file_kratos_api_metadata_proto_rawDescData
} }
var file_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_kratos_api_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_metadata_proto_goTypes = []interface{}{ var file_kratos_api_metadata_proto_goTypes = []interface{}{
(*ListServicesReply)(nil), // 0: kratos.api.ListServicesReply (*ListServicesReply)(nil), // 0: kratos.api.ListServicesReply
(*GetServiceMetaRequest)(nil), // 1: kratos.api.GetServiceMetaRequest (*GetServiceMetaRequest)(nil), // 1: kratos.api.GetServiceMetaRequest
(*GetServiceMetaReply)(nil), // 2: kratos.api.GetServiceMetaReply (*GetServiceMetaReply)(nil), // 2: kratos.api.GetServiceMetaReply
(*descriptorpb.FileDescriptorSet)(nil), // 3: google.protobuf.FileDescriptorSet (*descriptorpb.FileDescriptorSet)(nil), // 3: google.protobuf.FileDescriptorSet
(*anypb.Any)(nil), // 4: google.protobuf.Any (*anypb.Any)(nil), // 4: google.protobuf.Any
} }
var file_metadata_proto_depIdxs = []int32{ var file_kratos_api_metadata_proto_depIdxs = []int32{
3, // 0: kratos.api.GetServiceMetaReply.protoSet:type_name -> google.protobuf.FileDescriptorSet 3, // 0: kratos.api.GetServiceMetaReply.protoSet:type_name -> google.protobuf.FileDescriptorSet
4, // 1: kratos.api.Metadata.ListServices:input_type -> google.protobuf.Any 4, // 1: kratos.api.Metadata.ListServices:input_type -> google.protobuf.Any
1, // 2: kratos.api.Metadata.GetServiceMeta:input_type -> kratos.api.GetServiceMetaRequest 1, // 2: kratos.api.Metadata.GetServiceMeta:input_type -> kratos.api.GetServiceMetaRequest
@ -241,13 +242,13 @@ var file_metadata_proto_depIdxs = []int32{
0, // [0:1] is the sub-list for field type_name 0, // [0:1] is the sub-list for field type_name
} }
func init() { file_metadata_proto_init() } func init() { file_kratos_api_metadata_proto_init() }
func file_metadata_proto_init() { func file_kratos_api_metadata_proto_init() {
if File_metadata_proto != nil { if File_kratos_api_metadata_proto != nil {
return return
} }
if !protoimpl.UnsafeEnabled { if !protoimpl.UnsafeEnabled {
file_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { file_kratos_api_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListServicesReply); i { switch v := v.(*ListServicesReply); i {
case 0: case 0:
return &v.state return &v.state
@ -259,7 +260,7 @@ func file_metadata_proto_init() {
return nil return nil
} }
} }
file_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { file_kratos_api_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetServiceMetaRequest); i { switch v := v.(*GetServiceMetaRequest); i {
case 0: case 0:
return &v.state return &v.state
@ -271,7 +272,7 @@ func file_metadata_proto_init() {
return nil return nil
} }
} }
file_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_kratos_api_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetServiceMetaReply); i { switch v := v.(*GetServiceMetaReply); i {
case 0: case 0:
return &v.state return &v.state
@ -288,18 +289,18 @@ func file_metadata_proto_init() {
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_metadata_proto_rawDesc, RawDescriptor: file_kratos_api_metadata_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 3, NumMessages: 3,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
GoTypes: file_metadata_proto_goTypes, GoTypes: file_kratos_api_metadata_proto_goTypes,
DependencyIndexes: file_metadata_proto_depIdxs, DependencyIndexes: file_kratos_api_metadata_proto_depIdxs,
MessageInfos: file_metadata_proto_msgTypes, MessageInfos: file_kratos_api_metadata_proto_msgTypes,
}.Build() }.Build()
File_metadata_proto = out.File File_kratos_api_metadata_proto = out.File
file_metadata_proto_rawDesc = nil file_kratos_api_metadata_proto_rawDesc = nil
file_metadata_proto_goTypes = nil file_kratos_api_metadata_proto_goTypes = nil
file_metadata_proto_depIdxs = nil file_kratos_api_metadata_proto_depIdxs = nil
} }

@ -2,7 +2,7 @@
// versions: // versions:
// - protoc-gen-go-grpc v1.1.0 // - protoc-gen-go-grpc v1.1.0
// - protoc v3.15.8 // - protoc v3.15.8
// source: metadata.proto // source: kratos/api/metadata.proto
package api package api
@ -142,5 +142,5 @@ var Metadata_ServiceDesc = grpc.ServiceDesc{
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "metadata.proto", Metadata: "kratos/api/metadata.proto",
} }

@ -6,8 +6,8 @@ import (
"net" "net"
"time" "time"
"github.com/go-kratos/kratos/v2/api/kratos/api" "github.com/go-kratos/kratos/v2/api/metadata"
"github.com/go-kratos/kratos/v2/internal/api/metadata" "github.com/go-kratos/kratos/v2/api/proto/kratos/api"
"github.com/go-kratos/kratos/v2/internal/host" "github.com/go-kratos/kratos/v2/internal/host"
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware" "github.com/go-kratos/kratos/v2/middleware"

Loading…
Cancel
Save