mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rebase: add replication-lib-utils to go.mod
added github.com/kube-storage/replication-lib-utils to the vendor directory which is required to avoid secret logging in GRPC. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
da840a70c5
commit
ce7f936551
1
vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
generated
vendored
1
vendor/google.golang.org/protobuf/reflect/protodesc/desc.go
generated
vendored
@ -144,6 +144,7 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot
|
||||
}
|
||||
|
||||
// Handle source locations.
|
||||
f.L2.Locations.File = f
|
||||
for _, loc := range fd.GetSourceCodeInfo().GetLocation() {
|
||||
var l protoreflect.SourceLocation
|
||||
// TODO: Validate that the path points to an actual declaration?
|
||||
|
4
vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
generated
vendored
4
vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go
generated
vendored
@ -135,7 +135,7 @@ func (r descsByName) initFieldsFromDescriptorProto(fds []*descriptorpb.FieldDesc
|
||||
f.L1.Kind = protoreflect.Kind(fd.GetType())
|
||||
}
|
||||
if fd.JsonName != nil {
|
||||
f.L1.JSONName.Init(fd.GetJsonName())
|
||||
f.L1.StringName.InitJSON(fd.GetJsonName())
|
||||
}
|
||||
}
|
||||
return fs, nil
|
||||
@ -175,7 +175,7 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript
|
||||
x.L1.Kind = protoreflect.Kind(xd.GetType())
|
||||
}
|
||||
if xd.JsonName != nil {
|
||||
x.L2.JSONName.Init(xd.GetJsonName())
|
||||
x.L2.StringName.InitJSON(xd.GetJsonName())
|
||||
}
|
||||
}
|
||||
return xs, nil
|
||||
|
3
vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
generated
vendored
3
vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go
generated
vendored
@ -239,6 +239,9 @@ func validateExtensionDeclarations(xs []filedesc.Extension, xds []*descriptorpb.
|
||||
return errors.New("extension field %q has an invalid cardinality: %d", x.FullName(), x.Cardinality())
|
||||
}
|
||||
if xd.JsonName != nil {
|
||||
// A bug in older versions of protoc would always populate the
|
||||
// "json_name" option for extensions when it is meaningless.
|
||||
// When it did so, it would always use the camel-cased field name.
|
||||
if xd.GetJsonName() != strs.JSONCamelCase(string(x.Name())) {
|
||||
return errors.New("extension field %q may not have an explicitly set JSON name: %q", x.FullName(), xd.GetJsonName())
|
||||
}
|
||||
|
14
vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
generated
vendored
14
vendor/google.golang.org/protobuf/reflect/protodesc/proto.go
generated
vendored
@ -9,6 +9,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"google.golang.org/protobuf/internal/encoding/defval"
|
||||
"google.golang.org/protobuf/internal/strs"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
|
||||
@ -20,9 +21,11 @@ import (
|
||||
func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {
|
||||
p := &descriptorpb.FileDescriptorProto{
|
||||
Name: proto.String(file.Path()),
|
||||
Package: proto.String(string(file.Package())),
|
||||
Options: proto.Clone(file.Options()).(*descriptorpb.FileOptions),
|
||||
}
|
||||
if file.Package() != "" {
|
||||
p.Package = proto.String(string(file.Package()))
|
||||
}
|
||||
for i, imports := 0, file.Imports(); i < imports.Len(); i++ {
|
||||
imp := imports.Get(i)
|
||||
p.Dependency = append(p.Dependency, imp.Path())
|
||||
@ -138,7 +141,14 @@ func ToFieldDescriptorProto(field protoreflect.FieldDescriptor) *descriptorpb.Fi
|
||||
p.TypeName = fullNameOf(field.Message())
|
||||
}
|
||||
if field.HasJSONName() {
|
||||
p.JsonName = proto.String(field.JSONName())
|
||||
// A bug in older versions of protoc would always populate the
|
||||
// "json_name" option for extensions when it is meaningless.
|
||||
// When it did so, it would always use the camel-cased field name.
|
||||
if field.IsExtension() {
|
||||
p.JsonName = proto.String(strs.JSONCamelCase(string(field.Name())))
|
||||
} else {
|
||||
p.JsonName = proto.String(field.JSONName())
|
||||
}
|
||||
}
|
||||
if field.Syntax() == protoreflect.Proto3 && field.HasOptionalKeyword() {
|
||||
p.Proto3Optional = proto.Bool(true)
|
||||
|
84
vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
generated
vendored
84
vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
generated
vendored
@ -4,6 +4,10 @@
|
||||
|
||||
package protoreflect
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// SourceLocations is a list of source locations.
|
||||
type SourceLocations interface {
|
||||
// Len reports the number of source locations in the proto file.
|
||||
@ -11,9 +15,20 @@ type SourceLocations interface {
|
||||
// Get returns the ith SourceLocation. It panics if out of bounds.
|
||||
Get(int) SourceLocation
|
||||
|
||||
doNotImplement
|
||||
// ByPath returns the SourceLocation for the given path,
|
||||
// returning the first location if multiple exist for the same path.
|
||||
// If multiple locations exist for the same path,
|
||||
// then SourceLocation.Next index can be used to identify the
|
||||
// index of the next SourceLocation.
|
||||
// If no location exists for this path, it returns the zero value.
|
||||
ByPath(path SourcePath) SourceLocation
|
||||
|
||||
// TODO: Add ByPath and ByDescriptor helper methods.
|
||||
// ByDescriptor returns the SourceLocation for the given descriptor,
|
||||
// returning the first location if multiple exist for the same path.
|
||||
// If no location exists for this descriptor, it returns the zero value.
|
||||
ByDescriptor(desc Descriptor) SourceLocation
|
||||
|
||||
doNotImplement
|
||||
}
|
||||
|
||||
// SourceLocation describes a source location and
|
||||
@ -39,6 +54,10 @@ type SourceLocation struct {
|
||||
LeadingComments string
|
||||
// TrailingComments is the trailing attached comment for the declaration.
|
||||
TrailingComments string
|
||||
|
||||
// Next is an index into SourceLocations for the next source location that
|
||||
// has the same Path. It is zero if there is no next location.
|
||||
Next int
|
||||
}
|
||||
|
||||
// SourcePath identifies part of a file descriptor for a source location.
|
||||
@ -48,5 +67,62 @@ type SourceLocation struct {
|
||||
// See google.protobuf.SourceCodeInfo.Location.path.
|
||||
type SourcePath []int32
|
||||
|
||||
// TODO: Add SourcePath.String method to pretty-print the path. For example:
|
||||
// ".message_type[6].nested_type[15].field[3]"
|
||||
// Equal reports whether p1 equals p2.
|
||||
func (p1 SourcePath) Equal(p2 SourcePath) bool {
|
||||
if len(p1) != len(p2) {
|
||||
return false
|
||||
}
|
||||
for i := range p1 {
|
||||
if p1[i] != p2[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// String formats the path in a humanly readable manner.
|
||||
// The output is guaranteed to be deterministic,
|
||||
// making it suitable for use as a key into a Go map.
|
||||
// It is not guaranteed to be stable as the exact output could change
|
||||
// in a future version of this module.
|
||||
//
|
||||
// Example output:
|
||||
// .message_type[6].nested_type[15].field[3]
|
||||
func (p SourcePath) String() string {
|
||||
b := p.appendFileDescriptorProto(nil)
|
||||
for _, i := range p {
|
||||
b = append(b, '.')
|
||||
b = strconv.AppendInt(b, int64(i), 10)
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
type appendFunc func(*SourcePath, []byte) []byte
|
||||
|
||||
func (p *SourcePath) appendSingularField(b []byte, name string, f appendFunc) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
b = append(b, '.')
|
||||
b = append(b, name...)
|
||||
*p = (*p)[1:]
|
||||
if f != nil {
|
||||
b = f(p, b)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendRepeatedField(b []byte, name string, f appendFunc) []byte {
|
||||
b = p.appendSingularField(b, name, nil)
|
||||
if len(*p) == 0 || (*p)[0] < 0 {
|
||||
return b
|
||||
}
|
||||
b = append(b, '[')
|
||||
b = strconv.AppendUint(b, uint64((*p)[0]), 10)
|
||||
b = append(b, ']')
|
||||
*p = (*p)[1:]
|
||||
if f != nil {
|
||||
b = f(p, b)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
461
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
Normal file
461
vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
generated
vendored
Normal file
@ -0,0 +1,461 @@
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Code generated by generate-protos. DO NOT EDIT.
|
||||
|
||||
package protoreflect
|
||||
|
||||
func (p *SourcePath) appendFileDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "package", nil)
|
||||
case 3:
|
||||
b = p.appendRepeatedField(b, "dependency", nil)
|
||||
case 10:
|
||||
b = p.appendRepeatedField(b, "public_dependency", nil)
|
||||
case 11:
|
||||
b = p.appendRepeatedField(b, "weak_dependency", nil)
|
||||
case 4:
|
||||
b = p.appendRepeatedField(b, "message_type", (*SourcePath).appendDescriptorProto)
|
||||
case 5:
|
||||
b = p.appendRepeatedField(b, "enum_type", (*SourcePath).appendEnumDescriptorProto)
|
||||
case 6:
|
||||
b = p.appendRepeatedField(b, "service", (*SourcePath).appendServiceDescriptorProto)
|
||||
case 7:
|
||||
b = p.appendRepeatedField(b, "extension", (*SourcePath).appendFieldDescriptorProto)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendFileOptions)
|
||||
case 9:
|
||||
b = p.appendSingularField(b, "source_code_info", (*SourcePath).appendSourceCodeInfo)
|
||||
case 12:
|
||||
b = p.appendSingularField(b, "syntax", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "field", (*SourcePath).appendFieldDescriptorProto)
|
||||
case 6:
|
||||
b = p.appendRepeatedField(b, "extension", (*SourcePath).appendFieldDescriptorProto)
|
||||
case 3:
|
||||
b = p.appendRepeatedField(b, "nested_type", (*SourcePath).appendDescriptorProto)
|
||||
case 4:
|
||||
b = p.appendRepeatedField(b, "enum_type", (*SourcePath).appendEnumDescriptorProto)
|
||||
case 5:
|
||||
b = p.appendRepeatedField(b, "extension_range", (*SourcePath).appendDescriptorProto_ExtensionRange)
|
||||
case 8:
|
||||
b = p.appendRepeatedField(b, "oneof_decl", (*SourcePath).appendOneofDescriptorProto)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendMessageOptions)
|
||||
case 9:
|
||||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendDescriptorProto_ReservedRange)
|
||||
case 10:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendEnumDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "value", (*SourcePath).appendEnumValueDescriptorProto)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendEnumOptions)
|
||||
case 4:
|
||||
b = p.appendRepeatedField(b, "reserved_range", (*SourcePath).appendEnumDescriptorProto_EnumReservedRange)
|
||||
case 5:
|
||||
b = p.appendRepeatedField(b, "reserved_name", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendServiceDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "method", (*SourcePath).appendMethodDescriptorProto)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendServiceOptions)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFieldDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "number", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "label", nil)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "type", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "type_name", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "extendee", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "default_value", nil)
|
||||
case 9:
|
||||
b = p.appendSingularField(b, "oneof_index", nil)
|
||||
case 10:
|
||||
b = p.appendSingularField(b, "json_name", nil)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendFieldOptions)
|
||||
case 17:
|
||||
b = p.appendSingularField(b, "proto3_optional", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFileOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "java_package", nil)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "java_outer_classname", nil)
|
||||
case 10:
|
||||
b = p.appendSingularField(b, "java_multiple_files", nil)
|
||||
case 20:
|
||||
b = p.appendSingularField(b, "java_generate_equals_and_hash", nil)
|
||||
case 27:
|
||||
b = p.appendSingularField(b, "java_string_check_utf8", nil)
|
||||
case 9:
|
||||
b = p.appendSingularField(b, "optimize_for", nil)
|
||||
case 11:
|
||||
b = p.appendSingularField(b, "go_package", nil)
|
||||
case 16:
|
||||
b = p.appendSingularField(b, "cc_generic_services", nil)
|
||||
case 17:
|
||||
b = p.appendSingularField(b, "java_generic_services", nil)
|
||||
case 18:
|
||||
b = p.appendSingularField(b, "py_generic_services", nil)
|
||||
case 42:
|
||||
b = p.appendSingularField(b, "php_generic_services", nil)
|
||||
case 23:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 31:
|
||||
b = p.appendSingularField(b, "cc_enable_arenas", nil)
|
||||
case 36:
|
||||
b = p.appendSingularField(b, "objc_class_prefix", nil)
|
||||
case 37:
|
||||
b = p.appendSingularField(b, "csharp_namespace", nil)
|
||||
case 39:
|
||||
b = p.appendSingularField(b, "swift_prefix", nil)
|
||||
case 40:
|
||||
b = p.appendSingularField(b, "php_class_prefix", nil)
|
||||
case 41:
|
||||
b = p.appendSingularField(b, "php_namespace", nil)
|
||||
case 44:
|
||||
b = p.appendSingularField(b, "php_metadata_namespace", nil)
|
||||
case 45:
|
||||
b = p.appendSingularField(b, "ruby_package", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendSourceCodeInfo(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendRepeatedField(b, "location", (*SourcePath).appendSourceCodeInfo_Location)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendDescriptorProto_ExtensionRange(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "start", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "end", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendExtensionRangeOptions)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendOneofDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendOneofOptions)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendMessageOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "message_set_wire_format", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "no_standard_descriptor_accessor", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "map_entry", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendDescriptorProto_ReservedRange(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "start", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "end", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendEnumValueDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "number", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendEnumValueOptions)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendEnumOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "allow_alias", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendEnumDescriptorProto_EnumReservedRange(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "start", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "end", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendMethodDescriptorProto(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "input_type", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "output_type", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "options", (*SourcePath).appendMethodOptions)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "client_streaming", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "server_streaming", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendServiceOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 33:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendFieldOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "ctype", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "packed", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "jstype", nil)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "lazy", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 10:
|
||||
b = p.appendSingularField(b, "weak", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendUninterpretedOption(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "name", (*SourcePath).appendUninterpretedOption_NamePart)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "identifier_value", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "positive_int_value", nil)
|
||||
case 5:
|
||||
b = p.appendSingularField(b, "negative_int_value", nil)
|
||||
case 6:
|
||||
b = p.appendSingularField(b, "double_value", nil)
|
||||
case 7:
|
||||
b = p.appendSingularField(b, "string_value", nil)
|
||||
case 8:
|
||||
b = p.appendSingularField(b, "aggregate_value", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendSourceCodeInfo_Location(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendRepeatedField(b, "path", nil)
|
||||
case 2:
|
||||
b = p.appendRepeatedField(b, "span", nil)
|
||||
case 3:
|
||||
b = p.appendSingularField(b, "leading_comments", nil)
|
||||
case 4:
|
||||
b = p.appendSingularField(b, "trailing_comments", nil)
|
||||
case 6:
|
||||
b = p.appendRepeatedField(b, "leading_detached_comments", nil)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendExtensionRangeOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendOneofOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendEnumValueOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendMethodOptions(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 33:
|
||||
b = p.appendSingularField(b, "deprecated", nil)
|
||||
case 34:
|
||||
b = p.appendSingularField(b, "idempotency_level", nil)
|
||||
case 999:
|
||||
b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *SourcePath) appendUninterpretedOption_NamePart(b []byte) []byte {
|
||||
if len(*p) == 0 {
|
||||
return b
|
||||
}
|
||||
switch (*p)[0] {
|
||||
case 1:
|
||||
b = p.appendSingularField(b, "name_part", nil)
|
||||
case 2:
|
||||
b = p.appendSingularField(b, "is_extension", nil)
|
||||
}
|
||||
return b
|
||||
}
|
34
vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
generated
vendored
34
vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
generated
vendored
@ -232,11 +232,15 @@ type MessageDescriptor interface {
|
||||
type isMessageDescriptor interface{ ProtoType(MessageDescriptor) }
|
||||
|
||||
// MessageType encapsulates a MessageDescriptor with a concrete Go implementation.
|
||||
// It is recommended that implementations of this interface also implement the
|
||||
// MessageFieldTypes interface.
|
||||
type MessageType interface {
|
||||
// New returns a newly allocated empty message.
|
||||
// It may return nil for synthetic messages representing a map entry.
|
||||
New() Message
|
||||
|
||||
// Zero returns an empty, read-only message.
|
||||
// It may return nil for synthetic messages representing a map entry.
|
||||
Zero() Message
|
||||
|
||||
// Descriptor returns the message descriptor.
|
||||
@ -245,6 +249,26 @@ type MessageType interface {
|
||||
Descriptor() MessageDescriptor
|
||||
}
|
||||
|
||||
// MessageFieldTypes extends a MessageType by providing type information
|
||||
// regarding enums and messages referenced by the message fields.
|
||||
type MessageFieldTypes interface {
|
||||
MessageType
|
||||
|
||||
// Enum returns the EnumType for the ith field in Descriptor.Fields.
|
||||
// It returns nil if the ith field is not an enum kind.
|
||||
// It panics if out of bounds.
|
||||
//
|
||||
// Invariant: mt.Enum(i).Descriptor() == mt.Descriptor().Fields(i).Enum()
|
||||
Enum(i int) EnumType
|
||||
|
||||
// Message returns the MessageType for the ith field in Descriptor.Fields.
|
||||
// It returns nil if the ith field is not a message or group kind.
|
||||
// It panics if out of bounds.
|
||||
//
|
||||
// Invariant: mt.Message(i).Descriptor() == mt.Descriptor().Fields(i).Message()
|
||||
Message(i int) MessageType
|
||||
}
|
||||
|
||||
// MessageDescriptors is a list of message declarations.
|
||||
type MessageDescriptors interface {
|
||||
// Len reports the number of messages.
|
||||
@ -279,8 +303,15 @@ type FieldDescriptor interface {
|
||||
|
||||
// JSONName reports the name used for JSON serialization.
|
||||
// It is usually the camel-cased form of the field name.
|
||||
// Extension fields are represented by the full name surrounded by brackets.
|
||||
JSONName() string
|
||||
|
||||
// TextName reports the name used for text serialization.
|
||||
// It is usually the name of the field, except that groups use the name
|
||||
// of the inlined message, and extension fields are represented by the
|
||||
// full name surrounded by brackets.
|
||||
TextName() string
|
||||
|
||||
// HasPresence reports whether the field distinguishes between unpopulated
|
||||
// and default values.
|
||||
HasPresence() bool
|
||||
@ -371,6 +402,9 @@ type FieldDescriptors interface {
|
||||
// ByJSONName returns the FieldDescriptor for a field with s as the JSON name.
|
||||
// It returns nil if not found.
|
||||
ByJSONName(s string) FieldDescriptor
|
||||
// ByTextName returns the FieldDescriptor for a field with s as the text name.
|
||||
// It returns nil if not found.
|
||||
ByTextName(s string) FieldDescriptor
|
||||
// ByNumber returns the FieldDescriptor for a field numbered n.
|
||||
// It returns nil if not found.
|
||||
ByNumber(n FieldNumber) FieldDescriptor
|
||||
|
157
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
157
vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
generated
vendored
@ -17,24 +17,49 @@ package protoregistry
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"google.golang.org/protobuf/internal/encoding/messageset"
|
||||
"google.golang.org/protobuf/internal/errors"
|
||||
"google.golang.org/protobuf/internal/flags"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
// conflictPolicy configures the policy for handling registration conflicts.
|
||||
//
|
||||
// It can be over-written at compile time with a linker-initialized variable:
|
||||
// go build -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=warn"
|
||||
//
|
||||
// It can be over-written at program execution with an environment variable:
|
||||
// GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn ./main
|
||||
//
|
||||
// Neither of the above are covered by the compatibility promise and
|
||||
// may be removed in a future release of this module.
|
||||
var conflictPolicy = "panic" // "panic" | "warn" | "ignore"
|
||||
|
||||
// ignoreConflict reports whether to ignore a registration conflict
|
||||
// given the descriptor being registered and the error.
|
||||
// It is a variable so that the behavior is easily overridden in another file.
|
||||
var ignoreConflict = func(d protoreflect.Descriptor, err error) bool {
|
||||
log.Printf(""+
|
||||
"WARNING: %v\n"+
|
||||
"A future release will panic on registration conflicts. See:\n"+
|
||||
"https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict\n"+
|
||||
"\n", err)
|
||||
return true
|
||||
const env = "GOLANG_PROTOBUF_REGISTRATION_CONFLICT"
|
||||
const faq = "https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict"
|
||||
policy := conflictPolicy
|
||||
if v := os.Getenv(env); v != "" {
|
||||
policy = v
|
||||
}
|
||||
switch policy {
|
||||
case "panic":
|
||||
panic(fmt.Sprintf("%v\nSee %v\n", err, faq))
|
||||
case "warn":
|
||||
fmt.Fprintf(os.Stderr, "WARNING: %v\nSee %v\n\n", err, faq)
|
||||
return true
|
||||
case "ignore":
|
||||
return true
|
||||
default:
|
||||
panic("invalid " + env + " value: " + os.Getenv(env))
|
||||
}
|
||||
}
|
||||
|
||||
var globalMutex sync.RWMutex
|
||||
@ -96,38 +121,7 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
||||
}
|
||||
path := file.Path()
|
||||
if prev := r.filesByPath[path]; prev != nil {
|
||||
// TODO: Remove this after some soak-in period after moving these types.
|
||||
var prevPath string
|
||||
const prevModule = "google.golang.org/genproto"
|
||||
const prevVersion = "cb27e3aa (May 26th, 2020)"
|
||||
switch path {
|
||||
case "google/protobuf/field_mask.proto":
|
||||
prevPath = prevModule + "/protobuf/field_mask"
|
||||
case "google/protobuf/api.proto":
|
||||
prevPath = prevModule + "/protobuf/api"
|
||||
case "google/protobuf/type.proto":
|
||||
prevPath = prevModule + "/protobuf/ptype"
|
||||
case "google/protobuf/source_context.proto":
|
||||
prevPath = prevModule + "/protobuf/source_context"
|
||||
}
|
||||
if r == GlobalFiles && prevPath != "" {
|
||||
pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto")
|
||||
pkgName = strings.Replace(pkgName, "_", "", -1) + "pb"
|
||||
currPath := "google.golang.org/protobuf/types/known/" + pkgName
|
||||
panic(fmt.Sprintf(""+
|
||||
"duplicate registration of %q\n"+
|
||||
"\n"+
|
||||
"The generated definition for this file has moved:\n"+
|
||||
"\tfrom: %q\n"+
|
||||
"\tto: %q\n"+
|
||||
"A dependency on the %q module must\n"+
|
||||
"be at version %v or higher.\n"+
|
||||
"\n"+
|
||||
"Upgrade the dependency by running:\n"+
|
||||
"\tgo get -u %v\n",
|
||||
path, prevPath, currPath, prevModule, prevVersion, prevPath))
|
||||
}
|
||||
|
||||
r.checkGenProtoConflict(path)
|
||||
err := errors.New("file %q is already registered", file.Path())
|
||||
err = amendErrorWithCaller(err, prev, file)
|
||||
if r == GlobalFiles && ignoreConflict(file, err) {
|
||||
@ -178,6 +172,47 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Several well-known types were hosted in the google.golang.org/genproto module
|
||||
// but were later moved to this module. To avoid a weak dependency on the
|
||||
// genproto module (and its relatively large set of transitive dependencies),
|
||||
// we rely on a registration conflict to determine whether the genproto version
|
||||
// is too old (i.e., does not contain aliases to the new type declarations).
|
||||
func (r *Files) checkGenProtoConflict(path string) {
|
||||
if r != GlobalFiles {
|
||||
return
|
||||
}
|
||||
var prevPath string
|
||||
const prevModule = "google.golang.org/genproto"
|
||||
const prevVersion = "cb27e3aa (May 26th, 2020)"
|
||||
switch path {
|
||||
case "google/protobuf/field_mask.proto":
|
||||
prevPath = prevModule + "/protobuf/field_mask"
|
||||
case "google/protobuf/api.proto":
|
||||
prevPath = prevModule + "/protobuf/api"
|
||||
case "google/protobuf/type.proto":
|
||||
prevPath = prevModule + "/protobuf/ptype"
|
||||
case "google/protobuf/source_context.proto":
|
||||
prevPath = prevModule + "/protobuf/source_context"
|
||||
default:
|
||||
return
|
||||
}
|
||||
pkgName := strings.TrimSuffix(strings.TrimPrefix(path, "google/protobuf/"), ".proto")
|
||||
pkgName = strings.Replace(pkgName, "_", "", -1) + "pb" // e.g., "field_mask" => "fieldmaskpb"
|
||||
currPath := "google.golang.org/protobuf/types/known/" + pkgName
|
||||
panic(fmt.Sprintf(""+
|
||||
"duplicate registration of %q\n"+
|
||||
"\n"+
|
||||
"The generated definition for this file has moved:\n"+
|
||||
"\tfrom: %q\n"+
|
||||
"\tto: %q\n"+
|
||||
"A dependency on the %q module must\n"+
|
||||
"be at version %v or higher.\n"+
|
||||
"\n"+
|
||||
"Upgrade the dependency by running:\n"+
|
||||
"\tgo get -u %v\n",
|
||||
path, prevPath, currPath, prevModule, prevVersion, prevPath))
|
||||
}
|
||||
|
||||
// FindDescriptorByName looks up a descriptor by the full name.
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
@ -560,13 +595,25 @@ func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumTyp
|
||||
return nil, NotFound
|
||||
}
|
||||
|
||||
// FindMessageByName looks up a message by its full name.
|
||||
// E.g., "google.protobuf.Any"
|
||||
// FindMessageByName looks up a message by its full name,
|
||||
// e.g. "google.protobuf.Any".
|
||||
//
|
||||
// This return (nil, NotFound) if not found.
|
||||
// This returns (nil, NotFound) if not found.
|
||||
func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
|
||||
// The full name by itself is a valid URL.
|
||||
return r.FindMessageByURL(string(message))
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
}
|
||||
if r == GlobalTypes {
|
||||
globalMutex.RLock()
|
||||
defer globalMutex.RUnlock()
|
||||
}
|
||||
if v := r.typesByName[message]; v != nil {
|
||||
if mt, _ := v.(protoreflect.MessageType); mt != nil {
|
||||
return mt, nil
|
||||
}
|
||||
return nil, errors.New("found wrong type: got %v, want message", typeName(v))
|
||||
}
|
||||
return nil, NotFound
|
||||
}
|
||||
|
||||
// FindMessageByURL looks up a message by a URL identifier.
|
||||
@ -574,6 +621,8 @@ func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.M
|
||||
//
|
||||
// This returns (nil, NotFound) if not found.
|
||||
func (r *Types) FindMessageByURL(url string) (protoreflect.MessageType, error) {
|
||||
// This function is similar to FindMessageByName but
|
||||
// truncates anything before and including '/' in the URL.
|
||||
if r == nil {
|
||||
return nil, NotFound
|
||||
}
|
||||
@ -613,6 +662,26 @@ func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.E
|
||||
if xt, _ := v.(protoreflect.ExtensionType); xt != nil {
|
||||
return xt, nil
|
||||
}
|
||||
|
||||
// MessageSet extensions are special in that the name of the extension
|
||||
// is the name of the message type used to extend the MessageSet.
|
||||
// This naming scheme is used by text and JSON serialization.
|
||||
//
|
||||
// This feature is protected by the ProtoLegacy flag since MessageSets
|
||||
// are a proto1 feature that is long deprecated.
|
||||
if flags.ProtoLegacy {
|
||||
if _, ok := v.(protoreflect.MessageType); ok {
|
||||
field := field.Append(messageset.ExtensionName)
|
||||
if v := r.typesByName[field]; v != nil {
|
||||
if xt, _ := v.(protoreflect.ExtensionType); xt != nil {
|
||||
if messageset.IsMessageSetExtension(xt.TypeDescriptor()) {
|
||||
return xt, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errors.New("found wrong type: got %v, want extension", typeName(v))
|
||||
}
|
||||
return nil, NotFound
|
||||
|
Reference in New Issue
Block a user