vendor update for CSI 0.3.0

This commit is contained in:
gman
2018-07-18 16:47:22 +02:00
parent 6f484f92fc
commit 8ea659f0d5
6810 changed files with 438061 additions and 193861 deletions

View File

@ -1,22 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: grpc_reflection_v1alpha/reflection.proto
/*
Package grpc_reflection_v1alpha is a generated protocol buffer package.
It is generated from these files:
grpc_reflection_v1alpha/reflection.proto
It has these top-level messages:
ServerReflectionRequest
ExtensionRequest
ServerReflectionResponse
FileDescriptorResponse
ExtensionNumberResponse
ListServiceResponse
ServiceResponse
ErrorResponse
*/
package grpc_reflection_v1alpha
import proto "github.com/golang/protobuf/proto"
@ -41,7 +25,7 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// The message sent by the client when calling ServerReflectionInfo method.
type ServerReflectionRequest struct {
Host string `protobuf:"bytes,1,opt,name=host" json:"host,omitempty"`
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.
@ -52,32 +36,54 @@ type ServerReflectionRequest struct {
// *ServerReflectionRequest_FileContainingExtension
// *ServerReflectionRequest_AllExtensionNumbersOfType
// *ServerReflectionRequest_ListServices
MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"`
MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest{} }
func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) }
func (*ServerReflectionRequest) ProtoMessage() {}
func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ServerReflectionRequest) Reset() { *m = ServerReflectionRequest{} }
func (m *ServerReflectionRequest) String() string { return proto.CompactTextString(m) }
func (*ServerReflectionRequest) ProtoMessage() {}
func (*ServerReflectionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{0}
}
func (m *ServerReflectionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ServerReflectionRequest.Unmarshal(m, b)
}
func (m *ServerReflectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ServerReflectionRequest.Marshal(b, m, deterministic)
}
func (dst *ServerReflectionRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ServerReflectionRequest.Merge(dst, src)
}
func (m *ServerReflectionRequest) XXX_Size() int {
return xxx_messageInfo_ServerReflectionRequest.Size(m)
}
func (m *ServerReflectionRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ServerReflectionRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ServerReflectionRequest proto.InternalMessageInfo
type isServerReflectionRequest_MessageRequest interface {
isServerReflectionRequest_MessageRequest()
}
type ServerReflectionRequest_FileByFilename struct {
FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,oneof"`
FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"`
}
type ServerReflectionRequest_FileContainingSymbol struct {
FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,oneof"`
FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"`
}
type ServerReflectionRequest_FileContainingExtension struct {
FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,oneof"`
FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"`
}
type ServerReflectionRequest_AllExtensionNumbersOfType struct {
AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,oneof"`
AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"`
}
type ServerReflectionRequest_ListServices struct {
ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,oneof"`
ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"`
}
func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {}
@ -223,24 +229,24 @@ func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) {
// message_request
switch x := m.MessageRequest.(type) {
case *ServerReflectionRequest_FileByFilename:
n += proto.SizeVarint(3<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(len(x.FileByFilename)))
n += len(x.FileByFilename)
case *ServerReflectionRequest_FileContainingSymbol:
n += proto.SizeVarint(4<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(len(x.FileContainingSymbol)))
n += len(x.FileContainingSymbol)
case *ServerReflectionRequest_FileContainingExtension:
s := proto.Size(x.FileContainingExtension)
n += proto.SizeVarint(5<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(s))
n += s
case *ServerReflectionRequest_AllExtensionNumbersOfType:
n += proto.SizeVarint(6<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(len(x.AllExtensionNumbersOfType)))
n += len(x.AllExtensionNumbersOfType)
case *ServerReflectionRequest_ListServices:
n += proto.SizeVarint(7<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(len(x.ListServices)))
n += len(x.ListServices)
case nil:
@ -254,14 +260,36 @@ func _ServerReflectionRequest_OneofSizer(msg proto.Message) (n int) {
// file_containing_extension.
type ExtensionRequest struct {
// Fully-qualified type name. The format should be <package>.<type>
ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType" json:"containing_type,omitempty"`
ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"`
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"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} }
func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) }
func (*ExtensionRequest) ProtoMessage() {}
func (*ExtensionRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *ExtensionRequest) Reset() { *m = ExtensionRequest{} }
func (m *ExtensionRequest) String() string { return proto.CompactTextString(m) }
func (*ExtensionRequest) ProtoMessage() {}
func (*ExtensionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{1}
}
func (m *ExtensionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExtensionRequest.Unmarshal(m, b)
}
func (m *ExtensionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ExtensionRequest.Marshal(b, m, deterministic)
}
func (dst *ExtensionRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExtensionRequest.Merge(dst, src)
}
func (m *ExtensionRequest) XXX_Size() int {
return xxx_messageInfo_ExtensionRequest.Size(m)
}
func (m *ExtensionRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ExtensionRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ExtensionRequest proto.InternalMessageInfo
func (m *ExtensionRequest) GetContainingType() string {
if m != nil {
@ -279,39 +307,61 @@ func (m *ExtensionRequest) GetExtensionNumber() int32 {
// The message sent by the server to answer ServerReflectionInfo method.
type ServerReflectionResponse struct {
ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost" json:"valid_host,omitempty"`
OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest" json:"original_request,omitempty"`
// The server set one of the following fields according to the message_request
// in the request.
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 valid to be assigned to MessageResponse:
// *ServerReflectionResponse_FileDescriptorResponse
// *ServerReflectionResponse_AllExtensionNumbersResponse
// *ServerReflectionResponse_ListServicesResponse
// *ServerReflectionResponse_ErrorResponse
MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"`
MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionResponse{} }
func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) }
func (*ServerReflectionResponse) ProtoMessage() {}
func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *ServerReflectionResponse) Reset() { *m = ServerReflectionResponse{} }
func (m *ServerReflectionResponse) String() string { return proto.CompactTextString(m) }
func (*ServerReflectionResponse) ProtoMessage() {}
func (*ServerReflectionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{2}
}
func (m *ServerReflectionResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ServerReflectionResponse.Unmarshal(m, b)
}
func (m *ServerReflectionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ServerReflectionResponse.Marshal(b, m, deterministic)
}
func (dst *ServerReflectionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ServerReflectionResponse.Merge(dst, src)
}
func (m *ServerReflectionResponse) XXX_Size() int {
return xxx_messageInfo_ServerReflectionResponse.Size(m)
}
func (m *ServerReflectionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ServerReflectionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ServerReflectionResponse proto.InternalMessageInfo
type isServerReflectionResponse_MessageResponse interface {
isServerReflectionResponse_MessageResponse()
}
type ServerReflectionResponse_FileDescriptorResponse struct {
FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,oneof"`
FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"`
}
type ServerReflectionResponse_AllExtensionNumbersResponse struct {
AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,oneof"`
AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"`
}
type ServerReflectionResponse_ListServicesResponse struct {
ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,oneof"`
ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"`
}
type ServerReflectionResponse_ErrorResponse struct {
ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,oneof"`
ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"`
}
func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() {}
@ -456,22 +506,22 @@ func _ServerReflectionResponse_OneofSizer(msg proto.Message) (n int) {
switch x := m.MessageResponse.(type) {
case *ServerReflectionResponse_FileDescriptorResponse:
s := proto.Size(x.FileDescriptorResponse)
n += proto.SizeVarint(4<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(s))
n += s
case *ServerReflectionResponse_AllExtensionNumbersResponse:
s := proto.Size(x.AllExtensionNumbersResponse)
n += proto.SizeVarint(5<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(s))
n += s
case *ServerReflectionResponse_ListServicesResponse:
s := proto.Size(x.ListServicesResponse)
n += proto.SizeVarint(6<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(s))
n += s
case *ServerReflectionResponse_ErrorResponse:
s := proto.Size(x.ErrorResponse)
n += proto.SizeVarint(7<<3 | proto.WireBytes)
n += 1 // tag and wire
n += proto.SizeVarint(uint64(s))
n += s
case nil:
@ -488,13 +538,35 @@ type FileDescriptorResponse struct {
// 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"`
FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} }
func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) }
func (*FileDescriptorResponse) ProtoMessage() {}
func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (m *FileDescriptorResponse) Reset() { *m = FileDescriptorResponse{} }
func (m *FileDescriptorResponse) String() string { return proto.CompactTextString(m) }
func (*FileDescriptorResponse) ProtoMessage() {}
func (*FileDescriptorResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{3}
}
func (m *FileDescriptorResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_FileDescriptorResponse.Unmarshal(m, b)
}
func (m *FileDescriptorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_FileDescriptorResponse.Marshal(b, m, deterministic)
}
func (dst *FileDescriptorResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_FileDescriptorResponse.Merge(dst, src)
}
func (m *FileDescriptorResponse) XXX_Size() int {
return xxx_messageInfo_FileDescriptorResponse.Size(m)
}
func (m *FileDescriptorResponse) XXX_DiscardUnknown() {
xxx_messageInfo_FileDescriptorResponse.DiscardUnknown(m)
}
var xxx_messageInfo_FileDescriptorResponse proto.InternalMessageInfo
func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte {
if m != nil {
@ -508,14 +580,36 @@ func (m *FileDescriptorResponse) GetFileDescriptorProto() [][]byte {
type ExtensionNumberResponse struct {
// 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" json:"base_type_name,omitempty"`
ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber" json:"extension_number,omitempty"`
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"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse{} }
func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) }
func (*ExtensionNumberResponse) ProtoMessage() {}
func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (m *ExtensionNumberResponse) Reset() { *m = ExtensionNumberResponse{} }
func (m *ExtensionNumberResponse) String() string { return proto.CompactTextString(m) }
func (*ExtensionNumberResponse) ProtoMessage() {}
func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{4}
}
func (m *ExtensionNumberResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExtensionNumberResponse.Unmarshal(m, b)
}
func (m *ExtensionNumberResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ExtensionNumberResponse.Marshal(b, m, deterministic)
}
func (dst *ExtensionNumberResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ExtensionNumberResponse.Merge(dst, src)
}
func (m *ExtensionNumberResponse) XXX_Size() int {
return xxx_messageInfo_ExtensionNumberResponse.Size(m)
}
func (m *ExtensionNumberResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ExtensionNumberResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ExtensionNumberResponse proto.InternalMessageInfo
func (m *ExtensionNumberResponse) GetBaseTypeName() string {
if m != nil {
@ -535,13 +629,35 @@ func (m *ExtensionNumberResponse) GetExtensionNumber() []int32 {
type ListServiceResponse struct {
// 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" json:"service,omitempty"`
Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} }
func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) }
func (*ListServiceResponse) ProtoMessage() {}
func (*ListServiceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *ListServiceResponse) Reset() { *m = ListServiceResponse{} }
func (m *ListServiceResponse) String() string { return proto.CompactTextString(m) }
func (*ListServiceResponse) ProtoMessage() {}
func (*ListServiceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{5}
}
func (m *ListServiceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListServiceResponse.Unmarshal(m, b)
}
func (m *ListServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListServiceResponse.Marshal(b, m, deterministic)
}
func (dst *ListServiceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListServiceResponse.Merge(dst, src)
}
func (m *ListServiceResponse) XXX_Size() int {
return xxx_messageInfo_ListServiceResponse.Size(m)
}
func (m *ListServiceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListServiceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListServiceResponse proto.InternalMessageInfo
func (m *ListServiceResponse) GetService() []*ServiceResponse {
if m != nil {
@ -555,13 +671,35 @@ func (m *ListServiceResponse) GetService() []*ServiceResponse {
type ServiceResponse struct {
// Full name of a registered service, including its package name. The format
// is <package>.<service>
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ServiceResponse) Reset() { *m = ServiceResponse{} }
func (m *ServiceResponse) String() string { return proto.CompactTextString(m) }
func (*ServiceResponse) ProtoMessage() {}
func (*ServiceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *ServiceResponse) Reset() { *m = ServiceResponse{} }
func (m *ServiceResponse) String() string { return proto.CompactTextString(m) }
func (*ServiceResponse) ProtoMessage() {}
func (*ServiceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{6}
}
func (m *ServiceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ServiceResponse.Unmarshal(m, b)
}
func (m *ServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ServiceResponse.Marshal(b, m, deterministic)
}
func (dst *ServiceResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ServiceResponse.Merge(dst, src)
}
func (m *ServiceResponse) XXX_Size() int {
return xxx_messageInfo_ServiceResponse.Size(m)
}
func (m *ServiceResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ServiceResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ServiceResponse proto.InternalMessageInfo
func (m *ServiceResponse) GetName() string {
if m != nil {
@ -573,14 +711,36 @@ func (m *ServiceResponse) GetName() string {
// The error code and error message sent by the server when an error occurs.
type ErrorResponse struct {
// This field uses the error codes defined in grpc::StatusCode.
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode" json:"error_code,omitempty"`
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage" json:"error_message,omitempty"`
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"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ErrorResponse) Reset() { *m = ErrorResponse{} }
func (m *ErrorResponse) String() string { return proto.CompactTextString(m) }
func (*ErrorResponse) ProtoMessage() {}
func (*ErrorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *ErrorResponse) Reset() { *m = ErrorResponse{} }
func (m *ErrorResponse) String() string { return proto.CompactTextString(m) }
func (*ErrorResponse) ProtoMessage() {}
func (*ErrorResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_reflection_178bd1e101bf8b63, []int{7}
}
func (m *ErrorResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ErrorResponse.Unmarshal(m, b)
}
func (m *ErrorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ErrorResponse.Marshal(b, m, deterministic)
}
func (dst *ErrorResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ErrorResponse.Merge(dst, src)
}
func (m *ErrorResponse) XXX_Size() int {
return xxx_messageInfo_ErrorResponse.Size(m)
}
func (m *ErrorResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ErrorResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ErrorResponse proto.InternalMessageInfo
func (m *ErrorResponse) GetErrorCode() int32 {
if m != nil {
@ -615,8 +775,9 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for ServerReflection service
// ServerReflectionClient is the client API for ServerReflection service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type ServerReflectionClient interface {
// The reflection service is structured as a bidirectional stream, ensuring
// all related requests go to a single server.
@ -632,7 +793,7 @@ func NewServerReflectionClient(cc *grpc.ClientConn) ServerReflectionClient {
}
func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (ServerReflection_ServerReflectionInfoClient, error) {
stream, err := grpc.NewClientStream(ctx, &_ServerReflection_serviceDesc.Streams[0], c.cc, "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...)
stream, err := c.cc.NewStream(ctx, &_ServerReflection_serviceDesc.Streams[0], "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo", opts...)
if err != nil {
return nil, err
}
@ -662,8 +823,7 @@ func (x *serverReflectionServerReflectionInfoClient) Recv() (*ServerReflectionRe
return m, nil
}
// Server API for ServerReflection service
// ServerReflectionServer is the server API for ServerReflection service.
type ServerReflectionServer interface {
// The reflection service is structured as a bidirectional stream, ensuring
// all related requests go to a single server.
@ -715,9 +875,11 @@ var _ServerReflection_serviceDesc = grpc.ServiceDesc{
Metadata: "grpc_reflection_v1alpha/reflection.proto",
}
func init() { proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor0) }
func init() {
proto.RegisterFile("grpc_reflection_v1alpha/reflection.proto", fileDescriptor_reflection_178bd1e101bf8b63)
}
var fileDescriptor0 = []byte{
var fileDescriptor_reflection_178bd1e101bf8b63 = []byte{
// 656 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x51, 0x73, 0xd2, 0x40,
0x10, 0x6e, 0x5a, 0x68, 0x87, 0x85, 0x02, 0x5e, 0x2b, 0xa4, 0x3a, 0x75, 0x98, 0x68, 0x35, 0x75,

View File

@ -72,21 +72,21 @@ message ExtensionRequest {
message ServerReflectionResponse {
string valid_host = 1;
ServerReflectionRequest original_request = 2;
// The server set one of the following fields according to the message_request
// in the request.
// 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
// 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 requst.
// 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 request.
// This message is used to answer list_services requests.
ListServiceResponse list_services_response = 6;
// This message is used when an error occurs.

View File

@ -1,22 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto2.proto
/*
Package grpc_testing is a generated protocol buffer package.
It is generated from these files:
proto2.proto
proto2_ext.proto
proto2_ext2.proto
test.proto
It has these top-level messages:
ToBeExtended
Extension
AnotherExtension
SearchResponse
SearchRequest
*/
package grpc_testing
import proto "github.com/golang/protobuf/proto"
@ -35,23 +19,44 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type ToBeExtended struct {
Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"`
Foo *int32 `protobuf:"varint,1,req,name=foo" json:"foo,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
proto.XXX_InternalExtensions `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ToBeExtended) Reset() { *m = ToBeExtended{} }
func (m *ToBeExtended) String() string { return proto.CompactTextString(m) }
func (*ToBeExtended) ProtoMessage() {}
func (*ToBeExtended) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ToBeExtended) Reset() { *m = ToBeExtended{} }
func (m *ToBeExtended) String() string { return proto.CompactTextString(m) }
func (*ToBeExtended) ProtoMessage() {}
func (*ToBeExtended) Descriptor() ([]byte, []int) {
return fileDescriptor_proto2_b16f7a513d0acdc0, []int{0}
}
var extRange_ToBeExtended = []proto.ExtensionRange{
{10, 30},
{Start: 10, End: 30},
}
func (*ToBeExtended) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_ToBeExtended
}
func (m *ToBeExtended) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ToBeExtended.Unmarshal(m, b)
}
func (m *ToBeExtended) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ToBeExtended.Marshal(b, m, deterministic)
}
func (dst *ToBeExtended) XXX_Merge(src proto.Message) {
xxx_messageInfo_ToBeExtended.Merge(dst, src)
}
func (m *ToBeExtended) XXX_Size() int {
return xxx_messageInfo_ToBeExtended.Size(m)
}
func (m *ToBeExtended) XXX_DiscardUnknown() {
xxx_messageInfo_ToBeExtended.DiscardUnknown(m)
}
var xxx_messageInfo_ToBeExtended proto.InternalMessageInfo
func (m *ToBeExtended) GetFoo() int32 {
if m != nil && m.Foo != nil {
@ -64,9 +69,9 @@ func init() {
proto.RegisterType((*ToBeExtended)(nil), "grpc.testing.ToBeExtended")
}
func init() { proto.RegisterFile("proto2.proto", fileDescriptor0) }
func init() { proto.RegisterFile("proto2.proto", fileDescriptor_proto2_b16f7a513d0acdc0) }
var fileDescriptor0 = []byte{
var fileDescriptor_proto2_b16f7a513d0acdc0 = []byte{
// 86 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x28, 0xca, 0x2f,
0xc9, 0x37, 0xd2, 0x03, 0x53, 0x42, 0x3c, 0xe9, 0x45, 0x05, 0xc9, 0x7a, 0x25, 0xa9, 0xc5, 0x25,

View File

@ -12,15 +12,42 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Extension struct {
Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"`
XXX_unrecognized []byte `json:"-"`
Whatzit *int32 `protobuf:"varint,1,opt,name=whatzit" json:"whatzit,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Extension) Reset() { *m = Extension{} }
func (m *Extension) String() string { return proto.CompactTextString(m) }
func (*Extension) ProtoMessage() {}
func (*Extension) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
func (m *Extension) Reset() { *m = Extension{} }
func (m *Extension) String() string { return proto.CompactTextString(m) }
func (*Extension) ProtoMessage() {}
func (*Extension) Descriptor() ([]byte, []int) {
return fileDescriptor_proto2_ext_4437118420d604f2, []int{0}
}
func (m *Extension) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Extension.Unmarshal(m, b)
}
func (m *Extension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Extension.Marshal(b, m, deterministic)
}
func (dst *Extension) XXX_Merge(src proto.Message) {
xxx_messageInfo_Extension.Merge(dst, src)
}
func (m *Extension) XXX_Size() int {
return xxx_messageInfo_Extension.Size(m)
}
func (m *Extension) XXX_DiscardUnknown() {
xxx_messageInfo_Extension.DiscardUnknown(m)
}
var xxx_messageInfo_Extension proto.InternalMessageInfo
func (m *Extension) GetWhatzit() int32 {
if m != nil && m.Whatzit != nil {
@ -63,9 +90,9 @@ func init() {
proto.RegisterExtension(E_Baz)
}
func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor1) }
func init() { proto.RegisterFile("proto2_ext.proto", fileDescriptor_proto2_ext_4437118420d604f2) }
var fileDescriptor1 = []byte{
var fileDescriptor_proto2_ext_4437118420d604f2 = []byte{
// 179 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x28, 0x28, 0xca, 0x2f,
0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0xd1, 0x03, 0x33, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92, 0xf5,

View File

@ -12,15 +12,42 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AnotherExtension struct {
Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"`
XXX_unrecognized []byte `json:"-"`
Whatchamacallit *int32 `protobuf:"varint,1,opt,name=whatchamacallit" json:"whatchamacallit,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AnotherExtension) Reset() { *m = AnotherExtension{} }
func (m *AnotherExtension) String() string { return proto.CompactTextString(m) }
func (*AnotherExtension) ProtoMessage() {}
func (*AnotherExtension) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
func (m *AnotherExtension) Reset() { *m = AnotherExtension{} }
func (m *AnotherExtension) String() string { return proto.CompactTextString(m) }
func (*AnotherExtension) ProtoMessage() {}
func (*AnotherExtension) Descriptor() ([]byte, []int) {
return fileDescriptor_proto2_ext2_039d342873655470, []int{0}
}
func (m *AnotherExtension) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AnotherExtension.Unmarshal(m, b)
}
func (m *AnotherExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AnotherExtension.Marshal(b, m, deterministic)
}
func (dst *AnotherExtension) XXX_Merge(src proto.Message) {
xxx_messageInfo_AnotherExtension.Merge(dst, src)
}
func (m *AnotherExtension) XXX_Size() int {
return xxx_messageInfo_AnotherExtension.Size(m)
}
func (m *AnotherExtension) XXX_DiscardUnknown() {
xxx_messageInfo_AnotherExtension.DiscardUnknown(m)
}
var xxx_messageInfo_AnotherExtension proto.InternalMessageInfo
func (m *AnotherExtension) GetWhatchamacallit() int32 {
if m != nil && m.Whatchamacallit != nil {
@ -53,9 +80,9 @@ func init() {
proto.RegisterExtension(E_Nitz)
}
func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor2) }
func init() { proto.RegisterFile("proto2_ext2.proto", fileDescriptor_proto2_ext2_039d342873655470) }
var fileDescriptor2 = []byte{
var fileDescriptor_proto2_ext2_039d342873655470 = []byte{
// 165 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2c, 0x28, 0xca, 0x2f,
0xc9, 0x37, 0x8a, 0x4f, 0xad, 0x28, 0x31, 0xd2, 0x03, 0xb3, 0x85, 0x78, 0xd2, 0x8b, 0x0a, 0x92,

View File

@ -17,14 +17,42 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type SearchResponse struct {
Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
Results []*SearchResponse_Result `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SearchResponse) Reset() { *m = SearchResponse{} }
func (m *SearchResponse) String() string { return proto.CompactTextString(m) }
func (*SearchResponse) ProtoMessage() {}
func (*SearchResponse) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0} }
func (m *SearchResponse) Reset() { *m = SearchResponse{} }
func (m *SearchResponse) String() string { return proto.CompactTextString(m) }
func (*SearchResponse) ProtoMessage() {}
func (*SearchResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_test_a0c753075da50dd4, []int{0}
}
func (m *SearchResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchResponse.Unmarshal(m, b)
}
func (m *SearchResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SearchResponse.Marshal(b, m, deterministic)
}
func (dst *SearchResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SearchResponse.Merge(dst, src)
}
func (m *SearchResponse) XXX_Size() int {
return xxx_messageInfo_SearchResponse.Size(m)
}
func (m *SearchResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SearchResponse.DiscardUnknown(m)
}
var xxx_messageInfo_SearchResponse proto.InternalMessageInfo
func (m *SearchResponse) GetResults() []*SearchResponse_Result {
if m != nil {
@ -34,15 +62,37 @@ func (m *SearchResponse) GetResults() []*SearchResponse_Result {
}
type SearchResponse_Result struct {
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
Snippets []string `protobuf:"bytes,3,rep,name=snippets" json:"snippets,omitempty"`
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Snippets []string `protobuf:"bytes,3,rep,name=snippets,proto3" json:"snippets,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} }
func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) }
func (*SearchResponse_Result) ProtoMessage() {}
func (*SearchResponse_Result) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{0, 0} }
func (m *SearchResponse_Result) Reset() { *m = SearchResponse_Result{} }
func (m *SearchResponse_Result) String() string { return proto.CompactTextString(m) }
func (*SearchResponse_Result) ProtoMessage() {}
func (*SearchResponse_Result) Descriptor() ([]byte, []int) {
return fileDescriptor_test_a0c753075da50dd4, []int{0, 0}
}
func (m *SearchResponse_Result) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchResponse_Result.Unmarshal(m, b)
}
func (m *SearchResponse_Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SearchResponse_Result.Marshal(b, m, deterministic)
}
func (dst *SearchResponse_Result) XXX_Merge(src proto.Message) {
xxx_messageInfo_SearchResponse_Result.Merge(dst, src)
}
func (m *SearchResponse_Result) XXX_Size() int {
return xxx_messageInfo_SearchResponse_Result.Size(m)
}
func (m *SearchResponse_Result) XXX_DiscardUnknown() {
xxx_messageInfo_SearchResponse_Result.DiscardUnknown(m)
}
var xxx_messageInfo_SearchResponse_Result proto.InternalMessageInfo
func (m *SearchResponse_Result) GetUrl() string {
if m != nil {
@ -66,13 +116,35 @@ func (m *SearchResponse_Result) GetSnippets() []string {
}
type SearchRequest struct {
Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"`
Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SearchRequest) Reset() { *m = SearchRequest{} }
func (m *SearchRequest) String() string { return proto.CompactTextString(m) }
func (*SearchRequest) ProtoMessage() {}
func (*SearchRequest) Descriptor() ([]byte, []int) { return fileDescriptor3, []int{1} }
func (m *SearchRequest) Reset() { *m = SearchRequest{} }
func (m *SearchRequest) String() string { return proto.CompactTextString(m) }
func (*SearchRequest) ProtoMessage() {}
func (*SearchRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_test_a0c753075da50dd4, []int{1}
}
func (m *SearchRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchRequest.Unmarshal(m, b)
}
func (m *SearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SearchRequest.Marshal(b, m, deterministic)
}
func (dst *SearchRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SearchRequest.Merge(dst, src)
}
func (m *SearchRequest) XXX_Size() int {
return xxx_messageInfo_SearchRequest.Size(m)
}
func (m *SearchRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SearchRequest.DiscardUnknown(m)
}
var xxx_messageInfo_SearchRequest proto.InternalMessageInfo
func (m *SearchRequest) GetQuery() string {
if m != nil {
@ -95,8 +167,9 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for SearchService service
// SearchServiceClient is the client API for SearchService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type SearchServiceClient interface {
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error)
@ -112,7 +185,7 @@ func NewSearchServiceClient(cc *grpc.ClientConn) SearchServiceClient {
func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error) {
out := new(SearchResponse)
err := grpc.Invoke(ctx, "/grpc.testing.SearchService/Search", in, out, c.cc, opts...)
err := c.cc.Invoke(ctx, "/grpc.testing.SearchService/Search", in, out, opts...)
if err != nil {
return nil, err
}
@ -120,7 +193,7 @@ func (c *searchServiceClient) Search(ctx context.Context, in *SearchRequest, opt
}
func (c *searchServiceClient) StreamingSearch(ctx context.Context, opts ...grpc.CallOption) (SearchService_StreamingSearchClient, error) {
stream, err := grpc.NewClientStream(ctx, &_SearchService_serviceDesc.Streams[0], c.cc, "/grpc.testing.SearchService/StreamingSearch", opts...)
stream, err := c.cc.NewStream(ctx, &_SearchService_serviceDesc.Streams[0], "/grpc.testing.SearchService/StreamingSearch", opts...)
if err != nil {
return nil, err
}
@ -150,8 +223,7 @@ func (x *searchServiceStreamingSearchClient) Recv() (*SearchResponse, error) {
return m, nil
}
// Server API for SearchService service
// SearchServiceServer is the server API for SearchService service.
type SearchServiceServer interface {
Search(context.Context, *SearchRequest) (*SearchResponse, error)
StreamingSearch(SearchService_StreamingSearchServer) error
@ -225,9 +297,9 @@ var _SearchService_serviceDesc = grpc.ServiceDesc{
Metadata: "test.proto",
}
func init() { proto.RegisterFile("test.proto", fileDescriptor3) }
func init() { proto.RegisterFile("test.proto", fileDescriptor_test_a0c753075da50dd4) }
var fileDescriptor3 = []byte{
var fileDescriptor_test_a0c753075da50dd4 = []byte{
// 231 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x91, 0xbd, 0x4a, 0xc5, 0x40,
0x10, 0x85, 0x59, 0x83, 0xd1, 0x3b, 0xfe, 0x32, 0x58, 0x84, 0x68, 0x11, 0xae, 0x08, 0xa9, 0x16,

View File

@ -34,8 +34,33 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type SearchResponseV3_State int32
const (
SearchResponseV3_UNKNOWN SearchResponseV3_State = 0
SearchResponseV3_FRESH SearchResponseV3_State = 1
SearchResponseV3_STALE SearchResponseV3_State = 2
)
var SearchResponseV3_State_name = map[int32]string{
0: "UNKNOWN",
1: "FRESH",
2: "STALE",
}
var SearchResponseV3_State_value = map[string]int32{
"UNKNOWN": 0,
"FRESH": 1,
"STALE": 2,
}
func (x SearchResponseV3_State) String() string {
return proto.EnumName(SearchResponseV3_State_name, int32(x))
}
func (SearchResponseV3_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
type SearchResponseV3 struct {
Results []*SearchResponseV3_Result `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
State SearchResponseV3_State `protobuf:"varint,2,opt,name=state,enum=grpc.testingv3.SearchResponseV3_State" json:"state,omitempty"`
}
func (m *SearchResponseV3) Reset() { *m = SearchResponseV3{} }
@ -50,10 +75,18 @@ func (m *SearchResponseV3) GetResults() []*SearchResponseV3_Result {
return nil
}
func (m *SearchResponseV3) GetState() SearchResponseV3_State {
if m != nil {
return m.State
}
return SearchResponseV3_UNKNOWN
}
type SearchResponseV3_Result struct {
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
Snippets []string `protobuf:"bytes,3,rep,name=snippets" json:"snippets,omitempty"`
Url string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
Snippets []string `protobuf:"bytes,3,rep,name=snippets" json:"snippets,omitempty"`
Metadata map[string]*SearchResponseV3_Result_Value `protobuf:"bytes,4,rep,name=metadata" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *SearchResponseV3_Result) Reset() { *m = SearchResponseV3_Result{} }
@ -61,6 +94,174 @@ func (m *SearchResponseV3_Result) String() string { return proto.Comp
func (*SearchResponseV3_Result) ProtoMessage() {}
func (*SearchResponseV3_Result) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} }
func (m *SearchResponseV3_Result) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *SearchResponseV3_Result) GetTitle() string {
if m != nil {
return m.Title
}
return ""
}
func (m *SearchResponseV3_Result) GetSnippets() []string {
if m != nil {
return m.Snippets
}
return nil
}
func (m *SearchResponseV3_Result) GetMetadata() map[string]*SearchResponseV3_Result_Value {
if m != nil {
return m.Metadata
}
return nil
}
type SearchResponseV3_Result_Value struct {
// Types that are valid to be assigned to Val:
// *SearchResponseV3_Result_Value_Str
// *SearchResponseV3_Result_Value_Int
// *SearchResponseV3_Result_Value_Real
Val isSearchResponseV3_Result_Value_Val `protobuf_oneof:"val"`
}
func (m *SearchResponseV3_Result_Value) Reset() { *m = SearchResponseV3_Result_Value{} }
func (m *SearchResponseV3_Result_Value) String() string { return proto.CompactTextString(m) }
func (*SearchResponseV3_Result_Value) ProtoMessage() {}
func (*SearchResponseV3_Result_Value) Descriptor() ([]byte, []int) {
return fileDescriptor0, []int{0, 0, 0}
}
type isSearchResponseV3_Result_Value_Val interface {
isSearchResponseV3_Result_Value_Val()
}
type SearchResponseV3_Result_Value_Str struct {
Str string `protobuf:"bytes,1,opt,name=str,oneof"`
}
type SearchResponseV3_Result_Value_Int struct {
Int int64 `protobuf:"varint,2,opt,name=int,oneof"`
}
type SearchResponseV3_Result_Value_Real struct {
Real float64 `protobuf:"fixed64,3,opt,name=real,oneof"`
}
func (*SearchResponseV3_Result_Value_Str) isSearchResponseV3_Result_Value_Val() {}
func (*SearchResponseV3_Result_Value_Int) isSearchResponseV3_Result_Value_Val() {}
func (*SearchResponseV3_Result_Value_Real) isSearchResponseV3_Result_Value_Val() {}
func (m *SearchResponseV3_Result_Value) GetVal() isSearchResponseV3_Result_Value_Val {
if m != nil {
return m.Val
}
return nil
}
func (m *SearchResponseV3_Result_Value) GetStr() string {
if x, ok := m.GetVal().(*SearchResponseV3_Result_Value_Str); ok {
return x.Str
}
return ""
}
func (m *SearchResponseV3_Result_Value) GetInt() int64 {
if x, ok := m.GetVal().(*SearchResponseV3_Result_Value_Int); ok {
return x.Int
}
return 0
}
func (m *SearchResponseV3_Result_Value) GetReal() float64 {
if x, ok := m.GetVal().(*SearchResponseV3_Result_Value_Real); ok {
return x.Real
}
return 0
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*SearchResponseV3_Result_Value) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _SearchResponseV3_Result_Value_OneofMarshaler, _SearchResponseV3_Result_Value_OneofUnmarshaler, _SearchResponseV3_Result_Value_OneofSizer, []interface{}{
(*SearchResponseV3_Result_Value_Str)(nil),
(*SearchResponseV3_Result_Value_Int)(nil),
(*SearchResponseV3_Result_Value_Real)(nil),
}
}
func _SearchResponseV3_Result_Value_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*SearchResponseV3_Result_Value)
// val
switch x := m.Val.(type) {
case *SearchResponseV3_Result_Value_Str:
b.EncodeVarint(1<<3 | proto.WireBytes)
b.EncodeStringBytes(x.Str)
case *SearchResponseV3_Result_Value_Int:
b.EncodeVarint(2<<3 | proto.WireVarint)
b.EncodeVarint(uint64(x.Int))
case *SearchResponseV3_Result_Value_Real:
b.EncodeVarint(3<<3 | proto.WireFixed64)
b.EncodeFixed64(math.Float64bits(x.Real))
case nil:
default:
return fmt.Errorf("SearchResponseV3_Result_Value.Val has unexpected type %T", x)
}
return nil
}
func _SearchResponseV3_Result_Value_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*SearchResponseV3_Result_Value)
switch tag {
case 1: // val.str
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.Val = &SearchResponseV3_Result_Value_Str{x}
return true, err
case 2: // val.int
if wire != proto.WireVarint {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeVarint()
m.Val = &SearchResponseV3_Result_Value_Int{int64(x)}
return true, err
case 3: // val.real
if wire != proto.WireFixed64 {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeFixed64()
m.Val = &SearchResponseV3_Result_Value_Real{math.Float64frombits(x)}
return true, err
default:
return false, nil
}
}
func _SearchResponseV3_Result_Value_OneofSizer(msg proto.Message) (n int) {
m := msg.(*SearchResponseV3_Result_Value)
// val
switch x := m.Val.(type) {
case *SearchResponseV3_Result_Value_Str:
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Str)))
n += len(x.Str)
case *SearchResponseV3_Result_Value_Int:
n += proto.SizeVarint(2<<3 | proto.WireVarint)
n += proto.SizeVarint(uint64(x.Int))
case *SearchResponseV3_Result_Value_Real:
n += proto.SizeVarint(3<<3 | proto.WireFixed64)
n += 8
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
type SearchRequestV3 struct {
Query string `protobuf:"bytes,1,opt,name=query" json:"query,omitempty"`
}
@ -70,10 +271,19 @@ func (m *SearchRequestV3) String() string { return proto.CompactTextS
func (*SearchRequestV3) ProtoMessage() {}
func (*SearchRequestV3) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (m *SearchRequestV3) GetQuery() string {
if m != nil {
return m.Query
}
return ""
}
func init() {
proto.RegisterType((*SearchResponseV3)(nil), "grpc.testingv3.SearchResponseV3")
proto.RegisterType((*SearchResponseV3_Result)(nil), "grpc.testingv3.SearchResponseV3.Result")
proto.RegisterType((*SearchResponseV3_Result_Value)(nil), "grpc.testingv3.SearchResponseV3.Result.Value")
proto.RegisterType((*SearchRequestV3)(nil), "grpc.testingv3.SearchRequestV3")
proto.RegisterEnum("grpc.testingv3.SearchResponseV3_State", SearchResponseV3_State_name, SearchResponseV3_State_value)
}
// Reference imports to suppress errors if they are not otherwise used.
@ -217,20 +427,31 @@ var _SearchServiceV3_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("testv3.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 240 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x91, 0x41, 0x4b, 0xc3, 0x40,
0x10, 0x85, 0x59, 0x83, 0xd1, 0x8e, 0x62, 0xcb, 0xe2, 0x21, 0xe4, 0x62, 0xe8, 0xa5, 0x39, 0x2d,
0xd2, 0xfd, 0x05, 0x9e, 0xf5, 0xb4, 0x81, 0xe2, 0xb5, 0x86, 0x21, 0x2e, 0xc4, 0x64, 0x3b, 0x33,
0x09, 0xf8, 0x7b, 0xfc, 0x13, 0xfe, 0x3c, 0x49, 0xd2, 0x08, 0x0a, 0xe2, 0xa5, 0xb7, 0x7d, 0x8f,
0xf7, 0xbe, 0xe5, 0x31, 0x70, 0x2d, 0xc8, 0xd2, 0x5b, 0x13, 0xa8, 0x95, 0x56, 0xdf, 0x54, 0x14,
0x4a, 0x33, 0x58, 0xbe, 0xa9, 0x7a, 0xbb, 0xfe, 0x50, 0xb0, 0x2a, 0x70, 0x4f, 0xe5, 0xab, 0x43,
0x0e, 0x6d, 0xc3, 0xb8, 0xb3, 0xfa, 0x01, 0x2e, 0x08, 0xb9, 0xab, 0x85, 0x13, 0x95, 0x45, 0xf9,
0xd5, 0x76, 0x63, 0x7e, 0xd6, 0xcc, 0xef, 0x8a, 0x71, 0x63, 0xde, 0xcd, 0xbd, 0xf4, 0x09, 0xe2,
0xc9, 0xd2, 0x2b, 0x88, 0x3a, 0xaa, 0x13, 0x95, 0xa9, 0x7c, 0xe1, 0x86, 0xa7, 0xbe, 0x85, 0x73,
0xf1, 0x52, 0x63, 0x72, 0x36, 0x7a, 0x93, 0xd0, 0x29, 0x5c, 0x72, 0xe3, 0x43, 0x40, 0xe1, 0x24,
0xca, 0xa2, 0x7c, 0xe1, 0xbe, 0xf5, 0x7a, 0x03, 0xcb, 0xf9, 0xc7, 0x43, 0x87, 0x2c, 0x3b, 0x3b,
0x40, 0x0e, 0x1d, 0xd2, 0xfb, 0x11, 0x3c, 0x89, 0xed, 0xa7, 0x9a, 0x93, 0x05, 0x52, 0xef, 0xcb,
0x61, 0xcd, 0x23, 0xc4, 0x93, 0xa5, 0xef, 0xfe, 0x9a, 0x71, 0x84, 0xa6, 0xd9, 0x7f, 0x3b, 0xf5,
0x33, 0x2c, 0x0b, 0x21, 0xdc, 0xbf, 0xf9, 0xa6, 0x3a, 0x19, 0x35, 0x57, 0xf7, 0xea, 0x25, 0x1e,
0x0f, 0x64, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd4, 0xe6, 0xa0, 0xf9, 0xb0, 0x01, 0x00, 0x00,
// 416 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0xd1, 0x6a, 0xd4, 0x40,
0x14, 0x86, 0x77, 0x36, 0x9b, 0x6d, 0xf7, 0xac, 0xb6, 0x61, 0xe8, 0x45, 0xc8, 0x8d, 0x61, 0x2f,
0x6c, 0x10, 0x0c, 0x92, 0x20, 0x88, 0x78, 0x53, 0x65, 0x65, 0xa1, 0x75, 0xc5, 0x89, 0xae, 0xde,
0x8e, 0xeb, 0x61, 0x8d, 0x4d, 0xb3, 0xe9, 0xcc, 0x49, 0x60, 0x9f, 0xc5, 0x17, 0xf1, 0x55, 0x7c,
0x1b, 0x99, 0x99, 0xa6, 0x50, 0x41, 0xba, 0x17, 0xde, 0xcd, 0x7f, 0x38, 0xff, 0x37, 0xff, 0x3f,
0x24, 0xf0, 0x80, 0x50, 0x53, 0x97, 0xa7, 0x8d, 0xda, 0xd2, 0x96, 0x1f, 0x6d, 0x54, 0xb3, 0x4e,
0xcd, 0xa8, 0xac, 0x37, 0x5d, 0x3e, 0xfb, 0x39, 0x82, 0xa0, 0x40, 0xa9, 0xd6, 0xdf, 0x05, 0xea,
0x66, 0x5b, 0x6b, 0x5c, 0xe5, 0xfc, 0x0c, 0x0e, 0x14, 0xea, 0xb6, 0x22, 0x1d, 0xb2, 0xd8, 0x4b,
0xa6, 0xd9, 0x69, 0x7a, 0xd7, 0x96, 0xfe, 0x6d, 0x49, 0x85, 0xdd, 0x17, 0xbd, 0x8f, 0xbf, 0x02,
0x5f, 0x93, 0x24, 0x0c, 0x87, 0x31, 0x4b, 0x8e, 0xb2, 0xc7, 0xf7, 0x02, 0x0a, 0xb3, 0x2d, 0x9c,
0x29, 0xfa, 0x3d, 0x84, 0xb1, 0x23, 0xf2, 0x00, 0xbc, 0x56, 0x55, 0x21, 0x8b, 0x59, 0x32, 0x11,
0xe6, 0xc8, 0x4f, 0xc0, 0xa7, 0x92, 0x2a, 0x87, 0x9e, 0x08, 0x27, 0x78, 0x04, 0x87, 0xba, 0x2e,
0x9b, 0x06, 0x49, 0x87, 0x5e, 0xec, 0x25, 0x13, 0x71, 0xab, 0xf9, 0x07, 0x38, 0xbc, 0x42, 0x92,
0xdf, 0x24, 0xc9, 0x70, 0x64, 0x0b, 0x3d, 0xdf, 0xb3, 0x50, 0xfa, 0xee, 0xc6, 0x37, 0xaf, 0x49,
0xed, 0xc4, 0x2d, 0x26, 0xba, 0x00, 0x7f, 0x25, 0xab, 0x16, 0x39, 0x07, 0x4f, 0x93, 0x72, 0xf9,
0x16, 0x03, 0x61, 0x84, 0x99, 0x95, 0x35, 0xd9, 0x7c, 0x9e, 0x99, 0x95, 0x35, 0xf1, 0x13, 0x18,
0x29, 0x94, 0x55, 0xe8, 0xc5, 0x2c, 0x61, 0x8b, 0x81, 0xb0, 0xea, 0xb5, 0x0f, 0x5e, 0x27, 0xab,
0xe8, 0x07, 0x3c, 0xbc, 0x73, 0x91, 0x69, 0x7d, 0x89, 0xbb, 0xbe, 0xf5, 0x25, 0xee, 0xf8, 0x1b,
0xf0, 0x3b, 0x73, 0xa1, 0xa5, 0x4e, 0xb3, 0xa7, 0xfb, 0x16, 0xb0, 0x29, 0x85, 0xf3, 0xbe, 0x1c,
0xbe, 0x60, 0xb3, 0x27, 0xe0, 0xdb, 0xb7, 0xe6, 0x53, 0x38, 0xf8, 0xb4, 0x3c, 0x5f, 0xbe, 0xff,
0xbc, 0x0c, 0x06, 0x7c, 0x02, 0xfe, 0x5b, 0x31, 0x2f, 0x16, 0x01, 0x33, 0xc7, 0xe2, 0xe3, 0xd9,
0xc5, 0x3c, 0x18, 0xce, 0x4e, 0xe1, 0xb8, 0xe7, 0x5e, 0xb7, 0xa8, 0x69, 0x95, 0x9b, 0xd7, 0xbf,
0x6e, 0x51, 0xf5, 0xd9, 0x9c, 0xc8, 0x7e, 0xb1, 0x7e, 0xb3, 0x40, 0xd5, 0x95, 0x6b, 0xf3, 0x15,
0x9d, 0xc3, 0xd8, 0x8d, 0xf8, 0xa3, 0x7f, 0x85, 0xbd, 0x81, 0x46, 0xf1, 0x7d, 0x6d, 0xf8, 0x17,
0x38, 0x2e, 0x48, 0xa1, 0xbc, 0x2a, 0xeb, 0xcd, 0x7f, 0xa3, 0x26, 0xec, 0x19, 0xfb, 0x3a, 0xb6,
0x3f, 0x46, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0xed, 0xa2, 0x8d, 0x75, 0x28, 0x03, 0x00, 0x00,
}

View File

@ -7,8 +7,22 @@ message SearchResponseV3 {
string url = 1;
string title = 2;
repeated string snippets = 3;
message Value {
oneof val {
string str = 1;
int64 int = 2;
double real = 3;
}
}
map<string, Value> metadata = 4;
}
enum State {
UNKNOWN = 0;
FRESH = 1;
STALE = 2;
}
repeated Result results = 1;
State state = 2;
}
message SearchRequestV3 {

View File

@ -45,7 +45,8 @@ import (
"io"
"io/ioutil"
"reflect"
"strings"
"sort"
"sync"
"github.com/golang/protobuf/proto"
dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
@ -57,8 +58,10 @@ import (
type serverReflectionServer struct {
s *grpc.Server
// TODO add more cache if necessary
serviceInfo map[string]grpc.ServiceInfo // cache for s.GetServiceInfo()
initSymbols sync.Once
serviceNames []string
symbols map[string]*dpb.FileDescriptorProto // map of fully-qualified names to files
}
// Register registers the server reflection service on the given gRPC server.
@ -76,6 +79,112 @@ type protoMessage interface {
Descriptor() ([]byte, []int)
}
func (s *serverReflectionServer) 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 *serverReflectionServer) 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 *serverReflectionServer) 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 *serverReflectionServer) 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 *serverReflectionServer) 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 *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDescriptorProto, error) {
@ -85,12 +194,12 @@ func (s *serverReflectionServer) fileDescForType(st reflect.Type) (*dpb.FileDesc
}
enc, _ := m.Descriptor()
return s.decodeFileDesc(enc)
return decodeFileDesc(enc)
}
// decodeFileDesc does decompression and unmarshalling on the given
// file descriptor byte slice.
func (s *serverReflectionServer) decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
raw, err := decompress(enc)
if err != nil {
return nil, fmt.Errorf("failed to decompress enc: %v", err)
@ -116,7 +225,7 @@ func decompress(b []byte) ([]byte, error) {
return out, nil
}
func (s *serverReflectionServer) typeForName(name string) (reflect.Type, error) {
func typeForName(name string) (reflect.Type, error) {
pt := proto.MessageType(name)
if pt == nil {
return nil, fmt.Errorf("unknown type: %q", name)
@ -126,7 +235,7 @@ func (s *serverReflectionServer) typeForName(name string) (reflect.Type, error)
return st, nil
}
func (s *serverReflectionServer) fileDescContainingExtension(st reflect.Type, ext int32) (*dpb.FileDescriptorProto, error) {
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)
@ -144,7 +253,7 @@ func (s *serverReflectionServer) fileDescContainingExtension(st reflect.Type, ex
return nil, fmt.Errorf("failed to find registered extension for extension number %v", ext)
}
return s.decodeFileDesc(proto.FileDescriptor(extDesc.Filename))
return decodeFileDesc(proto.FileDescriptor(extDesc.Filename))
}
func (s *serverReflectionServer) allExtensionNumbersForType(st reflect.Type) ([]int32, error) {
@ -168,53 +277,13 @@ func (s *serverReflectionServer) fileDescEncodingByFilename(name string) ([]byte
if enc == nil {
return nil, fmt.Errorf("unknown file: %v", name)
}
fd, err := s.decodeFileDesc(enc)
fd, err := decodeFileDesc(enc)
if err != nil {
return nil, err
}
return proto.Marshal(fd)
}
// serviceMetadataForSymbol finds the metadata for name in s.serviceInfo.
// name should be a service name or a method name.
func (s *serverReflectionServer) serviceMetadataForSymbol(name string) (interface{}, error) {
if s.serviceInfo == nil {
s.serviceInfo = s.s.GetServiceInfo()
}
// Check if it's a service name.
if info, ok := s.serviceInfo[name]; ok {
return info.Metadata, nil
}
// Check if it's a method name.
pos := strings.LastIndex(name, ".")
// Not a valid method name.
if pos == -1 {
return nil, fmt.Errorf("unknown symbol: %v", name)
}
info, ok := s.serviceInfo[name[:pos]]
// Substring before last "." is not a service name.
if !ok {
return nil, fmt.Errorf("unknown symbol: %v", name)
}
// Search the method name in info.Methods.
var found bool
for _, m := range info.Methods {
if m.Name == name[pos+1:] {
found = true
break
}
}
if found {
return info.Metadata, nil
}
return nil, fmt.Errorf("unknown symbol: %v", name)
}
// 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.
@ -237,33 +306,21 @@ func parseMetadata(meta interface{}) ([]byte, bool) {
// does marshalling on it and returns the marshalled result.
// The given symbol can be a type, a service or a method.
func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) ([]byte, error) {
var (
fd *dpb.FileDescriptorProto
)
// Check if it's a type name.
if st, err := s.typeForName(name); err == nil {
fd, err = s.fileDescForType(st)
if err != nil {
return nil, err
_, symbols := s.getSymbols()
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
}
}
} else { // Check if it's a service name or a method name.
meta, err := s.serviceMetadataForSymbol(name)
}
// Metadata not found.
if err != nil {
return nil, err
}
// Metadata not valid.
enc, ok := parseMetadata(meta)
if !ok {
return nil, fmt.Errorf("invalid file descriptor for symbol: %v", name)
}
fd, err = s.decodeFileDesc(enc)
if err != nil {
return nil, err
}
if fd == nil {
return nil, fmt.Errorf("unknown symbol: %v", name)
}
return proto.Marshal(fd)
@ -272,11 +329,11 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) (
// fileDescEncodingContainingExtension finds the file descriptor containing given extension,
// does marshalling on it and returns the marshalled result.
func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName string, extNum int32) ([]byte, error) {
st, err := s.typeForName(typeName)
st, err := typeForName(typeName)
if err != nil {
return nil, err
}
fd, err := s.fileDescContainingExtension(st, extNum)
fd, err := fileDescContainingExtension(st, extNum)
if err != nil {
return nil, err
}
@ -285,7 +342,7 @@ func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName st
// allExtensionNumbersForTypeName returns all extension numbers for the given type.
func (s *serverReflectionServer) allExtensionNumbersForTypeName(name string) ([]int32, error) {
st, err := s.typeForName(name)
st, err := typeForName(name)
if err != nil {
return nil, err
}
@ -374,14 +431,12 @@ func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflectio
}
}
case *rpb.ServerReflectionRequest_ListServices:
if s.serviceInfo == nil {
s.serviceInfo = s.s.GetServiceInfo()
}
serviceResponses := make([]*rpb.ServiceResponse, 0, len(s.serviceInfo))
for n := range s.serviceInfo {
serviceResponses = append(serviceResponses, &rpb.ServiceResponse{
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{

View File

@ -60,7 +60,7 @@ func loadFileDesc(filename string) (*dpb.FileDescriptorProto, []byte) {
if enc == nil {
panic(fmt.Sprintf("failed to find fd for file: %v", filename))
}
fd, err := s.decodeFileDesc(enc)
fd, err := decodeFileDesc(enc)
if err != nil {
panic(fmt.Sprintf("failed to decode enc: %v", err))
}
@ -101,7 +101,7 @@ func TestTypeForName(t *testing.T) {
}{
{"grpc.testing.SearchResponse", reflect.TypeOf(pb.SearchResponse{})},
} {
r, err := s.typeForName(test.name)
r, err := typeForName(test.name)
if err != nil || r != test.want {
t.Errorf("typeForName(%q) = %q, %v, want %q, <nil>", test.name, r, err, test.want)
}
@ -112,7 +112,7 @@ func TestTypeForNameNotFound(t *testing.T) {
for _, test := range []string{
"grpc.testing.not_exiting",
} {
_, err := s.typeForName(test)
_, err := typeForName(test)
if err == nil {
t.Errorf("typeForName(%q) = _, %v, want _, <non-nil>", test, err)
}
@ -131,7 +131,7 @@ func TestFileDescContainingExtension(t *testing.T) {
{reflect.TypeOf(pb.ToBeExtended{}), 23, fdProto2Ext2},
{reflect.TypeOf(pb.ToBeExtended{}), 29, fdProto2Ext2},
} {
fd, err := s.fileDescContainingExtension(test.st, test.extNum)
fd, err := fileDescContainingExtension(test.st, test.extNum)
if err != nil || !proto.Equal(fd, test.want) {
t.Errorf("fileDescContainingExtension(%q) = %q, %v, want %q, <nil>", test.st, fd, err, test.want)
}
@ -296,6 +296,12 @@ func testFileContainingSymbol(t *testing.T, stream rpb.ServerReflection_ServerRe
{"grpc.testingv3.SearchServiceV3.Search", fdTestv3Byte},
{"grpc.testingv3.SearchServiceV3.StreamingSearch", fdTestv3Byte},
{"grpc.testingv3.SearchResponseV3", fdTestv3Byte},
// search for field, oneof, enum, and enum value symbols, too
{"grpc.testingv3.SearchResponseV3.Result.snippets", fdTestv3Byte},
{"grpc.testingv3.SearchResponseV3.Result.Value.val", fdTestv3Byte},
{"grpc.testingv3.SearchResponseV3.Result.Value.str", fdTestv3Byte},
{"grpc.testingv3.SearchResponseV3.State", fdTestv3Byte},
{"grpc.testingv3.SearchResponseV3.State.FRESH", fdTestv3Byte},
} {
if err := stream.Send(&rpb.ServerReflectionRequest{
MessageRequest: &rpb.ServerReflectionRequest_FileContainingSymbol{