From 50a00828e69084b30f254e9cbe6251d5cd04408f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 8 Mar 2024 08:29:09 +0000
Subject: [PATCH] Bump github.com/prometheus/common from 0.49.0 to 0.50.0 (#94)
---
go.mod | 18 +-
go.sum | 36 +-
vendor/github.com/beorn7/perks/LICENSE | 20 -
.../beorn7/perks/quantile/exampledata.txt | 2388 -------
.../beorn7/perks/quantile/stream.go | 316 -
.../github.com/cespare/xxhash/v2/LICENSE.txt | 22 -
vendor/github.com/cespare/xxhash/v2/README.md | 72 -
.../github.com/cespare/xxhash/v2/testall.sh | 10 -
vendor/github.com/cespare/xxhash/v2/xxhash.go | 228 -
.../cespare/xxhash/v2/xxhash_amd64.s | 209 -
.../cespare/xxhash/v2/xxhash_arm64.s | 183 -
.../cespare/xxhash/v2/xxhash_asm.go | 15 -
.../cespare/xxhash/v2/xxhash_other.go | 76 -
.../cespare/xxhash/v2/xxhash_safe.go | 16 -
.../cespare/xxhash/v2/xxhash_unsafe.go | 58 -
.../prometheus/client_golang/LICENSE | 201 -
.../prometheus/client_golang/NOTICE | 23 -
.../client_golang/prometheus/.gitignore | 1 -
.../client_golang/prometheus/README.md | 1 -
.../prometheus/build_info_collector.go | 38 -
.../client_golang/prometheus/collector.go | 128 -
.../client_golang/prometheus/counter.go | 358 --
.../client_golang/prometheus/desc.go | 207 -
.../client_golang/prometheus/doc.go | 210 -
.../prometheus/expvar_collector.go | 86 -
.../client_golang/prometheus/fnv.go | 42 -
.../client_golang/prometheus/gauge.go | 311 -
.../client_golang/prometheus/get_pid.go | 26 -
.../prometheus/get_pid_gopherjs.go | 23 -
.../client_golang/prometheus/go_collector.go | 281 -
.../prometheus/go_collector_go116.go | 122 -
.../prometheus/go_collector_latest.go | 567 --
.../client_golang/prometheus/histogram.go | 1577 -----
.../prometheus/internal/almost_equal.go | 60 -
.../prometheus/internal/difflib.go | 654 --
.../internal/go_collector_options.go | 32 -
.../prometheus/internal/go_runtime_metrics.go | 142 -
.../prometheus/internal/metric.go | 101 -
.../client_golang/prometheus/labels.go | 188 -
.../client_golang/prometheus/metric.go | 257 -
.../client_golang/prometheus/num_threads.go | 25 -
.../prometheus/num_threads_gopherjs.go | 22 -
.../client_golang/prometheus/observer.go | 64 -
.../prometheus/process_collector.go | 164 -
.../prometheus/process_collector_js.go | 26 -
.../prometheus/process_collector_other.go | 66 -
.../prometheus/process_collector_wasip1.go | 26 -
.../prometheus/process_collector_windows.go | 116 -
.../client_golang/prometheus/registry.go | 1075 ----
.../client_golang/prometheus/summary.go | 785 ---
.../client_golang/prometheus/timer.go | 81 -
.../client_golang/prometheus/untyped.go | 42 -
.../client_golang/prometheus/value.go | 274 -
.../client_golang/prometheus/vec.go | 709 --
.../client_golang/prometheus/vnext.go | 23 -
.../client_golang/prometheus/wrap.go | 214 -
.../prometheus/client_model/LICENSE | 201 -
.../github.com/prometheus/client_model/NOTICE | 5 -
.../prometheus/client_model/go/metrics.pb.go | 1399 ----
.../prometheus/common/expfmt/decode.go | 431 --
.../prometheus/common/expfmt/encode.go | 197 -
.../prometheus/common/expfmt/expfmt.go | 167 -
.../prometheus/common/expfmt/fuzz.go | 37 -
.../common/expfmt/openmetrics_create.go | 643 --
.../prometheus/common/expfmt/text_create.go | 520 --
.../prometheus/common/expfmt/text_parse.go | 781 ---
.../bitbucket.org/ww/goautoneg/README.txt | 67 -
.../bitbucket.org/ww/goautoneg/autoneg.go | 160 -
.../prometheus/common/model/alert.go | 136 -
.../prometheus/common/model/fingerprinting.go | 105 -
.../github.com/prometheus/common/model/fnv.go | 42 -
.../prometheus/common/model/labels.go | 226 -
.../prometheus/common/model/labelset.go | 184 -
.../prometheus/common/model/metadata.go | 28 -
.../prometheus/common/model/metric.go | 456 --
.../prometheus/common/model/model.go | 16 -
.../prometheus/common/model/signature.go | 142 -
.../prometheus/common/model/silence.go | 106 -
.../prometheus/common/model/time.go | 340 -
.../prometheus/common/model/value.go | 364 --
.../prometheus/common/model/value_float.go | 98 -
.../common/model/value_histogram.go | 178 -
.../prometheus/common/model/value_type.go | 83 -
.../prometheus/common/version/info.go | 29 -
.../github.com/prometheus/procfs/.gitignore | 2 -
.../prometheus/procfs/.golangci.yml | 15 -
.../prometheus/procfs/CODE_OF_CONDUCT.md | 3 -
.../prometheus/procfs/CONTRIBUTING.md | 121 -
vendor/github.com/prometheus/procfs/LICENSE | 201 -
.../prometheus/procfs/MAINTAINERS.md | 2 -
vendor/github.com/prometheus/procfs/Makefile | 31 -
.../prometheus/procfs/Makefile.common | 269 -
vendor/github.com/prometheus/procfs/NOTICE | 7 -
vendor/github.com/prometheus/procfs/README.md | 61 -
.../github.com/prometheus/procfs/SECURITY.md | 6 -
vendor/github.com/prometheus/procfs/arp.go | 116 -
.../github.com/prometheus/procfs/buddyinfo.go | 85 -
.../github.com/prometheus/procfs/cmdline.go | 30 -
.../github.com/prometheus/procfs/cpuinfo.go | 519 --
.../prometheus/procfs/cpuinfo_armx.go | 20 -
.../prometheus/procfs/cpuinfo_loong64.go | 19 -
.../prometheus/procfs/cpuinfo_mipsx.go | 20 -
.../prometheus/procfs/cpuinfo_others.go | 19 -
.../prometheus/procfs/cpuinfo_ppcx.go | 20 -
.../prometheus/procfs/cpuinfo_riscvx.go | 20 -
.../prometheus/procfs/cpuinfo_s390x.go | 19 -
.../prometheus/procfs/cpuinfo_x86.go | 20 -
vendor/github.com/prometheus/procfs/crypto.go | 154 -
vendor/github.com/prometheus/procfs/doc.go | 44 -
vendor/github.com/prometheus/procfs/fs.go | 50 -
.../prometheus/procfs/fs_statfs_notype.go | 23 -
.../prometheus/procfs/fs_statfs_type.go | 33 -
.../github.com/prometheus/procfs/fscache.go | 422 --
.../prometheus/procfs/internal/fs/fs.go | 55 -
.../prometheus/procfs/internal/util/parse.go | 112 -
.../procfs/internal/util/readfile.go | 37 -
.../procfs/internal/util/sysreadfile.go | 50 -
.../internal/util/sysreadfile_compat.go | 27 -
.../procfs/internal/util/valueparser.go | 91 -
vendor/github.com/prometheus/procfs/ipvs.go | 241 -
.../prometheus/procfs/kernel_random.go | 63 -
.../github.com/prometheus/procfs/loadavg.go | 62 -
vendor/github.com/prometheus/procfs/mdstat.go | 266 -
.../github.com/prometheus/procfs/meminfo.go | 277 -
.../github.com/prometheus/procfs/mountinfo.go | 180 -
.../prometheus/procfs/mountstats.go | 712 --
.../prometheus/procfs/net_conntrackstat.go | 118 -
.../github.com/prometheus/procfs/net_dev.go | 205 -
.../prometheus/procfs/net_ip_socket.go | 228 -
.../prometheus/procfs/net_protocols.go | 180 -
.../github.com/prometheus/procfs/net_route.go | 143 -
.../prometheus/procfs/net_sockstat.go | 162 -
.../prometheus/procfs/net_softnet.go | 155 -
.../github.com/prometheus/procfs/net_tcp.go | 64 -
.../github.com/prometheus/procfs/net_udp.go | 64 -
.../github.com/prometheus/procfs/net_unix.go | 257 -
.../prometheus/procfs/net_wireless.go | 182 -
.../github.com/prometheus/procfs/net_xfrm.go | 189 -
.../github.com/prometheus/procfs/netstat.go | 82 -
vendor/github.com/prometheus/procfs/proc.go | 338 -
.../prometheus/procfs/proc_cgroup.go | 98 -
.../prometheus/procfs/proc_cgroups.go | 98 -
.../prometheus/procfs/proc_environ.go | 37 -
.../prometheus/procfs/proc_fdinfo.go | 138 -
.../prometheus/procfs/proc_interrupts.go | 98 -
.../github.com/prometheus/procfs/proc_io.go | 59 -
.../prometheus/procfs/proc_limits.go | 160 -
.../github.com/prometheus/procfs/proc_maps.go | 211 -
.../prometheus/procfs/proc_netstat.go | 443 --
.../github.com/prometheus/procfs/proc_ns.go | 68 -
.../github.com/prometheus/procfs/proc_psi.go | 102 -
.../prometheus/procfs/proc_smaps.go | 166 -
.../github.com/prometheus/procfs/proc_snmp.go | 353 -
.../prometheus/procfs/proc_snmp6.go | 381 --
.../github.com/prometheus/procfs/proc_stat.go | 222 -
.../prometheus/procfs/proc_status.go | 221 -
.../github.com/prometheus/procfs/proc_sys.go | 51 -
.../github.com/prometheus/procfs/schedstat.go | 121 -
vendor/github.com/prometheus/procfs/slab.go | 151 -
.../github.com/prometheus/procfs/softirqs.go | 160 -
vendor/github.com/prometheus/procfs/stat.go | 258 -
vendor/github.com/prometheus/procfs/swaps.go | 89 -
vendor/github.com/prometheus/procfs/thread.go | 80 -
vendor/github.com/prometheus/procfs/ttar | 413 --
vendor/github.com/prometheus/procfs/vm.go | 212 -
.../github.com/prometheus/procfs/zoneinfo.go | 196 -
vendor/golang.org/x/sys/unix/aliases.go | 2 +-
.../x/sys/unix/syscall_darwin_libSystem.go | 2 +-
.../golang.org/x/sys/unix/syscall_freebsd.go | 12 +-
vendor/golang.org/x/sys/unix/syscall_linux.go | 99 +
.../golang.org/x/sys/unix/zsyscall_linux.go | 10 +
vendor/golang.org/x/sys/unix/ztypes_linux.go | 60 +
vendor/google.golang.org/protobuf/LICENSE | 27 -
vendor/google.golang.org/protobuf/PATENTS | 22 -
.../encoding/protodelim/protodelim.go | 160 -
.../protobuf/encoding/prototext/decode.go | 772 ---
.../protobuf/encoding/prototext/doc.go | 7 -
.../protobuf/encoding/prototext/encode.go | 376 --
.../protobuf/encoding/protowire/wire.go | 547 --
.../protobuf/internal/descfmt/stringer.go | 413 --
.../protobuf/internal/descopts/options.go | 29 -
.../protobuf/internal/detrand/rand.go | 69 -
.../internal/encoding/defval/default.go | 213 -
.../encoding/messageset/messageset.go | 242 -
.../protobuf/internal/encoding/tag/tag.go | 207 -
.../protobuf/internal/encoding/text/decode.go | 686 --
.../internal/encoding/text/decode_number.go | 211 -
.../internal/encoding/text/decode_string.go | 161 -
.../internal/encoding/text/decode_token.go | 373 --
.../protobuf/internal/encoding/text/doc.go | 29 -
.../protobuf/internal/encoding/text/encode.go | 272 -
.../protobuf/internal/errors/errors.go | 89 -
.../protobuf/internal/errors/is_go112.go | 40 -
.../protobuf/internal/errors/is_go113.go | 13 -
.../protobuf/internal/filedesc/build.go | 157 -
.../protobuf/internal/filedesc/desc.go | 678 --
.../protobuf/internal/filedesc/desc_init.go | 471 --
.../protobuf/internal/filedesc/desc_lazy.go | 704 --
.../protobuf/internal/filedesc/desc_list.go | 457 --
.../internal/filedesc/desc_list_gen.go | 356 -
.../protobuf/internal/filedesc/placeholder.go | 109 -
.../protobuf/internal/filetype/build.go | 296 -
.../protobuf/internal/flags/flags.go | 24 -
.../internal/flags/proto_legacy_disable.go | 10 -
.../internal/flags/proto_legacy_enable.go | 10 -
.../protobuf/internal/genid/any_gen.go | 34 -
.../protobuf/internal/genid/api_gen.go | 106 -
.../protobuf/internal/genid/descriptor_gen.go | 1087 ----
.../protobuf/internal/genid/doc.go | 11 -
.../protobuf/internal/genid/duration_gen.go | 34 -
.../protobuf/internal/genid/empty_gen.go | 19 -
.../protobuf/internal/genid/field_mask_gen.go | 31 -
.../protobuf/internal/genid/goname.go | 25 -
.../protobuf/internal/genid/map_entry.go | 16 -
.../internal/genid/source_context_gen.go | 31 -
.../protobuf/internal/genid/struct_gen.go | 116 -
.../protobuf/internal/genid/timestamp_gen.go | 34 -
.../protobuf/internal/genid/type_gen.go | 190 -
.../protobuf/internal/genid/wrappers.go | 13 -
.../protobuf/internal/genid/wrappers_gen.go | 175 -
.../protobuf/internal/impl/api_export.go | 177 -
.../protobuf/internal/impl/checkinit.go | 141 -
.../protobuf/internal/impl/codec_extension.go | 223 -
.../protobuf/internal/impl/codec_field.go | 830 ---
.../protobuf/internal/impl/codec_gen.go | 5724 -----------------
.../protobuf/internal/impl/codec_map.go | 388 --
.../protobuf/internal/impl/codec_map_go111.go | 38 -
.../protobuf/internal/impl/codec_map_go112.go | 12 -
.../protobuf/internal/impl/codec_message.go | 217 -
.../internal/impl/codec_messageset.go | 123 -
.../protobuf/internal/impl/codec_reflect.go | 210 -
.../protobuf/internal/impl/codec_tables.go | 557 --
.../protobuf/internal/impl/codec_unsafe.go | 18 -
.../protobuf/internal/impl/convert.go | 495 --
.../protobuf/internal/impl/convert_list.go | 141 -
.../protobuf/internal/impl/convert_map.go | 121 -
.../protobuf/internal/impl/decode.go | 285 -
.../protobuf/internal/impl/encode.go | 201 -
.../protobuf/internal/impl/enum.go | 21 -
.../protobuf/internal/impl/extension.go | 156 -
.../protobuf/internal/impl/legacy_enum.go | 218 -
.../protobuf/internal/impl/legacy_export.go | 92 -
.../internal/impl/legacy_extension.go | 176 -
.../protobuf/internal/impl/legacy_file.go | 81 -
.../protobuf/internal/impl/legacy_message.go | 568 --
.../protobuf/internal/impl/merge.go | 176 -
.../protobuf/internal/impl/merge_gen.go | 209 -
.../protobuf/internal/impl/message.go | 284 -
.../protobuf/internal/impl/message_reflect.go | 463 --
.../internal/impl/message_reflect_field.go | 543 --
.../internal/impl/message_reflect_gen.go | 249 -
.../protobuf/internal/impl/pointer_reflect.go | 215 -
.../protobuf/internal/impl/pointer_unsafe.go | 215 -
.../protobuf/internal/impl/validate.go | 576 --
.../protobuf/internal/impl/weak.go | 74 -
.../protobuf/internal/order/order.go | 89 -
.../protobuf/internal/order/range.go | 115 -
.../protobuf/internal/pragma/pragma.go | 29 -
.../protobuf/internal/set/ints.go | 58 -
.../protobuf/internal/strs/strings.go | 196 -
.../protobuf/internal/strs/strings_pure.go | 28 -
.../internal/strs/strings_unsafe_go120.go | 95 -
.../internal/strs/strings_unsafe_go121.go | 74 -
.../protobuf/internal/version/version.go | 79 -
.../protobuf/proto/checkinit.go | 71 -
.../protobuf/proto/decode.go | 294 -
.../protobuf/proto/decode_gen.go | 603 --
.../google.golang.org/protobuf/proto/doc.go | 86 -
.../protobuf/proto/encode.go | 322 -
.../protobuf/proto/encode_gen.go | 97 -
.../google.golang.org/protobuf/proto/equal.go | 57 -
.../protobuf/proto/extension.go | 92 -
.../google.golang.org/protobuf/proto/merge.go | 139 -
.../protobuf/proto/messageset.go | 93 -
.../google.golang.org/protobuf/proto/proto.go | 45 -
.../protobuf/proto/proto_methods.go | 20 -
.../protobuf/proto/proto_reflect.go | 20 -
.../google.golang.org/protobuf/proto/reset.go | 43 -
.../google.golang.org/protobuf/proto/size.go | 101 -
.../protobuf/proto/size_gen.go | 55 -
.../protobuf/proto/wrappers.go | 29 -
.../protobuf/reflect/protoreflect/methods.go | 78 -
.../protobuf/reflect/protoreflect/proto.go | 511 --
.../protobuf/reflect/protoreflect/source.go | 129 -
.../reflect/protoreflect/source_gen.go | 554 --
.../protobuf/reflect/protoreflect/type.go | 666 --
.../protobuf/reflect/protoreflect/value.go | 285 -
.../reflect/protoreflect/value_equal.go | 168 -
.../reflect/protoreflect/value_pure.go | 60 -
.../reflect/protoreflect/value_union.go | 438 --
.../protoreflect/value_unsafe_go120.go | 99 -
.../protoreflect/value_unsafe_go121.go | 87 -
.../reflect/protoregistry/registry.go | 882 ---
.../protobuf/runtime/protoiface/legacy.go | 15 -
.../protobuf/runtime/protoiface/methods.go | 168 -
.../protobuf/runtime/protoimpl/impl.go | 44 -
.../protobuf/runtime/protoimpl/version.go | 60 -
.../types/known/timestamppb/timestamp.pb.go | 383 --
vendor/modules.txt | 64 +-
299 files changed, 205 insertions(+), 63603 deletions(-)
delete mode 100644 vendor/github.com/beorn7/perks/LICENSE
delete mode 100644 vendor/github.com/beorn7/perks/quantile/exampledata.txt
delete mode 100644 vendor/github.com/beorn7/perks/quantile/stream.go
delete mode 100644 vendor/github.com/cespare/xxhash/v2/LICENSE.txt
delete mode 100644 vendor/github.com/cespare/xxhash/v2/README.md
delete mode 100644 vendor/github.com/cespare/xxhash/v2/testall.sh
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash.go
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_asm.go
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_other.go
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
delete mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
delete mode 100644 vendor/github.com/prometheus/client_golang/LICENSE
delete mode 100644 vendor/github.com/prometheus/client_golang/NOTICE
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/.gitignore
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/README.md
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info_collector.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/collector.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/counter.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/desc.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/doc.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/fnv.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/gauge.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/get_pid.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/get_pid_gopherjs.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/histogram.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/labels.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/metric.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/num_threads.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/num_threads_gopherjs.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/observer.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_js.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_wasip1.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/registry.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/summary.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/timer.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/untyped.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/value.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/vec.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/vnext.go
delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/wrap.go
delete mode 100644 vendor/github.com/prometheus/client_model/LICENSE
delete mode 100644 vendor/github.com/prometheus/client_model/NOTICE
delete mode 100644 vendor/github.com/prometheus/client_model/go/metrics.pb.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/decode.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/encode.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/expfmt.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/fuzz.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/text_create.go
delete mode 100644 vendor/github.com/prometheus/common/expfmt/text_parse.go
delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt
delete mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
delete mode 100644 vendor/github.com/prometheus/common/model/alert.go
delete mode 100644 vendor/github.com/prometheus/common/model/fingerprinting.go
delete mode 100644 vendor/github.com/prometheus/common/model/fnv.go
delete mode 100644 vendor/github.com/prometheus/common/model/labels.go
delete mode 100644 vendor/github.com/prometheus/common/model/labelset.go
delete mode 100644 vendor/github.com/prometheus/common/model/metadata.go
delete mode 100644 vendor/github.com/prometheus/common/model/metric.go
delete mode 100644 vendor/github.com/prometheus/common/model/model.go
delete mode 100644 vendor/github.com/prometheus/common/model/signature.go
delete mode 100644 vendor/github.com/prometheus/common/model/silence.go
delete mode 100644 vendor/github.com/prometheus/common/model/time.go
delete mode 100644 vendor/github.com/prometheus/common/model/value.go
delete mode 100644 vendor/github.com/prometheus/common/model/value_float.go
delete mode 100644 vendor/github.com/prometheus/common/model/value_histogram.go
delete mode 100644 vendor/github.com/prometheus/common/model/value_type.go
delete mode 100644 vendor/github.com/prometheus/procfs/.gitignore
delete mode 100644 vendor/github.com/prometheus/procfs/.golangci.yml
delete mode 100644 vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md
delete mode 100644 vendor/github.com/prometheus/procfs/CONTRIBUTING.md
delete mode 100644 vendor/github.com/prometheus/procfs/LICENSE
delete mode 100644 vendor/github.com/prometheus/procfs/MAINTAINERS.md
delete mode 100644 vendor/github.com/prometheus/procfs/Makefile
delete mode 100644 vendor/github.com/prometheus/procfs/Makefile.common
delete mode 100644 vendor/github.com/prometheus/procfs/NOTICE
delete mode 100644 vendor/github.com/prometheus/procfs/README.md
delete mode 100644 vendor/github.com/prometheus/procfs/SECURITY.md
delete mode 100644 vendor/github.com/prometheus/procfs/arp.go
delete mode 100644 vendor/github.com/prometheus/procfs/buddyinfo.go
delete mode 100644 vendor/github.com/prometheus/procfs/cmdline.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_armx.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_others.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_s390x.go
delete mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_x86.go
delete mode 100644 vendor/github.com/prometheus/procfs/crypto.go
delete mode 100644 vendor/github.com/prometheus/procfs/doc.go
delete mode 100644 vendor/github.com/prometheus/procfs/fs.go
delete mode 100644 vendor/github.com/prometheus/procfs/fs_statfs_notype.go
delete mode 100644 vendor/github.com/prometheus/procfs/fs_statfs_type.go
delete mode 100644 vendor/github.com/prometheus/procfs/fscache.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/fs/fs.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/parse.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/readfile.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
delete mode 100644 vendor/github.com/prometheus/procfs/internal/util/valueparser.go
delete mode 100644 vendor/github.com/prometheus/procfs/ipvs.go
delete mode 100644 vendor/github.com/prometheus/procfs/kernel_random.go
delete mode 100644 vendor/github.com/prometheus/procfs/loadavg.go
delete mode 100644 vendor/github.com/prometheus/procfs/mdstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/meminfo.go
delete mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go
delete mode 100644 vendor/github.com/prometheus/procfs/mountstats.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_conntrackstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_dev.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_ip_socket.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_protocols.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_route.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_sockstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_softnet.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_tcp.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_udp.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_unix.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_wireless.go
delete mode 100644 vendor/github.com/prometheus/procfs/net_xfrm.go
delete mode 100644 vendor/github.com/prometheus/procfs/netstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_cgroup.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_cgroups.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_fdinfo.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_interrupts.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_io.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_limits.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_maps.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_netstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_ns.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_psi.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_smaps.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_snmp.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_snmp6.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_stat.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_status.go
delete mode 100644 vendor/github.com/prometheus/procfs/proc_sys.go
delete mode 100644 vendor/github.com/prometheus/procfs/schedstat.go
delete mode 100644 vendor/github.com/prometheus/procfs/slab.go
delete mode 100644 vendor/github.com/prometheus/procfs/softirqs.go
delete mode 100644 vendor/github.com/prometheus/procfs/stat.go
delete mode 100644 vendor/github.com/prometheus/procfs/swaps.go
delete mode 100644 vendor/github.com/prometheus/procfs/thread.go
delete mode 100644 vendor/github.com/prometheus/procfs/ttar
delete mode 100644 vendor/github.com/prometheus/procfs/vm.go
delete mode 100644 vendor/github.com/prometheus/procfs/zoneinfo.go
delete mode 100644 vendor/google.golang.org/protobuf/LICENSE
delete mode 100644 vendor/google.golang.org/protobuf/PATENTS
delete mode 100644 vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go
delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/decode.go
delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/doc.go
delete mode 100644 vendor/google.golang.org/protobuf/encoding/prototext/encode.go
delete mode 100644 vendor/google.golang.org/protobuf/encoding/protowire/wire.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/descopts/options.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/detrand/rand.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/errors.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go112.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/errors/is_go113.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/build.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/filetype/build.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/flags.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/any_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/api_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/doc.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/duration_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/empty_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/goname.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/map_entry.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/struct_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/type_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/api_export.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/checkinit.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_field.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_message.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_list.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/convert_map.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/decode.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/encode.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/enum.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/extension.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/merge_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/validate.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/impl/weak.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/order/order.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/order/range.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/pragma/pragma.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/set/ints.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
delete mode 100644 vendor/google.golang.org/protobuf/internal/version/version.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/checkinit.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/decode.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/decode_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/doc.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/encode.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/encode_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/equal.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/extension.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/merge.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/messageset.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/proto.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_methods.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/proto_reflect.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/reset.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/size.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/size_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/proto/wrappers.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
delete mode 100644 vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go
delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoiface/methods.go
delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go
delete mode 100644 vendor/google.golang.org/protobuf/runtime/protoimpl/version.go
delete mode 100644 vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
diff --git a/go.mod b/go.mod
index 8909a45..87cdeab 100644
--- a/go.mod
+++ b/go.mod
@@ -10,7 +10,7 @@ require (
github.com/gorilla/sessions v1.2.2
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.31.1
- github.com/prometheus/common v0.49.0
+ github.com/prometheus/common v0.50.0
github.com/sirupsen/logrus v1.9.3
github.com/vulcand/oxy v1.4.2
golang.org/x/text v0.14.0
@@ -19,8 +19,6 @@ require (
require (
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
- github.com/beorn7/perks v1.0.1 // indirect
- github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/go-cmp v0.6.0 // indirect
@@ -28,20 +26,16 @@ require (
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gravitational/trace v1.3.1 // indirect
github.com/jonboulle/clockwork v0.4.0 // indirect
- github.com/kr/text v0.2.0 // indirect
+ github.com/kr/pretty v0.3.1 // indirect
github.com/mailgun/multibuf v0.2.0 // indirect
github.com/nxadm/tail v1.4.11 // indirect
- github.com/prometheus/client_golang v1.19.0 // indirect
- github.com/prometheus/client_model v0.6.0 // indirect
- github.com/prometheus/procfs v0.12.0 // indirect
github.com/vulcand/predicate v1.2.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
- golang.org/x/crypto v0.19.0 // indirect
- golang.org/x/net v0.21.0 // indirect
- golang.org/x/sys v0.17.0 // indirect
- golang.org/x/term v0.17.0 // indirect
+ golang.org/x/crypto v0.21.0 // indirect
+ golang.org/x/net v0.22.0 // indirect
+ golang.org/x/sys v0.18.0 // indirect
+ golang.org/x/term v0.18.0 // indirect
golang.org/x/tools v0.16.1 // indirect
- google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
diff --git a/go.sum b/go.sum
index 198bca8..2fc9faa 100644
--- a/go.sum
+++ b/go.sum
@@ -8,12 +8,8 @@ github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HR
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 h1:ez/4by2iGztzR4L0zgAOR8lTQK9VlyBVVd7G4omaOQs=
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
-github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
-github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
-github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
@@ -109,18 +105,14 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.31.1 h1:KYppCUK+bUgAZwHOu7EXVBKyQA6ILvOESHkn/tgoqvo=
github.com/onsi/gomega v1.31.1/go.mod h1:y40C95dwAD1Nz36SsEnxvfFe8FFfNxzI5eJ0EYGyAy0=
+github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU=
-github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos=
-github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8=
-github.com/prometheus/common v0.49.0 h1:ToNTdK4zSnPVJmh698mGFkDor9wBI/iGaJy5dbH1EgI=
-github.com/prometheus/common v0.49.0/go.mod h1:Kxm+EULxRbUkjGU6WFsQqo3ORzB4tyKvlWFOE9mB2sE=
-github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
-github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
+github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ=
+github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/segmentio/fasthash v1.0.3 h1:EI9+KE1EwvMLBWwjpRDc+fEM+prwxDYbslddQGtrmhM=
@@ -152,8 +144,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
-golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
-golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
+golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
+golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -177,8 +169,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
-golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
-golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
+golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
+golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -207,14 +199,14 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
-golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
+golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
+golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
-golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
-golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
+golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
+golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
@@ -260,8 +252,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
-google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
-google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
+google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
+google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
diff --git a/vendor/github.com/beorn7/perks/LICENSE b/vendor/github.com/beorn7/perks/LICENSE
deleted file mode 100644
index 339177b..0000000
--- a/vendor/github.com/beorn7/perks/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013 Blake Mizerany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/beorn7/perks/quantile/exampledata.txt b/vendor/github.com/beorn7/perks/quantile/exampledata.txt
deleted file mode 100644
index 1602287..0000000
--- a/vendor/github.com/beorn7/perks/quantile/exampledata.txt
+++ /dev/null
@@ -1,2388 +0,0 @@
-8
-5
-26
-12
-5
-235
-13
-6
-28
-30
-3
-3
-3
-3
-5
-2
-33
-7
-2
-4
-7
-12
-14
-5
-8
-3
-10
-4
-5
-3
-6
-6
-209
-20
-3
-10
-14
-3
-4
-6
-8
-5
-11
-7
-3
-2
-3
-3
-212
-5
-222
-4
-10
-10
-5
-6
-3
-8
-3
-10
-254
-220
-2
-3
-5
-24
-5
-4
-222
-7
-3
-3
-223
-8
-15
-12
-14
-14
-3
-2
-2
-3
-13
-3
-11
-4
-4
-6
-5
-7
-13
-5
-3
-5
-2
-5
-3
-5
-2
-7
-15
-17
-14
-3
-6
-6
-3
-17
-5
-4
-7
-6
-4
-4
-8
-6
-8
-3
-9
-3
-6
-3
-4
-5
-3
-3
-660
-4
-6
-10
-3
-6
-3
-2
-5
-13
-2
-4
-4
-10
-4
-8
-4
-3
-7
-9
-9
-3
-10
-37
-3
-13
-4
-12
-3
-6
-10
-8
-5
-21
-2
-3
-8
-3
-2
-3
-3
-4
-12
-2
-4
-8
-8
-4
-3
-2
-20
-1
-6
-32
-2
-11
-6
-18
-3
-8
-11
-3
-212
-3
-4
-2
-6
-7
-12
-11
-3
-2
-16
-10
-6
-4
-6
-3
-2
-7
-3
-2
-2
-2
-2
-5
-6
-4
-3
-10
-3
-4
-6
-5
-3
-4
-4
-5
-6
-4
-3
-4
-4
-5
-7
-5
-5
-3
-2
-7
-2
-4
-12
-4
-5
-6
-2
-4
-4
-8
-4
-15
-13
-7
-16
-5
-3
-23
-5
-5
-7
-3
-2
-9
-8
-7
-5
-8
-11
-4
-10
-76
-4
-47
-4
-3
-2
-7
-4
-2
-3
-37
-10
-4
-2
-20
-5
-4
-4
-10
-10
-4
-3
-7
-23
-240
-7
-13
-5
-5
-3
-3
-2
-5
-4
-2
-8
-7
-19
-2
-23
-8
-7
-2
-5
-3
-8
-3
-8
-13
-5
-5
-5
-2
-3
-23
-4
-9
-8
-4
-3
-3
-5
-220
-2
-3
-4
-6
-14
-3
-53
-6
-2
-5
-18
-6
-3
-219
-6
-5
-2
-5
-3
-6
-5
-15
-4
-3
-17
-3
-2
-4
-7
-2
-3
-3
-4
-4
-3
-2
-664
-6
-3
-23
-5
-5
-16
-5
-8
-2
-4
-2
-24
-12
-3
-2
-3
-5
-8
-3
-5
-4
-3
-14
-3
-5
-8
-2
-3
-7
-9
-4
-2
-3
-6
-8
-4
-3
-4
-6
-5
-3
-3
-6
-3
-19
-4
-4
-6
-3
-6
-3
-5
-22
-5
-4
-4
-3
-8
-11
-4
-9
-7
-6
-13
-4
-4
-4
-6
-17
-9
-3
-3
-3
-4
-3
-221
-5
-11
-3
-4
-2
-12
-6
-3
-5
-7
-5
-7
-4
-9
-7
-14
-37
-19
-217
-16
-3
-5
-2
-2
-7
-19
-7
-6
-7
-4
-24
-5
-11
-4
-7
-7
-9
-13
-3
-4
-3
-6
-28
-4
-4
-5
-5
-2
-5
-6
-4
-4
-6
-10
-5
-4
-3
-2
-3
-3
-6
-5
-5
-4
-3
-2
-3
-7
-4
-6
-18
-16
-8
-16
-4
-5
-8
-6
-9
-13
-1545
-6
-215
-6
-5
-6
-3
-45
-31
-5
-2
-2
-4
-3
-3
-2
-5
-4
-3
-5
-7
-7
-4
-5
-8
-5
-4
-749
-2
-31
-9
-11
-2
-11
-5
-4
-4
-7
-9
-11
-4
-5
-4
-7
-3
-4
-6
-2
-15
-3
-4
-3
-4
-3
-5
-2
-13
-5
-5
-3
-3
-23
-4
-4
-5
-7
-4
-13
-2
-4
-3
-4
-2
-6
-2
-7
-3
-5
-5
-3
-29
-5
-4
-4
-3
-10
-2
-3
-79
-16
-6
-6
-7
-7
-3
-5
-5
-7
-4
-3
-7
-9
-5
-6
-5
-9
-6
-3
-6
-4
-17
-2
-10
-9
-3
-6
-2
-3
-21
-22
-5
-11
-4
-2
-17
-2
-224
-2
-14
-3
-4
-4
-2
-4
-4
-4
-4
-5
-3
-4
-4
-10
-2
-6
-3
-3
-5
-7
-2
-7
-5
-6
-3
-218
-2
-2
-5
-2
-6
-3
-5
-222
-14
-6
-33
-3
-2
-5
-3
-3
-3
-9
-5
-3
-3
-2
-7
-4
-3
-4
-3
-5
-6
-5
-26
-4
-13
-9
-7
-3
-221
-3
-3
-4
-4
-4
-4
-2
-18
-5
-3
-7
-9
-6
-8
-3
-10
-3
-11
-9
-5
-4
-17
-5
-5
-6
-6
-3
-2
-4
-12
-17
-6
-7
-218
-4
-2
-4
-10
-3
-5
-15
-3
-9
-4
-3
-3
-6
-29
-3
-3
-4
-5
-5
-3
-8
-5
-6
-6
-7
-5
-3
-5
-3
-29
-2
-31
-5
-15
-24
-16
-5
-207
-4
-3
-3
-2
-15
-4
-4
-13
-5
-5
-4
-6
-10
-2
-7
-8
-4
-6
-20
-5
-3
-4
-3
-12
-12
-5
-17
-7
-3
-3
-3
-6
-10
-3
-5
-25
-80
-4
-9
-3
-2
-11
-3
-3
-2
-3
-8
-7
-5
-5
-19
-5
-3
-3
-12
-11
-2
-6
-5
-5
-5
-3
-3
-3
-4
-209
-14
-3
-2
-5
-19
-4
-4
-3
-4
-14
-5
-6
-4
-13
-9
-7
-4
-7
-10
-2
-9
-5
-7
-2
-8
-4
-6
-5
-5
-222
-8
-7
-12
-5
-216
-3
-4
-4
-6
-3
-14
-8
-7
-13
-4
-3
-3
-3
-3
-17
-5
-4
-3
-33
-6
-6
-33
-7
-5
-3
-8
-7
-5
-2
-9
-4
-2
-233
-24
-7
-4
-8
-10
-3
-4
-15
-2
-16
-3
-3
-13
-12
-7
-5
-4
-207
-4
-2
-4
-27
-15
-2
-5
-2
-25
-6
-5
-5
-6
-13
-6
-18
-6
-4
-12
-225
-10
-7
-5
-2
-2
-11
-4
-14
-21
-8
-10
-3
-5
-4
-232
-2
-5
-5
-3
-7
-17
-11
-6
-6
-23
-4
-6
-3
-5
-4
-2
-17
-3
-6
-5
-8
-3
-2
-2
-14
-9
-4
-4
-2
-5
-5
-3
-7
-6
-12
-6
-10
-3
-6
-2
-2
-19
-5
-4
-4
-9
-2
-4
-13
-3
-5
-6
-3
-6
-5
-4
-9
-6
-3
-5
-7
-3
-6
-6
-4
-3
-10
-6
-3
-221
-3
-5
-3
-6
-4
-8
-5
-3
-6
-4
-4
-2
-54
-5
-6
-11
-3
-3
-4
-4
-4
-3
-7
-3
-11
-11
-7
-10
-6
-13
-223
-213
-15
-231
-7
-3
-7
-228
-2
-3
-4
-4
-5
-6
-7
-4
-13
-3
-4
-5
-3
-6
-4
-6
-7
-2
-4
-3
-4
-3
-3
-6
-3
-7
-3
-5
-18
-5
-6
-8
-10
-3
-3
-3
-2
-4
-2
-4
-4
-5
-6
-6
-4
-10
-13
-3
-12
-5
-12
-16
-8
-4
-19
-11
-2
-4
-5
-6
-8
-5
-6
-4
-18
-10
-4
-2
-216
-6
-6
-6
-2
-4
-12
-8
-3
-11
-5
-6
-14
-5
-3
-13
-4
-5
-4
-5
-3
-28
-6
-3
-7
-219
-3
-9
-7
-3
-10
-6
-3
-4
-19
-5
-7
-11
-6
-15
-19
-4
-13
-11
-3
-7
-5
-10
-2
-8
-11
-2
-6
-4
-6
-24
-6
-3
-3
-3
-3
-6
-18
-4
-11
-4
-2
-5
-10
-8
-3
-9
-5
-3
-4
-5
-6
-2
-5
-7
-4
-4
-14
-6
-4
-4
-5
-5
-7
-2
-4
-3
-7
-3
-3
-6
-4
-5
-4
-4
-4
-3
-3
-3
-3
-8
-14
-2
-3
-5
-3
-2
-4
-5
-3
-7
-3
-3
-18
-3
-4
-4
-5
-7
-3
-3
-3
-13
-5
-4
-8
-211
-5
-5
-3
-5
-2
-5
-4
-2
-655
-6
-3
-5
-11
-2
-5
-3
-12
-9
-15
-11
-5
-12
-217
-2
-6
-17
-3
-3
-207
-5
-5
-4
-5
-9
-3
-2
-8
-5
-4
-3
-2
-5
-12
-4
-14
-5
-4
-2
-13
-5
-8
-4
-225
-4
-3
-4
-5
-4
-3
-3
-6
-23
-9
-2
-6
-7
-233
-4
-4
-6
-18
-3
-4
-6
-3
-4
-4
-2
-3
-7
-4
-13
-227
-4
-3
-5
-4
-2
-12
-9
-17
-3
-7
-14
-6
-4
-5
-21
-4
-8
-9
-2
-9
-25
-16
-3
-6
-4
-7
-8
-5
-2
-3
-5
-4
-3
-3
-5
-3
-3
-3
-2
-3
-19
-2
-4
-3
-4
-2
-3
-4
-4
-2
-4
-3
-3
-3
-2
-6
-3
-17
-5
-6
-4
-3
-13
-5
-3
-3
-3
-4
-9
-4
-2
-14
-12
-4
-5
-24
-4
-3
-37
-12
-11
-21
-3
-4
-3
-13
-4
-2
-3
-15
-4
-11
-4
-4
-3
-8
-3
-4
-4
-12
-8
-5
-3
-3
-4
-2
-220
-3
-5
-223
-3
-3
-3
-10
-3
-15
-4
-241
-9
-7
-3
-6
-6
-23
-4
-13
-7
-3
-4
-7
-4
-9
-3
-3
-4
-10
-5
-5
-1
-5
-24
-2
-4
-5
-5
-6
-14
-3
-8
-2
-3
-5
-13
-13
-3
-5
-2
-3
-15
-3
-4
-2
-10
-4
-4
-4
-5
-5
-3
-5
-3
-4
-7
-4
-27
-3
-6
-4
-15
-3
-5
-6
-6
-5
-4
-8
-3
-9
-2
-6
-3
-4
-3
-7
-4
-18
-3
-11
-3
-3
-8
-9
-7
-24
-3
-219
-7
-10
-4
-5
-9
-12
-2
-5
-4
-4
-4
-3
-3
-19
-5
-8
-16
-8
-6
-22
-3
-23
-3
-242
-9
-4
-3
-3
-5
-7
-3
-3
-5
-8
-3
-7
-5
-14
-8
-10
-3
-4
-3
-7
-4
-6
-7
-4
-10
-4
-3
-11
-3
-7
-10
-3
-13
-6
-8
-12
-10
-5
-7
-9
-3
-4
-7
-7
-10
-8
-30
-9
-19
-4
-3
-19
-15
-4
-13
-3
-215
-223
-4
-7
-4
-8
-17
-16
-3
-7
-6
-5
-5
-4
-12
-3
-7
-4
-4
-13
-4
-5
-2
-5
-6
-5
-6
-6
-7
-10
-18
-23
-9
-3
-3
-6
-5
-2
-4
-2
-7
-3
-3
-2
-5
-5
-14
-10
-224
-6
-3
-4
-3
-7
-5
-9
-3
-6
-4
-2
-5
-11
-4
-3
-3
-2
-8
-4
-7
-4
-10
-7
-3
-3
-18
-18
-17
-3
-3
-3
-4
-5
-3
-3
-4
-12
-7
-3
-11
-13
-5
-4
-7
-13
-5
-4
-11
-3
-12
-3
-6
-4
-4
-21
-4
-6
-9
-5
-3
-10
-8
-4
-6
-4
-4
-6
-5
-4
-8
-6
-4
-6
-4
-4
-5
-9
-6
-3
-4
-2
-9
-3
-18
-2
-4
-3
-13
-3
-6
-6
-8
-7
-9
-3
-2
-16
-3
-4
-6
-3
-2
-33
-22
-14
-4
-9
-12
-4
-5
-6
-3
-23
-9
-4
-3
-5
-5
-3
-4
-5
-3
-5
-3
-10
-4
-5
-5
-8
-4
-4
-6
-8
-5
-4
-3
-4
-6
-3
-3
-3
-5
-9
-12
-6
-5
-9
-3
-5
-3
-2
-2
-2
-18
-3
-2
-21
-2
-5
-4
-6
-4
-5
-10
-3
-9
-3
-2
-10
-7
-3
-6
-6
-4
-4
-8
-12
-7
-3
-7
-3
-3
-9
-3
-4
-5
-4
-4
-5
-5
-10
-15
-4
-4
-14
-6
-227
-3
-14
-5
-216
-22
-5
-4
-2
-2
-6
-3
-4
-2
-9
-9
-4
-3
-28
-13
-11
-4
-5
-3
-3
-2
-3
-3
-5
-3
-4
-3
-5
-23
-26
-3
-4
-5
-6
-4
-6
-3
-5
-5
-3
-4
-3
-2
-2
-2
-7
-14
-3
-6
-7
-17
-2
-2
-15
-14
-16
-4
-6
-7
-13
-6
-4
-5
-6
-16
-3
-3
-28
-3
-6
-15
-3
-9
-2
-4
-6
-3
-3
-22
-4
-12
-6
-7
-2
-5
-4
-10
-3
-16
-6
-9
-2
-5
-12
-7
-5
-5
-5
-5
-2
-11
-9
-17
-4
-3
-11
-7
-3
-5
-15
-4
-3
-4
-211
-8
-7
-5
-4
-7
-6
-7
-6
-3
-6
-5
-6
-5
-3
-4
-4
-26
-4
-6
-10
-4
-4
-3
-2
-3
-3
-4
-5
-9
-3
-9
-4
-4
-5
-5
-8
-2
-4
-2
-3
-8
-4
-11
-19
-5
-8
-6
-3
-5
-6
-12
-3
-2
-4
-16
-12
-3
-4
-4
-8
-6
-5
-6
-6
-219
-8
-222
-6
-16
-3
-13
-19
-5
-4
-3
-11
-6
-10
-4
-7
-7
-12
-5
-3
-3
-5
-6
-10
-3
-8
-2
-5
-4
-7
-2
-4
-4
-2
-12
-9
-6
-4
-2
-40
-2
-4
-10
-4
-223
-4
-2
-20
-6
-7
-24
-5
-4
-5
-2
-20
-16
-6
-5
-13
-2
-3
-3
-19
-3
-2
-4
-5
-6
-7
-11
-12
-5
-6
-7
-7
-3
-5
-3
-5
-3
-14
-3
-4
-4
-2
-11
-1
-7
-3
-9
-6
-11
-12
-5
-8
-6
-221
-4
-2
-12
-4
-3
-15
-4
-5
-226
-7
-218
-7
-5
-4
-5
-18
-4
-5
-9
-4
-4
-2
-9
-18
-18
-9
-5
-6
-6
-3
-3
-7
-3
-5
-4
-4
-4
-12
-3
-6
-31
-5
-4
-7
-3
-6
-5
-6
-5
-11
-2
-2
-11
-11
-6
-7
-5
-8
-7
-10
-5
-23
-7
-4
-3
-5
-34
-2
-5
-23
-7
-3
-6
-8
-4
-4
-4
-2
-5
-3
-8
-5
-4
-8
-25
-2
-3
-17
-8
-3
-4
-8
-7
-3
-15
-6
-5
-7
-21
-9
-5
-6
-6
-5
-3
-2
-3
-10
-3
-6
-3
-14
-7
-4
-4
-8
-7
-8
-2
-6
-12
-4
-213
-6
-5
-21
-8
-2
-5
-23
-3
-11
-2
-3
-6
-25
-2
-3
-6
-7
-6
-6
-4
-4
-6
-3
-17
-9
-7
-6
-4
-3
-10
-7
-2
-3
-3
-3
-11
-8
-3
-7
-6
-4
-14
-36
-3
-4
-3
-3
-22
-13
-21
-4
-2
-7
-4
-4
-17
-15
-3
-7
-11
-2
-4
-7
-6
-209
-6
-3
-2
-2
-24
-4
-9
-4
-3
-3
-3
-29
-2
-2
-4
-3
-3
-5
-4
-6
-3
-3
-2
-4
diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go
deleted file mode 100644
index d7d14f8..0000000
--- a/vendor/github.com/beorn7/perks/quantile/stream.go
+++ /dev/null
@@ -1,316 +0,0 @@
-// Package quantile computes approximate quantiles over an unbounded data
-// stream within low memory and CPU bounds.
-//
-// A small amount of accuracy is traded to achieve the above properties.
-//
-// Multiple streams can be merged before calling Query to generate a single set
-// of results. This is meaningful when the streams represent the same type of
-// data. See Merge and Samples.
-//
-// For more detailed information about the algorithm used, see:
-//
-// Effective Computation of Biased Quantiles over Data Streams
-//
-// http://www.cs.rutgers.edu/~muthu/bquant.pdf
-package quantile
-
-import (
- "math"
- "sort"
-)
-
-// Sample holds an observed value and meta information for compression. JSON
-// tags have been added for convenience.
-type Sample struct {
- Value float64 `json:",string"`
- Width float64 `json:",string"`
- Delta float64 `json:",string"`
-}
-
-// Samples represents a slice of samples. It implements sort.Interface.
-type Samples []Sample
-
-func (a Samples) Len() int { return len(a) }
-func (a Samples) Less(i, j int) bool { return a[i].Value < a[j].Value }
-func (a Samples) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-type invariant func(s *stream, r float64) float64
-
-// NewLowBiased returns an initialized Stream for low-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the lower ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within (1±Epsilon)*Quantile.
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewLowBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * r
- }
- return newStream(ƒ)
-}
-
-// NewHighBiased returns an initialized Stream for high-biased quantiles
-// (e.g. 0.01, 0.1, 0.5) where the needed quantiles are not known a priori, but
-// error guarantees can still be given even for the higher ranks of the data
-// distribution.
-//
-// The provided epsilon is a relative error, i.e. the true quantile of a value
-// returned by a query is guaranteed to be within 1-(1±Epsilon)*(1-Quantile).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error
-// properties.
-func NewHighBiased(epsilon float64) *Stream {
- ƒ := func(s *stream, r float64) float64 {
- return 2 * epsilon * (s.n - r)
- }
- return newStream(ƒ)
-}
-
-// NewTargeted returns an initialized Stream concerned with a particular set of
-// quantile values that are supplied a priori. Knowing these a priori reduces
-// space and computation time. The targets map maps the desired quantiles to
-// their absolute errors, i.e. the true quantile of a value returned by a query
-// is guaranteed to be within (Quantile±Epsilon).
-//
-// See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties.
-func NewTargeted(targetMap map[float64]float64) *Stream {
- // Convert map to slice to avoid slow iterations on a map.
- // ƒ is called on the hot path, so converting the map to a slice
- // beforehand results in significant CPU savings.
- targets := targetMapToSlice(targetMap)
-
- ƒ := func(s *stream, r float64) float64 {
- var m = math.MaxFloat64
- var f float64
- for _, t := range targets {
- if t.quantile*s.n <= r {
- f = (2 * t.epsilon * r) / t.quantile
- } else {
- f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile)
- }
- if f < m {
- m = f
- }
- }
- return m
- }
- return newStream(ƒ)
-}
-
-type target struct {
- quantile float64
- epsilon float64
-}
-
-func targetMapToSlice(targetMap map[float64]float64) []target {
- targets := make([]target, 0, len(targetMap))
-
- for quantile, epsilon := range targetMap {
- t := target{
- quantile: quantile,
- epsilon: epsilon,
- }
- targets = append(targets, t)
- }
-
- return targets
-}
-
-// Stream computes quantiles for a stream of float64s. It is not thread-safe by
-// design. Take care when using across multiple goroutines.
-type Stream struct {
- *stream
- b Samples
- sorted bool
-}
-
-func newStream(ƒ invariant) *Stream {
- x := &stream{ƒ: ƒ}
- return &Stream{x, make(Samples, 0, 500), true}
-}
-
-// Insert inserts v into the stream.
-func (s *Stream) Insert(v float64) {
- s.insert(Sample{Value: v, Width: 1})
-}
-
-func (s *Stream) insert(sample Sample) {
- s.b = append(s.b, sample)
- s.sorted = false
- if len(s.b) == cap(s.b) {
- s.flush()
- }
-}
-
-// Query returns the computed qth percentiles value. If s was created with
-// NewTargeted, and q is not in the set of quantiles provided a priori, Query
-// will return an unspecified result.
-func (s *Stream) Query(q float64) float64 {
- if !s.flushed() {
- // Fast path when there hasn't been enough data for a flush;
- // this also yields better accuracy for small sets of data.
- l := len(s.b)
- if l == 0 {
- return 0
- }
- i := int(math.Ceil(float64(l) * q))
- if i > 0 {
- i -= 1
- }
- s.maybeSort()
- return s.b[i].Value
- }
- s.flush()
- return s.stream.query(q)
-}
-
-// Merge merges samples into the underlying streams samples. This is handy when
-// merging multiple streams from separate threads, database shards, etc.
-//
-// ATTENTION: This method is broken and does not yield correct results. The
-// underlying algorithm is not capable of merging streams correctly.
-func (s *Stream) Merge(samples Samples) {
- sort.Sort(samples)
- s.stream.merge(samples)
-}
-
-// Reset reinitializes and clears the list reusing the samples buffer memory.
-func (s *Stream) Reset() {
- s.stream.reset()
- s.b = s.b[:0]
-}
-
-// Samples returns stream samples held by s.
-func (s *Stream) Samples() Samples {
- if !s.flushed() {
- return s.b
- }
- s.flush()
- return s.stream.samples()
-}
-
-// Count returns the total number of samples observed in the stream
-// since initialization.
-func (s *Stream) Count() int {
- return len(s.b) + s.stream.count()
-}
-
-func (s *Stream) flush() {
- s.maybeSort()
- s.stream.merge(s.b)
- s.b = s.b[:0]
-}
-
-func (s *Stream) maybeSort() {
- if !s.sorted {
- s.sorted = true
- sort.Sort(s.b)
- }
-}
-
-func (s *Stream) flushed() bool {
- return len(s.stream.l) > 0
-}
-
-type stream struct {
- n float64
- l []Sample
- ƒ invariant
-}
-
-func (s *stream) reset() {
- s.l = s.l[:0]
- s.n = 0
-}
-
-func (s *stream) insert(v float64) {
- s.merge(Samples{{v, 1, 0}})
-}
-
-func (s *stream) merge(samples Samples) {
- // TODO(beorn7): This tries to merge not only individual samples, but
- // whole summaries. The paper doesn't mention merging summaries at
- // all. Unittests show that the merging is inaccurate. Find out how to
- // do merges properly.
- var r float64
- i := 0
- for _, sample := range samples {
- for ; i < len(s.l); i++ {
- c := s.l[i]
- if c.Value > sample.Value {
- // Insert at position i.
- s.l = append(s.l, Sample{})
- copy(s.l[i+1:], s.l[i:])
- s.l[i] = Sample{
- sample.Value,
- sample.Width,
- math.Max(sample.Delta, math.Floor(s.ƒ(s, r))-1),
- // TODO(beorn7): How to calculate delta correctly?
- }
- i++
- goto inserted
- }
- r += c.Width
- }
- s.l = append(s.l, Sample{sample.Value, sample.Width, 0})
- i++
- inserted:
- s.n += sample.Width
- r += sample.Width
- }
- s.compress()
-}
-
-func (s *stream) count() int {
- return int(s.n)
-}
-
-func (s *stream) query(q float64) float64 {
- t := math.Ceil(q * s.n)
- t += math.Ceil(s.ƒ(s, t) / 2)
- p := s.l[0]
- var r float64
- for _, c := range s.l[1:] {
- r += p.Width
- if r+c.Width+c.Delta > t {
- return p.Value
- }
- p = c
- }
- return p.Value
-}
-
-func (s *stream) compress() {
- if len(s.l) < 2 {
- return
- }
- x := s.l[len(s.l)-1]
- xi := len(s.l) - 1
- r := s.n - 1 - x.Width
-
- for i := len(s.l) - 2; i >= 0; i-- {
- c := s.l[i]
- if c.Width+x.Width+x.Delta <= s.ƒ(s, r) {
- x.Width += c.Width
- s.l[xi] = x
- // Remove element at i.
- copy(s.l[i:], s.l[i+1:])
- s.l = s.l[:len(s.l)-1]
- xi -= 1
- } else {
- x = c
- xi = i
- }
- r -= c.Width
- }
-}
-
-func (s *stream) samples() Samples {
- samples := make(Samples, len(s.l))
- copy(samples, s.l)
- return samples
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt
deleted file mode 100644
index 24b5306..0000000
--- a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2016 Caleb Spare
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md
deleted file mode 100644
index 8bf0e5b..0000000
--- a/vendor/github.com/cespare/xxhash/v2/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-# xxhash
-
-[![Go Reference](https://pkg.go.dev/badge/github.com/cespare/xxhash/v2.svg)](https://pkg.go.dev/github.com/cespare/xxhash/v2)
-[![Test](https://github.com/cespare/xxhash/actions/workflows/test.yml/badge.svg)](https://github.com/cespare/xxhash/actions/workflows/test.yml)
-
-xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a
-high-quality hashing algorithm that is much faster than anything in the Go
-standard library.
-
-This package provides a straightforward API:
-
-```
-func Sum64(b []byte) uint64
-func Sum64String(s string) uint64
-type Digest struct{ ... }
- func New() *Digest
-```
-
-The `Digest` type implements hash.Hash64. Its key methods are:
-
-```
-func (*Digest) Write([]byte) (int, error)
-func (*Digest) WriteString(string) (int, error)
-func (*Digest) Sum64() uint64
-```
-
-The package is written with optimized pure Go and also contains even faster
-assembly implementations for amd64 and arm64. If desired, the `purego` build tag
-opts into using the Go code even on those architectures.
-
-[xxHash]: http://cyan4973.github.io/xxHash/
-
-## Compatibility
-
-This package is in a module and the latest code is in version 2 of the module.
-You need a version of Go with at least "minimal module compatibility" to use
-github.com/cespare/xxhash/v2:
-
-* 1.9.7+ for Go 1.9
-* 1.10.3+ for Go 1.10
-* Go 1.11 or later
-
-I recommend using the latest release of Go.
-
-## Benchmarks
-
-Here are some quick benchmarks comparing the pure-Go and assembly
-implementations of Sum64.
-
-| input size | purego | asm |
-| ---------- | --------- | --------- |
-| 4 B | 1.3 GB/s | 1.2 GB/s |
-| 16 B | 2.9 GB/s | 3.5 GB/s |
-| 100 B | 6.9 GB/s | 8.1 GB/s |
-| 4 KB | 11.7 GB/s | 16.7 GB/s |
-| 10 MB | 12.0 GB/s | 17.3 GB/s |
-
-These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C
-CPU using the following commands under Go 1.19.2:
-
-```
-benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$')
-benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$')
-```
-
-## Projects using this package
-
-- [InfluxDB](https://github.com/influxdata/influxdb)
-- [Prometheus](https://github.com/prometheus/prometheus)
-- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics)
-- [FreeCache](https://github.com/coocood/freecache)
-- [FastCache](https://github.com/VictoriaMetrics/fastcache)
diff --git a/vendor/github.com/cespare/xxhash/v2/testall.sh b/vendor/github.com/cespare/xxhash/v2/testall.sh
deleted file mode 100644
index 94b9c44..0000000
--- a/vendor/github.com/cespare/xxhash/v2/testall.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-set -eu -o pipefail
-
-# Small convenience script for running the tests with various combinations of
-# arch/tags. This assumes we're running on amd64 and have qemu available.
-
-go test ./...
-go test -tags purego ./...
-GOARCH=arm64 go test
-GOARCH=arm64 go test -tags purego
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go
deleted file mode 100644
index a9e0d45..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash.go
+++ /dev/null
@@ -1,228 +0,0 @@
-// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
-// at http://cyan4973.github.io/xxHash/.
-package xxhash
-
-import (
- "encoding/binary"
- "errors"
- "math/bits"
-)
-
-const (
- prime1 uint64 = 11400714785074694791
- prime2 uint64 = 14029467366897019727
- prime3 uint64 = 1609587929392839161
- prime4 uint64 = 9650029242287828579
- prime5 uint64 = 2870177450012600261
-)
-
-// Store the primes in an array as well.
-//
-// The consts are used when possible in Go code to avoid MOVs but we need a
-// contiguous array of the assembly code.
-var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5}
-
-// Digest implements hash.Hash64.
-type Digest struct {
- v1 uint64
- v2 uint64
- v3 uint64
- v4 uint64
- total uint64
- mem [32]byte
- n int // how much of mem is used
-}
-
-// New creates a new Digest that computes the 64-bit xxHash algorithm.
-func New() *Digest {
- var d Digest
- d.Reset()
- return &d
-}
-
-// Reset clears the Digest's state so that it can be reused.
-func (d *Digest) Reset() {
- d.v1 = primes[0] + prime2
- d.v2 = prime2
- d.v3 = 0
- d.v4 = -primes[0]
- d.total = 0
- d.n = 0
-}
-
-// Size always returns 8 bytes.
-func (d *Digest) Size() int { return 8 }
-
-// BlockSize always returns 32 bytes.
-func (d *Digest) BlockSize() int { return 32 }
-
-// Write adds more data to d. It always returns len(b), nil.
-func (d *Digest) Write(b []byte) (n int, err error) {
- n = len(b)
- d.total += uint64(n)
-
- memleft := d.mem[d.n&(len(d.mem)-1):]
-
- if d.n+n < 32 {
- // This new data doesn't even fill the current block.
- copy(memleft, b)
- d.n += n
- return
- }
-
- if d.n > 0 {
- // Finish off the partial block.
- c := copy(memleft, b)
- d.v1 = round(d.v1, u64(d.mem[0:8]))
- d.v2 = round(d.v2, u64(d.mem[8:16]))
- d.v3 = round(d.v3, u64(d.mem[16:24]))
- d.v4 = round(d.v4, u64(d.mem[24:32]))
- b = b[c:]
- d.n = 0
- }
-
- if len(b) >= 32 {
- // One or more full blocks left.
- nw := writeBlocks(d, b)
- b = b[nw:]
- }
-
- // Store any remaining partial block.
- copy(d.mem[:], b)
- d.n = len(b)
-
- return
-}
-
-// Sum appends the current hash to b and returns the resulting slice.
-func (d *Digest) Sum(b []byte) []byte {
- s := d.Sum64()
- return append(
- b,
- byte(s>>56),
- byte(s>>48),
- byte(s>>40),
- byte(s>>32),
- byte(s>>24),
- byte(s>>16),
- byte(s>>8),
- byte(s),
- )
-}
-
-// Sum64 returns the current hash.
-func (d *Digest) Sum64() uint64 {
- var h uint64
-
- if d.total >= 32 {
- v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
- h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
- h = mergeRound(h, v1)
- h = mergeRound(h, v2)
- h = mergeRound(h, v3)
- h = mergeRound(h, v4)
- } else {
- h = d.v3 + prime5
- }
-
- h += d.total
-
- b := d.mem[:d.n&(len(d.mem)-1)]
- for ; len(b) >= 8; b = b[8:] {
- k1 := round(0, u64(b[:8]))
- h ^= k1
- h = rol27(h)*prime1 + prime4
- }
- if len(b) >= 4 {
- h ^= uint64(u32(b[:4])) * prime1
- h = rol23(h)*prime2 + prime3
- b = b[4:]
- }
- for ; len(b) > 0; b = b[1:] {
- h ^= uint64(b[0]) * prime5
- h = rol11(h) * prime1
- }
-
- h ^= h >> 33
- h *= prime2
- h ^= h >> 29
- h *= prime3
- h ^= h >> 32
-
- return h
-}
-
-const (
- magic = "xxh\x06"
- marshaledSize = len(magic) + 8*5 + 32
-)
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (d *Digest) MarshalBinary() ([]byte, error) {
- b := make([]byte, 0, marshaledSize)
- b = append(b, magic...)
- b = appendUint64(b, d.v1)
- b = appendUint64(b, d.v2)
- b = appendUint64(b, d.v3)
- b = appendUint64(b, d.v4)
- b = appendUint64(b, d.total)
- b = append(b, d.mem[:d.n]...)
- b = b[:len(b)+len(d.mem)-d.n]
- return b, nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-func (d *Digest) UnmarshalBinary(b []byte) error {
- if len(b) < len(magic) || string(b[:len(magic)]) != magic {
- return errors.New("xxhash: invalid hash state identifier")
- }
- if len(b) != marshaledSize {
- return errors.New("xxhash: invalid hash state size")
- }
- b = b[len(magic):]
- b, d.v1 = consumeUint64(b)
- b, d.v2 = consumeUint64(b)
- b, d.v3 = consumeUint64(b)
- b, d.v4 = consumeUint64(b)
- b, d.total = consumeUint64(b)
- copy(d.mem[:], b)
- d.n = int(d.total % uint64(len(d.mem)))
- return nil
-}
-
-func appendUint64(b []byte, x uint64) []byte {
- var a [8]byte
- binary.LittleEndian.PutUint64(a[:], x)
- return append(b, a[:]...)
-}
-
-func consumeUint64(b []byte) ([]byte, uint64) {
- x := u64(b)
- return b[8:], x
-}
-
-func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) }
-func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) }
-
-func round(acc, input uint64) uint64 {
- acc += input * prime2
- acc = rol31(acc)
- acc *= prime1
- return acc
-}
-
-func mergeRound(acc, val uint64) uint64 {
- val = round(0, val)
- acc ^= val
- acc = acc*prime1 + prime4
- return acc
-}
-
-func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) }
-func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) }
-func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) }
-func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) }
-func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) }
-func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) }
-func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) }
-func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) }
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
deleted file mode 100644
index 3e8b132..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
+++ /dev/null
@@ -1,209 +0,0 @@
-//go:build !appengine && gc && !purego
-// +build !appengine
-// +build gc
-// +build !purego
-
-#include "textflag.h"
-
-// Registers:
-#define h AX
-#define d AX
-#define p SI // pointer to advance through b
-#define n DX
-#define end BX // loop end
-#define v1 R8
-#define v2 R9
-#define v3 R10
-#define v4 R11
-#define x R12
-#define prime1 R13
-#define prime2 R14
-#define prime4 DI
-
-#define round(acc, x) \
- IMULQ prime2, x \
- ADDQ x, acc \
- ROLQ $31, acc \
- IMULQ prime1, acc
-
-// round0 performs the operation x = round(0, x).
-#define round0(x) \
- IMULQ prime2, x \
- ROLQ $31, x \
- IMULQ prime1, x
-
-// mergeRound applies a merge round on the two registers acc and x.
-// It assumes that prime1, prime2, and prime4 have been loaded.
-#define mergeRound(acc, x) \
- round0(x) \
- XORQ x, acc \
- IMULQ prime1, acc \
- ADDQ prime4, acc
-
-// blockLoop processes as many 32-byte blocks as possible,
-// updating v1, v2, v3, and v4. It assumes that there is at least one block
-// to process.
-#define blockLoop() \
-loop: \
- MOVQ +0(p), x \
- round(v1, x) \
- MOVQ +8(p), x \
- round(v2, x) \
- MOVQ +16(p), x \
- round(v3, x) \
- MOVQ +24(p), x \
- round(v4, x) \
- ADDQ $32, p \
- CMPQ p, end \
- JLE loop
-
-// func Sum64(b []byte) uint64
-TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32
- // Load fixed primes.
- MOVQ ·primes+0(SB), prime1
- MOVQ ·primes+8(SB), prime2
- MOVQ ·primes+24(SB), prime4
-
- // Load slice.
- MOVQ b_base+0(FP), p
- MOVQ b_len+8(FP), n
- LEAQ (p)(n*1), end
-
- // The first loop limit will be len(b)-32.
- SUBQ $32, end
-
- // Check whether we have at least one block.
- CMPQ n, $32
- JLT noBlocks
-
- // Set up initial state (v1, v2, v3, v4).
- MOVQ prime1, v1
- ADDQ prime2, v1
- MOVQ prime2, v2
- XORQ v3, v3
- XORQ v4, v4
- SUBQ prime1, v4
-
- blockLoop()
-
- MOVQ v1, h
- ROLQ $1, h
- MOVQ v2, x
- ROLQ $7, x
- ADDQ x, h
- MOVQ v3, x
- ROLQ $12, x
- ADDQ x, h
- MOVQ v4, x
- ROLQ $18, x
- ADDQ x, h
-
- mergeRound(h, v1)
- mergeRound(h, v2)
- mergeRound(h, v3)
- mergeRound(h, v4)
-
- JMP afterBlocks
-
-noBlocks:
- MOVQ ·primes+32(SB), h
-
-afterBlocks:
- ADDQ n, h
-
- ADDQ $24, end
- CMPQ p, end
- JG try4
-
-loop8:
- MOVQ (p), x
- ADDQ $8, p
- round0(x)
- XORQ x, h
- ROLQ $27, h
- IMULQ prime1, h
- ADDQ prime4, h
-
- CMPQ p, end
- JLE loop8
-
-try4:
- ADDQ $4, end
- CMPQ p, end
- JG try1
-
- MOVL (p), x
- ADDQ $4, p
- IMULQ prime1, x
- XORQ x, h
-
- ROLQ $23, h
- IMULQ prime2, h
- ADDQ ·primes+16(SB), h
-
-try1:
- ADDQ $4, end
- CMPQ p, end
- JGE finalize
-
-loop1:
- MOVBQZX (p), x
- ADDQ $1, p
- IMULQ ·primes+32(SB), x
- XORQ x, h
- ROLQ $11, h
- IMULQ prime1, h
-
- CMPQ p, end
- JL loop1
-
-finalize:
- MOVQ h, x
- SHRQ $33, x
- XORQ x, h
- IMULQ prime2, h
- MOVQ h, x
- SHRQ $29, x
- XORQ x, h
- IMULQ ·primes+16(SB), h
- MOVQ h, x
- SHRQ $32, x
- XORQ x, h
-
- MOVQ h, ret+24(FP)
- RET
-
-// func writeBlocks(d *Digest, b []byte) int
-TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40
- // Load fixed primes needed for round.
- MOVQ ·primes+0(SB), prime1
- MOVQ ·primes+8(SB), prime2
-
- // Load slice.
- MOVQ b_base+8(FP), p
- MOVQ b_len+16(FP), n
- LEAQ (p)(n*1), end
- SUBQ $32, end
-
- // Load vN from d.
- MOVQ s+0(FP), d
- MOVQ 0(d), v1
- MOVQ 8(d), v2
- MOVQ 16(d), v3
- MOVQ 24(d), v4
-
- // We don't need to check the loop condition here; this function is
- // always called with at least one block of data to process.
- blockLoop()
-
- // Copy vN back to d.
- MOVQ v1, 0(d)
- MOVQ v2, 8(d)
- MOVQ v3, 16(d)
- MOVQ v4, 24(d)
-
- // The number of bytes written is p minus the old base pointer.
- SUBQ b_base+8(FP), p
- MOVQ p, ret+32(FP)
-
- RET
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
deleted file mode 100644
index 7e3145a..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
+++ /dev/null
@@ -1,183 +0,0 @@
-//go:build !appengine && gc && !purego
-// +build !appengine
-// +build gc
-// +build !purego
-
-#include "textflag.h"
-
-// Registers:
-#define digest R1
-#define h R2 // return value
-#define p R3 // input pointer
-#define n R4 // input length
-#define nblocks R5 // n / 32
-#define prime1 R7
-#define prime2 R8
-#define prime3 R9
-#define prime4 R10
-#define prime5 R11
-#define v1 R12
-#define v2 R13
-#define v3 R14
-#define v4 R15
-#define x1 R20
-#define x2 R21
-#define x3 R22
-#define x4 R23
-
-#define round(acc, x) \
- MADD prime2, acc, x, acc \
- ROR $64-31, acc \
- MUL prime1, acc
-
-// round0 performs the operation x = round(0, x).
-#define round0(x) \
- MUL prime2, x \
- ROR $64-31, x \
- MUL prime1, x
-
-#define mergeRound(acc, x) \
- round0(x) \
- EOR x, acc \
- MADD acc, prime4, prime1, acc
-
-// blockLoop processes as many 32-byte blocks as possible,
-// updating v1, v2, v3, and v4. It assumes that n >= 32.
-#define blockLoop() \
- LSR $5, n, nblocks \
- PCALIGN $16 \
- loop: \
- LDP.P 16(p), (x1, x2) \
- LDP.P 16(p), (x3, x4) \
- round(v1, x1) \
- round(v2, x2) \
- round(v3, x3) \
- round(v4, x4) \
- SUB $1, nblocks \
- CBNZ nblocks, loop
-
-// func Sum64(b []byte) uint64
-TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32
- LDP b_base+0(FP), (p, n)
-
- LDP ·primes+0(SB), (prime1, prime2)
- LDP ·primes+16(SB), (prime3, prime4)
- MOVD ·primes+32(SB), prime5
-
- CMP $32, n
- CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 }
- BLT afterLoop
-
- ADD prime1, prime2, v1
- MOVD prime2, v2
- MOVD $0, v3
- NEG prime1, v4
-
- blockLoop()
-
- ROR $64-1, v1, x1
- ROR $64-7, v2, x2
- ADD x1, x2
- ROR $64-12, v3, x3
- ROR $64-18, v4, x4
- ADD x3, x4
- ADD x2, x4, h
-
- mergeRound(h, v1)
- mergeRound(h, v2)
- mergeRound(h, v3)
- mergeRound(h, v4)
-
-afterLoop:
- ADD n, h
-
- TBZ $4, n, try8
- LDP.P 16(p), (x1, x2)
-
- round0(x1)
-
- // NOTE: here and below, sequencing the EOR after the ROR (using a
- // rotated register) is worth a small but measurable speedup for small
- // inputs.
- ROR $64-27, h
- EOR x1 @> 64-27, h, h
- MADD h, prime4, prime1, h
-
- round0(x2)
- ROR $64-27, h
- EOR x2 @> 64-27, h, h
- MADD h, prime4, prime1, h
-
-try8:
- TBZ $3, n, try4
- MOVD.P 8(p), x1
-
- round0(x1)
- ROR $64-27, h
- EOR x1 @> 64-27, h, h
- MADD h, prime4, prime1, h
-
-try4:
- TBZ $2, n, try2
- MOVWU.P 4(p), x2
-
- MUL prime1, x2
- ROR $64-23, h
- EOR x2 @> 64-23, h, h
- MADD h, prime3, prime2, h
-
-try2:
- TBZ $1, n, try1
- MOVHU.P 2(p), x3
- AND $255, x3, x1
- LSR $8, x3, x2
-
- MUL prime5, x1
- ROR $64-11, h
- EOR x1 @> 64-11, h, h
- MUL prime1, h
-
- MUL prime5, x2
- ROR $64-11, h
- EOR x2 @> 64-11, h, h
- MUL prime1, h
-
-try1:
- TBZ $0, n, finalize
- MOVBU (p), x4
-
- MUL prime5, x4
- ROR $64-11, h
- EOR x4 @> 64-11, h, h
- MUL prime1, h
-
-finalize:
- EOR h >> 33, h
- MUL prime2, h
- EOR h >> 29, h
- MUL prime3, h
- EOR h >> 32, h
-
- MOVD h, ret+24(FP)
- RET
-
-// func writeBlocks(d *Digest, b []byte) int
-TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40
- LDP ·primes+0(SB), (prime1, prime2)
-
- // Load state. Assume v[1-4] are stored contiguously.
- MOVD d+0(FP), digest
- LDP 0(digest), (v1, v2)
- LDP 16(digest), (v3, v4)
-
- LDP b_base+8(FP), (p, n)
-
- blockLoop()
-
- // Store updated state.
- STP (v1, v2), 0(digest)
- STP (v3, v4), 16(digest)
-
- BIC $31, n
- MOVD n, ret+32(FP)
- RET
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go b/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go
deleted file mode 100644
index 9216e0a..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_asm.go
+++ /dev/null
@@ -1,15 +0,0 @@
-//go:build (amd64 || arm64) && !appengine && gc && !purego
-// +build amd64 arm64
-// +build !appengine
-// +build gc
-// +build !purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-//
-//go:noescape
-func Sum64(b []byte) uint64
-
-//go:noescape
-func writeBlocks(d *Digest, b []byte) int
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go
deleted file mode 100644
index 26df13b..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go
+++ /dev/null
@@ -1,76 +0,0 @@
-//go:build (!amd64 && !arm64) || appengine || !gc || purego
-// +build !amd64,!arm64 appengine !gc purego
-
-package xxhash
-
-// Sum64 computes the 64-bit xxHash digest of b.
-func Sum64(b []byte) uint64 {
- // A simpler version would be
- // d := New()
- // d.Write(b)
- // return d.Sum64()
- // but this is faster, particularly for small inputs.
-
- n := len(b)
- var h uint64
-
- if n >= 32 {
- v1 := primes[0] + prime2
- v2 := prime2
- v3 := uint64(0)
- v4 := -primes[0]
- for len(b) >= 32 {
- v1 = round(v1, u64(b[0:8:len(b)]))
- v2 = round(v2, u64(b[8:16:len(b)]))
- v3 = round(v3, u64(b[16:24:len(b)]))
- v4 = round(v4, u64(b[24:32:len(b)]))
- b = b[32:len(b):len(b)]
- }
- h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
- h = mergeRound(h, v1)
- h = mergeRound(h, v2)
- h = mergeRound(h, v3)
- h = mergeRound(h, v4)
- } else {
- h = prime5
- }
-
- h += uint64(n)
-
- for ; len(b) >= 8; b = b[8:] {
- k1 := round(0, u64(b[:8]))
- h ^= k1
- h = rol27(h)*prime1 + prime4
- }
- if len(b) >= 4 {
- h ^= uint64(u32(b[:4])) * prime1
- h = rol23(h)*prime2 + prime3
- b = b[4:]
- }
- for ; len(b) > 0; b = b[1:] {
- h ^= uint64(b[0]) * prime5
- h = rol11(h) * prime1
- }
-
- h ^= h >> 33
- h *= prime2
- h ^= h >> 29
- h *= prime3
- h ^= h >> 32
-
- return h
-}
-
-func writeBlocks(d *Digest, b []byte) int {
- v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
- n := len(b)
- for len(b) >= 32 {
- v1 = round(v1, u64(b[0:8:len(b)]))
- v2 = round(v2, u64(b[8:16:len(b)]))
- v3 = round(v3, u64(b[16:24:len(b)]))
- v4 = round(v4, u64(b[24:32:len(b)]))
- b = b[32:len(b):len(b)]
- }
- d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4
- return n - len(b)
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
deleted file mode 100644
index e86f1b5..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
+++ /dev/null
@@ -1,16 +0,0 @@
-//go:build appengine
-// +build appengine
-
-// This file contains the safe implementations of otherwise unsafe-using code.
-
-package xxhash
-
-// Sum64String computes the 64-bit xxHash digest of s.
-func Sum64String(s string) uint64 {
- return Sum64([]byte(s))
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-func (d *Digest) WriteString(s string) (n int, err error) {
- return d.Write([]byte(s))
-}
diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
deleted file mode 100644
index 1c1638f..0000000
--- a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
+++ /dev/null
@@ -1,58 +0,0 @@
-//go:build !appengine
-// +build !appengine
-
-// This file encapsulates usage of unsafe.
-// xxhash_safe.go contains the safe implementations.
-
-package xxhash
-
-import (
- "unsafe"
-)
-
-// In the future it's possible that compiler optimizations will make these
-// XxxString functions unnecessary by realizing that calls such as
-// Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205.
-// If that happens, even if we keep these functions they can be replaced with
-// the trivial safe code.
-
-// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is:
-//
-// var b []byte
-// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
-// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
-// bh.Len = len(s)
-// bh.Cap = len(s)
-//
-// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough
-// weight to this sequence of expressions that any function that uses it will
-// not be inlined. Instead, the functions below use a different unsafe
-// conversion designed to minimize the inliner weight and allow both to be
-// inlined. There is also a test (TestInlining) which verifies that these are
-// inlined.
-//
-// See https://github.com/golang/go/issues/42739 for discussion.
-
-// Sum64String computes the 64-bit xxHash digest of s.
-// It may be faster than Sum64([]byte(s)) by avoiding a copy.
-func Sum64String(s string) uint64 {
- b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))
- return Sum64(b)
-}
-
-// WriteString adds more data to d. It always returns len(s), nil.
-// It may be faster than Write([]byte(s)) by avoiding a copy.
-func (d *Digest) WriteString(s string) (n int, err error) {
- d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})))
- // d.Write always returns len(s), nil.
- // Ignoring the return output and returning these fixed values buys a
- // savings of 6 in the inliner's cost model.
- return len(s), nil
-}
-
-// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout
-// of the first two words is the same as the layout of a string.
-type sliceHeader struct {
- s string
- cap int
-}
diff --git a/vendor/github.com/prometheus/client_golang/LICENSE b/vendor/github.com/prometheus/client_golang/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/client_golang/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/client_golang/NOTICE b/vendor/github.com/prometheus/client_golang/NOTICE
deleted file mode 100644
index dd878a3..0000000
--- a/vendor/github.com/prometheus/client_golang/NOTICE
+++ /dev/null
@@ -1,23 +0,0 @@
-Prometheus instrumentation library for Go applications
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
-
-
-The following components are included in this product:
-
-perks - a fork of https://github.com/bmizerany/perks
-https://github.com/beorn7/perks
-Copyright 2013-2015 Blake Mizerany, Björn Rabenstein
-See https://github.com/beorn7/perks/blob/master/README.md for license details.
-
-Go support for Protocol Buffers - Google's data interchange format
-http://github.com/golang/protobuf/
-Copyright 2010 The Go Authors
-See source code for license details.
-
-Support for streaming Protocol Buffer messages for the Go language (golang).
-https://github.com/matttproud/golang_protobuf_extensions
-Copyright 2013 Matt T. Proud
-Licensed under the Apache License, Version 2.0
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore b/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
deleted file mode 100644
index 3460f03..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-command-line-arguments.test
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/README.md b/vendor/github.com/prometheus/client_golang/prometheus/README.md
deleted file mode 100644
index c67ff1b..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/README.md
+++ /dev/null
@@ -1 +0,0 @@
-See [![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang/prometheus.svg)](https://pkg.go.dev/github.com/prometheus/client_golang/prometheus).
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info_collector.go
deleted file mode 100644
index 450189f..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/build_info_collector.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "runtime/debug"
-
-// NewBuildInfoCollector is the obsolete version of collectors.NewBuildInfoCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewBuildInfoCollector instead.
-func NewBuildInfoCollector() Collector {
- path, version, sum := "unknown", "unknown", "unknown"
- if bi, ok := debug.ReadBuildInfo(); ok {
- path = bi.Main.Path
- version = bi.Main.Version
- sum = bi.Main.Sum
- }
- c := &selfCollector{MustNewConstMetric(
- NewDesc(
- "go_build_info",
- "Build information about the main Go module.",
- nil, Labels{"path": path, "version": version, "checksum": sum},
- ),
- GaugeValue, 1)}
- c.init(c.self)
- return c
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/collector.go b/vendor/github.com/prometheus/client_golang/prometheus/collector.go
deleted file mode 100644
index cf05079..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/collector.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Collector is the interface implemented by anything that can be used by
-// Prometheus to collect metrics. A Collector has to be registered for
-// collection. See Registerer.Register.
-//
-// The stock metrics provided by this package (Gauge, Counter, Summary,
-// Histogram, Untyped) are also Collectors (which only ever collect one metric,
-// namely itself). An implementer of Collector may, however, collect multiple
-// metrics in a coordinated fashion and/or create metrics on the fly. Examples
-// for collectors already implemented in this library are the metric vectors
-// (i.e. collection of multiple instances of the same Metric but with different
-// label values) like GaugeVec or SummaryVec, and the ExpvarCollector.
-type Collector interface {
- // Describe sends the super-set of all possible descriptors of metrics
- // collected by this Collector to the provided channel and returns once
- // the last descriptor has been sent. The sent descriptors fulfill the
- // consistency and uniqueness requirements described in the Desc
- // documentation.
- //
- // It is valid if one and the same Collector sends duplicate
- // descriptors. Those duplicates are simply ignored. However, two
- // different Collectors must not send duplicate descriptors.
- //
- // Sending no descriptor at all marks the Collector as “unchecked”,
- // i.e. no checks will be performed at registration time, and the
- // Collector may yield any Metric it sees fit in its Collect method.
- //
- // This method idempotently sends the same descriptors throughout the
- // lifetime of the Collector. It may be called concurrently and
- // therefore must be implemented in a concurrency safe way.
- //
- // If a Collector encounters an error while executing this method, it
- // must send an invalid descriptor (created with NewInvalidDesc) to
- // signal the error to the registry.
- Describe(chan<- *Desc)
- // Collect is called by the Prometheus registry when collecting
- // metrics. The implementation sends each collected metric via the
- // provided channel and returns once the last metric has been sent. The
- // descriptor of each sent metric is one of those returned by Describe
- // (unless the Collector is unchecked, see above). Returned metrics that
- // share the same descriptor must differ in their variable label
- // values.
- //
- // This method may be called concurrently and must therefore be
- // implemented in a concurrency safe way. Blocking occurs at the expense
- // of total performance of rendering all registered metrics. Ideally,
- // Collector implementations support concurrent readers.
- Collect(chan<- Metric)
-}
-
-// DescribeByCollect is a helper to implement the Describe method of a custom
-// Collector. It collects the metrics from the provided Collector and sends
-// their descriptors to the provided channel.
-//
-// If a Collector collects the same metrics throughout its lifetime, its
-// Describe method can simply be implemented as:
-//
-// func (c customCollector) Describe(ch chan<- *Desc) {
-// DescribeByCollect(c, ch)
-// }
-//
-// However, this will not work if the metrics collected change dynamically over
-// the lifetime of the Collector in a way that their combined set of descriptors
-// changes as well. The shortcut implementation will then violate the contract
-// of the Describe method. If a Collector sometimes collects no metrics at all
-// (for example vectors like CounterVec, GaugeVec, etc., which only collect
-// metrics after a metric with a fully specified label set has been accessed),
-// it might even get registered as an unchecked Collector (cf. the Register
-// method of the Registerer interface). Hence, only use this shortcut
-// implementation of Describe if you are certain to fulfill the contract.
-//
-// The Collector example demonstrates a use of DescribeByCollect.
-func DescribeByCollect(c Collector, descs chan<- *Desc) {
- metrics := make(chan Metric)
- go func() {
- c.Collect(metrics)
- close(metrics)
- }()
- for m := range metrics {
- descs <- m.Desc()
- }
-}
-
-// selfCollector implements Collector for a single Metric so that the Metric
-// collects itself. Add it as an anonymous field to a struct that implements
-// Metric, and call init with the Metric itself as an argument.
-type selfCollector struct {
- self Metric
-}
-
-// init provides the selfCollector with a reference to the metric it is supposed
-// to collect. It is usually called within the factory function to create a
-// metric. See example.
-func (c *selfCollector) init(self Metric) {
- c.self = self
-}
-
-// Describe implements Collector.
-func (c *selfCollector) Describe(ch chan<- *Desc) {
- ch <- c.self.Desc()
-}
-
-// Collect implements Collector.
-func (c *selfCollector) Collect(ch chan<- Metric) {
- ch <- c.self
-}
-
-// collectorMetric is a metric that is also a collector.
-// Because of selfCollector, most (if not all) Metrics in
-// this package are also collectors.
-type collectorMetric interface {
- Metric
- Collector
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/counter.go b/vendor/github.com/prometheus/client_golang/prometheus/counter.go
deleted file mode 100644
index 4ce84e7..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/counter.go
+++ /dev/null
@@ -1,358 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "math"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/types/known/timestamppb"
-)
-
-// Counter is a Metric that represents a single numerical value that only ever
-// goes up. That implies that it cannot be used to count items whose number can
-// also go down, e.g. the number of currently running goroutines. Those
-// "counters" are represented by Gauges.
-//
-// A Counter is typically used to count requests served, tasks completed, errors
-// occurred, etc.
-//
-// To create Counter instances, use NewCounter.
-type Counter interface {
- Metric
- Collector
-
- // Inc increments the counter by 1. Use Add to increment it by arbitrary
- // non-negative values.
- Inc()
- // Add adds the given value to the counter. It panics if the value is <
- // 0.
- Add(float64)
-}
-
-// ExemplarAdder is implemented by Counters that offer the option of adding a
-// value to the Counter together with an exemplar. Its AddWithExemplar method
-// works like the Add method of the Counter interface but also replaces the
-// currently saved exemplar (if any) with a new one, created from the provided
-// value, the current time as timestamp, and the provided labels. Empty Labels
-// will lead to a valid (label-less) exemplar. But if Labels is nil, the current
-// exemplar is left in place. AddWithExemplar panics if the value is < 0, if any
-// of the provided labels are invalid, or if the provided labels contain more
-// than 128 runes in total.
-type ExemplarAdder interface {
- AddWithExemplar(value float64, exemplar Labels)
-}
-
-// CounterOpts is an alias for Opts. See there for doc comments.
-type CounterOpts Opts
-
-// CounterVecOpts bundles the options to create a CounterVec metric.
-// It is mandatory to set CounterOpts, see there for mandatory fields. VariableLabels
-// is optional and can safely be left to its default value.
-type CounterVecOpts struct {
- CounterOpts
-
- // VariableLabels are used to partition the metric vector by the given set
- // of labels. Each label value will be constrained with the optional Constraint
- // function, if provided.
- VariableLabels ConstrainableLabels
-}
-
-// NewCounter creates a new Counter based on the provided CounterOpts.
-//
-// The returned implementation also implements ExemplarAdder. It is safe to
-// perform the corresponding type assertion.
-//
-// The returned implementation tracks the counter value in two separate
-// variables, a float64 and a uint64. The latter is used to track calls of the
-// Inc method and calls of the Add method with a value that can be represented
-// as a uint64. This allows atomic increments of the counter with optimal
-// performance. (It is common to have an Inc call in very hot execution paths.)
-// Both internal tracking values are added up in the Write method. This has to
-// be taken into account when it comes to precision and overflow behavior.
-func NewCounter(opts CounterOpts) Counter {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- )
- if opts.now == nil {
- opts.now = time.Now
- }
- result := &counter{desc: desc, labelPairs: desc.constLabelPairs, now: opts.now}
- result.init(result) // Init self-collection.
- result.createdTs = timestamppb.New(opts.now())
- return result
-}
-
-type counter struct {
- // valBits contains the bits of the represented float64 value, while
- // valInt stores values that are exact integers. Both have to go first
- // in the struct to guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- valBits uint64
- valInt uint64
-
- selfCollector
- desc *Desc
-
- createdTs *timestamppb.Timestamp
- labelPairs []*dto.LabelPair
- exemplar atomic.Value // Containing nil or a *dto.Exemplar.
-
- // now is for testing purposes, by default it's time.Now.
- now func() time.Time
-}
-
-func (c *counter) Desc() *Desc {
- return c.desc
-}
-
-func (c *counter) Add(v float64) {
- if v < 0 {
- panic(errors.New("counter cannot decrease in value"))
- }
-
- ival := uint64(v)
- if float64(ival) == v {
- atomic.AddUint64(&c.valInt, ival)
- return
- }
-
- for {
- oldBits := atomic.LoadUint64(&c.valBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&c.valBits, oldBits, newBits) {
- return
- }
- }
-}
-
-func (c *counter) AddWithExemplar(v float64, e Labels) {
- c.Add(v)
- c.updateExemplar(v, e)
-}
-
-func (c *counter) Inc() {
- atomic.AddUint64(&c.valInt, 1)
-}
-
-func (c *counter) get() float64 {
- fval := math.Float64frombits(atomic.LoadUint64(&c.valBits))
- ival := atomic.LoadUint64(&c.valInt)
- return fval + float64(ival)
-}
-
-func (c *counter) Write(out *dto.Metric) error {
- // Read the Exemplar first and the value second. This is to avoid a race condition
- // where users see an exemplar for a not-yet-existing observation.
- var exemplar *dto.Exemplar
- if e := c.exemplar.Load(); e != nil {
- exemplar = e.(*dto.Exemplar)
- }
- val := c.get()
- return populateMetric(CounterValue, val, c.labelPairs, exemplar, out, c.createdTs)
-}
-
-func (c *counter) updateExemplar(v float64, l Labels) {
- if l == nil {
- return
- }
- e, err := newExemplar(v, c.now(), l)
- if err != nil {
- panic(err)
- }
- c.exemplar.Store(e)
-}
-
-// CounterVec is a Collector that bundles a set of Counters that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. number of HTTP requests, partitioned by response code and
-// method). Create instances with NewCounterVec.
-type CounterVec struct {
- *MetricVec
-}
-
-// NewCounterVec creates a new CounterVec based on the provided CounterOpts and
-// partitioned by the given label names.
-func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec {
- return V2.NewCounterVec(CounterVecOpts{
- CounterOpts: opts,
- VariableLabels: UnconstrainedLabels(labelNames),
- })
-}
-
-// NewCounterVec creates a new CounterVec based on the provided CounterVecOpts.
-func (v2) NewCounterVec(opts CounterVecOpts) *CounterVec {
- desc := V2.NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- opts.VariableLabels,
- opts.ConstLabels,
- )
- if opts.now == nil {
- opts.now = time.Now
- }
- return &CounterVec{
- MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
- if len(lvs) != len(desc.variableLabels.names) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels.names, lvs))
- }
- result := &counter{desc: desc, labelPairs: MakeLabelPairs(desc, lvs), now: opts.now}
- result.init(result) // Init self-collection.
- result.createdTs = timestamppb.New(opts.now())
- return result
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Counter for the given slice of label
-// values (same order as the variable labels in Desc). If that combination of
-// label values is accessed for the first time, a new Counter is created.
-//
-// It is possible to call this method without using the returned Counter to only
-// create the new Counter but leave it at its starting value 0. See also the
-// SummaryVec example.
-//
-// Keeping the Counter for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Counter from the CounterVec. In that case,
-// the Counter will still exist, but it will not be exported anymore, even if a
-// Counter with the same label values is created later.
-//
-// An error is returned if the number of label values is not the same as the
-// number of variable labels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) {
- metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Counter for the given Labels map (the label names
-// must match those of the variable labels in Desc). If that label map is
-// accessed for the first time, a new Counter is created. Implications of
-// creating a Counter without using it and keeping the Counter for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the variable labels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) {
- metric, err := v.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Counter), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-//
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (v *CounterVec) WithLabelValues(lvs ...string) Counter {
- c, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return c
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-//
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
-func (v *CounterVec) With(labels Labels) Counter {
- c, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return c
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the CounterVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *CounterVec) CurryWith(labels Labels) (*CounterVec, error) {
- vec, err := v.MetricVec.CurryWith(labels)
- if vec != nil {
- return &CounterVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *CounterVec) MustCurryWith(labels Labels) *CounterVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-// CounterFunc is a Counter whose value is determined at collect time by calling a
-// provided function.
-//
-// To create CounterFunc instances, use NewCounterFunc.
-type CounterFunc interface {
- Metric
- Collector
-}
-
-// NewCounterFunc creates a new CounterFunc based on the provided
-// CounterOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a CounterFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe. The function should also honor
-// the contract for a Counter (values only go up, not down), but compliance will
-// not be checked.
-//
-// Check out the ExampleGaugeFunc examples for the similar GaugeFunc.
-func NewCounterFunc(opts CounterOpts, function func() float64) CounterFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), CounterValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/desc.go b/vendor/github.com/prometheus/client_golang/prometheus/desc.go
deleted file mode 100644
index 68ffe3c..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/desc.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sort"
- "strings"
-
- "github.com/cespare/xxhash/v2"
- dto "github.com/prometheus/client_model/go"
- "github.com/prometheus/common/model"
- "google.golang.org/protobuf/proto"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-)
-
-// Desc is the descriptor used by every Prometheus Metric. It is essentially
-// the immutable meta-data of a Metric. The normal Metric implementations
-// included in this package manage their Desc under the hood. Users only have to
-// deal with Desc if they use advanced features like the ExpvarCollector or
-// custom Collectors and Metrics.
-//
-// Descriptors registered with the same registry have to fulfill certain
-// consistency and uniqueness criteria if they share the same fully-qualified
-// name: They must have the same help string and the same label names (aka label
-// dimensions) in each, constLabels and variableLabels, but they must differ in
-// the values of the constLabels.
-//
-// Descriptors that share the same fully-qualified names and the same label
-// values of their constLabels are considered equal.
-//
-// Use NewDesc to create new Desc instances.
-type Desc struct {
- // fqName has been built from Namespace, Subsystem, and Name.
- fqName string
- // help provides some helpful information about this metric.
- help string
- // constLabelPairs contains precalculated DTO label pairs based on
- // the constant labels.
- constLabelPairs []*dto.LabelPair
- // variableLabels contains names of labels and normalization function for
- // which the metric maintains variable values.
- variableLabels *compiledLabels
- // id is a hash of the values of the ConstLabels and fqName. This
- // must be unique among all registered descriptors and can therefore be
- // used as an identifier of the descriptor.
- id uint64
- // dimHash is a hash of the label names (preset and variable) and the
- // Help string. Each Desc with the same fqName must have the same
- // dimHash.
- dimHash uint64
- // err is an error that occurred during construction. It is reported on
- // registration time.
- err error
-}
-
-// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
-// and will be reported on registration time. variableLabels and constLabels can
-// be nil if no such labels should be set. fqName must not be empty.
-//
-// variableLabels only contain the label names. Their label values are variable
-// and therefore not part of the Desc. (They are managed within the Metric.)
-//
-// For constLabels, the label values are constant. Therefore, they are fully
-// specified in the Desc. See the Collector example for a usage pattern.
-func NewDesc(fqName, help string, variableLabels []string, constLabels Labels) *Desc {
- return V2.NewDesc(fqName, help, UnconstrainedLabels(variableLabels), constLabels)
-}
-
-// NewDesc allocates and initializes a new Desc. Errors are recorded in the Desc
-// and will be reported on registration time. variableLabels and constLabels can
-// be nil if no such labels should be set. fqName must not be empty.
-//
-// variableLabels only contain the label names and normalization functions. Their
-// label values are variable and therefore not part of the Desc. (They are managed
-// within the Metric.)
-//
-// For constLabels, the label values are constant. Therefore, they are fully
-// specified in the Desc. See the Collector example for a usage pattern.
-func (v2) NewDesc(fqName, help string, variableLabels ConstrainableLabels, constLabels Labels) *Desc {
- d := &Desc{
- fqName: fqName,
- help: help,
- variableLabels: variableLabels.compile(),
- }
- if !model.IsValidMetricName(model.LabelValue(fqName)) {
- d.err = fmt.Errorf("%q is not a valid metric name", fqName)
- return d
- }
- // labelValues contains the label values of const labels (in order of
- // their sorted label names) plus the fqName (at position 0).
- labelValues := make([]string, 1, len(constLabels)+1)
- labelValues[0] = fqName
- labelNames := make([]string, 0, len(constLabels)+len(d.variableLabels.names))
- labelNameSet := map[string]struct{}{}
- // First add only the const label names and sort them...
- for labelName := range constLabels {
- if !checkLabelName(labelName) {
- d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName)
- return d
- }
- labelNames = append(labelNames, labelName)
- labelNameSet[labelName] = struct{}{}
- }
- sort.Strings(labelNames)
- // ... so that we can now add const label values in the order of their names.
- for _, labelName := range labelNames {
- labelValues = append(labelValues, constLabels[labelName])
- }
- // Validate the const label values. They can't have a wrong cardinality, so
- // use in len(labelValues) as expectedNumberOfValues.
- if err := validateLabelValues(labelValues, len(labelValues)); err != nil {
- d.err = err
- return d
- }
- // Now add the variable label names, but prefix them with something that
- // cannot be in a regular label name. That prevents matching the label
- // dimension with a different mix between preset and variable labels.
- for _, label := range d.variableLabels.names {
- if !checkLabelName(label) {
- d.err = fmt.Errorf("%q is not a valid label name for metric %q", label, fqName)
- return d
- }
- labelNames = append(labelNames, "$"+label)
- labelNameSet[label] = struct{}{}
- }
- if len(labelNames) != len(labelNameSet) {
- d.err = fmt.Errorf("duplicate label names in constant and variable labels for metric %q", fqName)
- return d
- }
-
- xxh := xxhash.New()
- for _, val := range labelValues {
- xxh.WriteString(val)
- xxh.Write(separatorByteSlice)
- }
- d.id = xxh.Sum64()
- // Sort labelNames so that order doesn't matter for the hash.
- sort.Strings(labelNames)
- // Now hash together (in this order) the help string and the sorted
- // label names.
- xxh.Reset()
- xxh.WriteString(help)
- xxh.Write(separatorByteSlice)
- for _, labelName := range labelNames {
- xxh.WriteString(labelName)
- xxh.Write(separatorByteSlice)
- }
- d.dimHash = xxh.Sum64()
-
- d.constLabelPairs = make([]*dto.LabelPair, 0, len(constLabels))
- for n, v := range constLabels {
- d.constLabelPairs = append(d.constLabelPairs, &dto.LabelPair{
- Name: proto.String(n),
- Value: proto.String(v),
- })
- }
- sort.Sort(internal.LabelPairSorter(d.constLabelPairs))
- return d
-}
-
-// NewInvalidDesc returns an invalid descriptor, i.e. a descriptor with the
-// provided error set. If a collector returning such a descriptor is registered,
-// registration will fail with the provided error. NewInvalidDesc can be used by
-// a Collector to signal inability to describe itself.
-func NewInvalidDesc(err error) *Desc {
- return &Desc{
- err: err,
- }
-}
-
-func (d *Desc) String() string {
- lpStrings := make([]string, 0, len(d.constLabelPairs))
- for _, lp := range d.constLabelPairs {
- lpStrings = append(
- lpStrings,
- fmt.Sprintf("%s=%q", lp.GetName(), lp.GetValue()),
- )
- }
- vlStrings := make([]string, 0, len(d.variableLabels.names))
- for _, vl := range d.variableLabels.names {
- if fn, ok := d.variableLabels.labelConstraints[vl]; ok && fn != nil {
- vlStrings = append(vlStrings, fmt.Sprintf("c(%s)", vl))
- } else {
- vlStrings = append(vlStrings, vl)
- }
- }
- return fmt.Sprintf(
- "Desc{fqName: %q, help: %q, constLabels: {%s}, variableLabels: {%s}}",
- d.fqName,
- d.help,
- strings.Join(lpStrings, ","),
- strings.Join(vlStrings, ","),
- )
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go
deleted file mode 100644
index 962608f..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package prometheus is the core instrumentation package. It provides metrics
-// primitives to instrument code for monitoring. It also offers a registry for
-// metrics. Sub-packages allow to expose the registered metrics via HTTP
-// (package promhttp) or push them to a Pushgateway (package push). There is
-// also a sub-package promauto, which provides metrics constructors with
-// automatic registration.
-//
-// All exported functions and methods are safe to be used concurrently unless
-// specified otherwise.
-//
-// # A Basic Example
-//
-// As a starting point, a very basic usage example:
-//
-// package main
-//
-// import (
-// "log"
-// "net/http"
-//
-// "github.com/prometheus/client_golang/prometheus"
-// "github.com/prometheus/client_golang/prometheus/promhttp"
-// )
-//
-// type metrics struct {
-// cpuTemp prometheus.Gauge
-// hdFailures *prometheus.CounterVec
-// }
-//
-// func NewMetrics(reg prometheus.Registerer) *metrics {
-// m := &metrics{
-// cpuTemp: prometheus.NewGauge(prometheus.GaugeOpts{
-// Name: "cpu_temperature_celsius",
-// Help: "Current temperature of the CPU.",
-// }),
-// hdFailures: prometheus.NewCounterVec(
-// prometheus.CounterOpts{
-// Name: "hd_errors_total",
-// Help: "Number of hard-disk errors.",
-// },
-// []string{"device"},
-// ),
-// }
-// reg.MustRegister(m.cpuTemp)
-// reg.MustRegister(m.hdFailures)
-// return m
-// }
-//
-// func main() {
-// // Create a non-global registry.
-// reg := prometheus.NewRegistry()
-//
-// // Create new metrics and register them using the custom registry.
-// m := NewMetrics(reg)
-// // Set values for the new created metrics.
-// m.cpuTemp.Set(65.3)
-// m.hdFailures.With(prometheus.Labels{"device":"/dev/sda"}).Inc()
-//
-// // Expose metrics and custom registry via an HTTP server
-// // using the HandleFor function. "/metrics" is the usual endpoint for that.
-// http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{Registry: reg}))
-// log.Fatal(http.ListenAndServe(":8080", nil))
-// }
-//
-// This is a complete program that exports two metrics, a Gauge and a Counter,
-// the latter with a label attached to turn it into a (one-dimensional) vector.
-// It register the metrics using a custom registry and exposes them via an HTTP server
-// on the /metrics endpoint.
-//
-// # Metrics
-//
-// The number of exported identifiers in this package might appear a bit
-// overwhelming. However, in addition to the basic plumbing shown in the example
-// above, you only need to understand the different metric types and their
-// vector versions for basic usage. Furthermore, if you are not concerned with
-// fine-grained control of when and how to register metrics with the registry,
-// have a look at the promauto package, which will effectively allow you to
-// ignore registration altogether in simple cases.
-//
-// Above, you have already touched the Counter and the Gauge. There are two more
-// advanced metric types: the Summary and Histogram. A more thorough description
-// of those four metric types can be found in the Prometheus docs:
-// https://prometheus.io/docs/concepts/metric_types/
-//
-// In addition to the fundamental metric types Gauge, Counter, Summary, and
-// Histogram, a very important part of the Prometheus data model is the
-// partitioning of samples along dimensions called labels, which results in
-// metric vectors. The fundamental types are GaugeVec, CounterVec, SummaryVec,
-// and HistogramVec.
-//
-// While only the fundamental metric types implement the Metric interface, both
-// the metrics and their vector versions implement the Collector interface. A
-// Collector manages the collection of a number of Metrics, but for convenience,
-// a Metric can also “collect itself”. Note that Gauge, Counter, Summary, and
-// Histogram are interfaces themselves while GaugeVec, CounterVec, SummaryVec,
-// and HistogramVec are not.
-//
-// To create instances of Metrics and their vector versions, you need a suitable
-// …Opts struct, i.e. GaugeOpts, CounterOpts, SummaryOpts, or HistogramOpts.
-//
-// # Custom Collectors and constant Metrics
-//
-// While you could create your own implementations of Metric, most likely you
-// will only ever implement the Collector interface on your own. At a first
-// glance, a custom Collector seems handy to bundle Metrics for common
-// registration (with the prime example of the different metric vectors above,
-// which bundle all the metrics of the same name but with different labels).
-//
-// There is a more involved use case, too: If you already have metrics
-// available, created outside of the Prometheus context, you don't need the
-// interface of the various Metric types. You essentially want to mirror the
-// existing numbers into Prometheus Metrics during collection. An own
-// implementation of the Collector interface is perfect for that. You can create
-// Metric instances “on the fly” using NewConstMetric, NewConstHistogram, and
-// NewConstSummary (and their respective Must… versions). NewConstMetric is used
-// for all metric types with just a float64 as their value: Counter, Gauge, and
-// a special “type” called Untyped. Use the latter if you are not sure if the
-// mirrored metric is a Counter or a Gauge. Creation of the Metric instance
-// happens in the Collect method. The Describe method has to return separate
-// Desc instances, representative of the “throw-away” metrics to be created
-// later. NewDesc comes in handy to create those Desc instances. Alternatively,
-// you could return no Desc at all, which will mark the Collector “unchecked”.
-// No checks are performed at registration time, but metric consistency will
-// still be ensured at scrape time, i.e. any inconsistencies will lead to scrape
-// errors. Thus, with unchecked Collectors, the responsibility to not collect
-// metrics that lead to inconsistencies in the total scrape result lies with the
-// implementer of the Collector. While this is not a desirable state, it is
-// sometimes necessary. The typical use case is a situation where the exact
-// metrics to be returned by a Collector cannot be predicted at registration
-// time, but the implementer has sufficient knowledge of the whole system to
-// guarantee metric consistency.
-//
-// The Collector example illustrates the use case. You can also look at the
-// source code of the processCollector (mirroring process metrics), the
-// goCollector (mirroring Go metrics), or the expvarCollector (mirroring expvar
-// metrics) as examples that are used in this package itself.
-//
-// If you just need to call a function to get a single float value to collect as
-// a metric, GaugeFunc, CounterFunc, or UntypedFunc might be interesting
-// shortcuts.
-//
-// # Advanced Uses of the Registry
-//
-// While MustRegister is the by far most common way of registering a Collector,
-// sometimes you might want to handle the errors the registration might cause.
-// As suggested by the name, MustRegister panics if an error occurs. With the
-// Register function, the error is returned and can be handled.
-//
-// An error is returned if the registered Collector is incompatible or
-// inconsistent with already registered metrics. The registry aims for
-// consistency of the collected metrics according to the Prometheus data model.
-// Inconsistencies are ideally detected at registration time, not at collect
-// time. The former will usually be detected at start-up time of a program,
-// while the latter will only happen at scrape time, possibly not even on the
-// first scrape if the inconsistency only becomes relevant later. That is the
-// main reason why a Collector and a Metric have to describe themselves to the
-// registry.
-//
-// So far, everything we did operated on the so-called default registry, as it
-// can be found in the global DefaultRegisterer variable. With NewRegistry, you
-// can create a custom registry, or you can even implement the Registerer or
-// Gatherer interfaces yourself. The methods Register and Unregister work in the
-// same way on a custom registry as the global functions Register and Unregister
-// on the default registry.
-//
-// There are a number of uses for custom registries: You can use registries with
-// special properties, see NewPedanticRegistry. You can avoid global state, as
-// it is imposed by the DefaultRegisterer. You can use multiple registries at
-// the same time to expose different metrics in different ways. You can use
-// separate registries for testing purposes.
-//
-// Also note that the DefaultRegisterer comes registered with a Collector for Go
-// runtime metrics (via NewGoCollector) and a Collector for process metrics (via
-// NewProcessCollector). With a custom registry, you are in control and decide
-// yourself about the Collectors to register.
-//
-// # HTTP Exposition
-//
-// The Registry implements the Gatherer interface. The caller of the Gather
-// method can then expose the gathered metrics in some way. Usually, the metrics
-// are served via HTTP on the /metrics endpoint. That's happening in the example
-// above. The tools to expose metrics via HTTP are in the promhttp sub-package.
-//
-// # Pushing to the Pushgateway
-//
-// Function for pushing to the Pushgateway can be found in the push sub-package.
-//
-// # Graphite Bridge
-//
-// Functions and examples to push metrics from a Gatherer to Graphite can be
-// found in the graphite sub-package.
-//
-// # Other Means of Exposition
-//
-// More ways of exposing metrics can easily be added by following the approaches
-// of the existing implementations.
-package prometheus
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
deleted file mode 100644
index de5a856..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "encoding/json"
- "expvar"
-)
-
-type expvarCollector struct {
- exports map[string]*Desc
-}
-
-// NewExpvarCollector is the obsolete version of collectors.NewExpvarCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewExpvarCollector instead.
-func NewExpvarCollector(exports map[string]*Desc) Collector {
- return &expvarCollector{
- exports: exports,
- }
-}
-
-// Describe implements Collector.
-func (e *expvarCollector) Describe(ch chan<- *Desc) {
- for _, desc := range e.exports {
- ch <- desc
- }
-}
-
-// Collect implements Collector.
-func (e *expvarCollector) Collect(ch chan<- Metric) {
- for name, desc := range e.exports {
- var m Metric
- expVar := expvar.Get(name)
- if expVar == nil {
- continue
- }
- var v interface{}
- labels := make([]string, len(desc.variableLabels.names))
- if err := json.Unmarshal([]byte(expVar.String()), &v); err != nil {
- ch <- NewInvalidMetric(desc, err)
- continue
- }
- var processValue func(v interface{}, i int)
- processValue = func(v interface{}, i int) {
- if i >= len(labels) {
- copiedLabels := append(make([]string, 0, len(labels)), labels...)
- switch v := v.(type) {
- case float64:
- m = MustNewConstMetric(desc, UntypedValue, v, copiedLabels...)
- case bool:
- if v {
- m = MustNewConstMetric(desc, UntypedValue, 1, copiedLabels...)
- } else {
- m = MustNewConstMetric(desc, UntypedValue, 0, copiedLabels...)
- }
- default:
- return
- }
- ch <- m
- return
- }
- vm, ok := v.(map[string]interface{})
- if !ok {
- return
- }
- for lv, val := range vm {
- labels[i] = lv
- processValue(val, i+1)
- }
- }
- processValue(v, 0)
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go b/vendor/github.com/prometheus/client_golang/prometheus/fnv.go
deleted file mode 100644
index 3d383a7..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/fnv.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Inline and byte-free variant of hash/fnv's fnv64a.
-
-const (
- offset64 = 14695981039346656037
- prime64 = 1099511628211
-)
-
-// hashNew initializies a new fnv64a hash value.
-func hashNew() uint64 {
- return offset64
-}
-
-// hashAdd adds a string to a fnv64a hash value, returning the updated hash.
-func hashAdd(h uint64, s string) uint64 {
- for i := 0; i < len(s); i++ {
- h ^= uint64(s[i])
- h *= prime64
- }
- return h
-}
-
-// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
-func hashAddByte(h uint64, b byte) uint64 {
- h ^= uint64(b)
- h *= prime64
- return h
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go b/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
deleted file mode 100644
index dd2eac9..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/gauge.go
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "math"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Gauge is a Metric that represents a single numerical value that can
-// arbitrarily go up and down.
-//
-// A Gauge is typically used for measured values like temperatures or current
-// memory usage, but also "counts" that can go up and down, like the number of
-// running goroutines.
-//
-// To create Gauge instances, use NewGauge.
-type Gauge interface {
- Metric
- Collector
-
- // Set sets the Gauge to an arbitrary value.
- Set(float64)
- // Inc increments the Gauge by 1. Use Add to increment it by arbitrary
- // values.
- Inc()
- // Dec decrements the Gauge by 1. Use Sub to decrement it by arbitrary
- // values.
- Dec()
- // Add adds the given value to the Gauge. (The value can be negative,
- // resulting in a decrease of the Gauge.)
- Add(float64)
- // Sub subtracts the given value from the Gauge. (The value can be
- // negative, resulting in an increase of the Gauge.)
- Sub(float64)
-
- // SetToCurrentTime sets the Gauge to the current Unix time in seconds.
- SetToCurrentTime()
-}
-
-// GaugeOpts is an alias for Opts. See there for doc comments.
-type GaugeOpts Opts
-
-// GaugeVecOpts bundles the options to create a GaugeVec metric.
-// It is mandatory to set GaugeOpts, see there for mandatory fields. VariableLabels
-// is optional and can safely be left to its default value.
-type GaugeVecOpts struct {
- GaugeOpts
-
- // VariableLabels are used to partition the metric vector by the given set
- // of labels. Each label value will be constrained with the optional Constraint
- // function, if provided.
- VariableLabels ConstrainableLabels
-}
-
-// NewGauge creates a new Gauge based on the provided GaugeOpts.
-//
-// The returned implementation is optimized for a fast Set method. If you have a
-// choice for managing the value of a Gauge via Set vs. Inc/Dec/Add/Sub, pick
-// the former. For example, the Inc method of the returned Gauge is slower than
-// the Inc method of a Counter returned by NewCounter. This matches the typical
-// scenarios for Gauges and Counters, where the former tends to be Set-heavy and
-// the latter Inc-heavy.
-func NewGauge(opts GaugeOpts) Gauge {
- desc := NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- )
- result := &gauge{desc: desc, labelPairs: desc.constLabelPairs}
- result.init(result) // Init self-collection.
- return result
-}
-
-type gauge struct {
- // valBits contains the bits of the represented float64 value. It has
- // to go first in the struct to guarantee alignment for atomic
- // operations. http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- valBits uint64
-
- selfCollector
-
- desc *Desc
- labelPairs []*dto.LabelPair
-}
-
-func (g *gauge) Desc() *Desc {
- return g.desc
-}
-
-func (g *gauge) Set(val float64) {
- atomic.StoreUint64(&g.valBits, math.Float64bits(val))
-}
-
-func (g *gauge) SetToCurrentTime() {
- g.Set(float64(time.Now().UnixNano()) / 1e9)
-}
-
-func (g *gauge) Inc() {
- g.Add(1)
-}
-
-func (g *gauge) Dec() {
- g.Add(-1)
-}
-
-func (g *gauge) Add(val float64) {
- for {
- oldBits := atomic.LoadUint64(&g.valBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + val)
- if atomic.CompareAndSwapUint64(&g.valBits, oldBits, newBits) {
- return
- }
- }
-}
-
-func (g *gauge) Sub(val float64) {
- g.Add(val * -1)
-}
-
-func (g *gauge) Write(out *dto.Metric) error {
- val := math.Float64frombits(atomic.LoadUint64(&g.valBits))
- return populateMetric(GaugeValue, val, g.labelPairs, nil, out, nil)
-}
-
-// GaugeVec is a Collector that bundles a set of Gauges that all share the same
-// Desc, but have different values for their variable labels. This is used if
-// you want to count the same thing partitioned by various dimensions
-// (e.g. number of operations queued, partitioned by user and operation
-// type). Create instances with NewGaugeVec.
-type GaugeVec struct {
- *MetricVec
-}
-
-// NewGaugeVec creates a new GaugeVec based on the provided GaugeOpts and
-// partitioned by the given label names.
-func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec {
- return V2.NewGaugeVec(GaugeVecOpts{
- GaugeOpts: opts,
- VariableLabels: UnconstrainedLabels(labelNames),
- })
-}
-
-// NewGaugeVec creates a new GaugeVec based on the provided GaugeVecOpts.
-func (v2) NewGaugeVec(opts GaugeVecOpts) *GaugeVec {
- desc := V2.NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- opts.VariableLabels,
- opts.ConstLabels,
- )
- return &GaugeVec{
- MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
- if len(lvs) != len(desc.variableLabels.names) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels.names, lvs))
- }
- result := &gauge{desc: desc, labelPairs: MakeLabelPairs(desc, lvs)}
- result.init(result) // Init self-collection.
- return result
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Gauge for the given slice of label
-// values (same order as the variable labels in Desc). If that combination of
-// label values is accessed for the first time, a new Gauge is created.
-//
-// It is possible to call this method without using the returned Gauge to only
-// create the new Gauge but leave it at its starting value 0. See also the
-// SummaryVec example.
-//
-// Keeping the Gauge for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Gauge from the GaugeVec. In that case, the
-// Gauge will still exist, but it will not be exported anymore, even if a
-// Gauge with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of variable labels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-func (v *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) {
- metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Gauge for the given Labels map (the label names
-// must match those of the variable labels in Desc). If that label map is
-// accessed for the first time, a new Gauge is created. Implications of
-// creating a Gauge without using it and keeping the Gauge for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the variable labels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) {
- metric, err := v.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Gauge), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-//
-// myVec.WithLabelValues("404", "GET").Add(42)
-func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge {
- g, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return g
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-//
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
-func (v *GaugeVec) With(labels Labels) Gauge {
- g, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return g
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the GaugeVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *GaugeVec) CurryWith(labels Labels) (*GaugeVec, error) {
- vec, err := v.MetricVec.CurryWith(labels)
- if vec != nil {
- return &GaugeVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *GaugeVec) MustCurryWith(labels Labels) *GaugeVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-// GaugeFunc is a Gauge whose value is determined at collect time by calling a
-// provided function.
-//
-// To create GaugeFunc instances, use NewGaugeFunc.
-type GaugeFunc interface {
- Metric
- Collector
-}
-
-// NewGaugeFunc creates a new GaugeFunc based on the provided GaugeOpts. The
-// value reported is determined by calling the given function from within the
-// Write method. Take into account that metric collection may happen
-// concurrently. Therefore, it must be safe to call the provided function
-// concurrently.
-//
-// NewGaugeFunc is a good way to create an “info” style metric with a constant
-// value of 1. Example:
-// https://github.com/prometheus/common/blob/8558a5b7db3c84fa38b4766966059a7bd5bfa2ee/version/info.go#L36-L56
-func NewGaugeFunc(opts GaugeOpts, function func() float64) GaugeFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), GaugeValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/get_pid.go b/vendor/github.com/prometheus/client_golang/prometheus/get_pid.go
deleted file mode 100644
index 614fd61..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/get_pid.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !js || wasm
-// +build !js wasm
-
-package prometheus
-
-import "os"
-
-func getPIDFn() func() (int, error) {
- pid := os.Getpid()
- return func() (int, error) {
- return pid, nil
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/get_pid_gopherjs.go b/vendor/github.com/prometheus/client_golang/prometheus/get_pid_gopherjs.go
deleted file mode 100644
index eaf8059..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/get_pid_gopherjs.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build js && !wasm
-// +build js,!wasm
-
-package prometheus
-
-func getPIDFn() func() (int, error) {
- return func() (int, error) {
- return 1, nil
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
deleted file mode 100644
index ad9a71a..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "runtime"
- "runtime/debug"
- "time"
-)
-
-// goRuntimeMemStats provides the metrics initially provided by runtime.ReadMemStats.
-// From Go 1.17 those similar (and better) statistics are provided by runtime/metrics, so
-// while eval closure works on runtime.MemStats, the struct from Go 1.17+ is
-// populated using runtime/metrics.
-func goRuntimeMemStats() memStatsMetrics {
- return memStatsMetrics{
- {
- desc: NewDesc(
- memstatNamespace("alloc_bytes"),
- "Number of bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Alloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("alloc_bytes_total"),
- "Total number of bytes allocated, even if freed.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.TotalAlloc) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("sys_bytes"),
- "Number of bytes obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Sys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("lookups_total"),
- "Total number of pointer lookups.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Lookups) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mallocs_total"),
- "Total number of mallocs.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Mallocs) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("frees_total"),
- "Total number of frees.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.Frees) },
- valType: CounterValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_alloc_bytes"),
- "Number of heap bytes allocated and still in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapAlloc) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_sys_bytes"),
- "Number of heap bytes obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_idle_bytes"),
- "Number of heap bytes waiting to be used.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapIdle) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_inuse_bytes"),
- "Number of heap bytes that are in use.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_released_bytes"),
- "Number of heap bytes released to OS.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapReleased) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("heap_objects"),
- "Number of allocated objects.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.HeapObjects) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_inuse_bytes"),
- "Number of bytes in use by the stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("stack_sys_bytes"),
- "Number of bytes obtained from system for stack allocator.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.StackSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_inuse_bytes"),
- "Number of bytes in use by mspan structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mspan_sys_bytes"),
- "Number of bytes used for mspan structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MSpanSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_inuse_bytes"),
- "Number of bytes in use by mcache structures.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheInuse) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("mcache_sys_bytes"),
- "Number of bytes used for mcache structures obtained from system.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.MCacheSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("buck_hash_sys_bytes"),
- "Number of bytes used by the profiling bucket hash table.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.BuckHashSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("gc_sys_bytes"),
- "Number of bytes used for garbage collection system metadata.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.GCSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("other_sys_bytes"),
- "Number of bytes used for other system allocations.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.OtherSys) },
- valType: GaugeValue,
- }, {
- desc: NewDesc(
- memstatNamespace("next_gc_bytes"),
- "Number of heap bytes when next garbage collection will take place.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return float64(ms.NextGC) },
- valType: GaugeValue,
- },
- }
-}
-
-type baseGoCollector struct {
- goroutinesDesc *Desc
- threadsDesc *Desc
- gcDesc *Desc
- gcLastTimeDesc *Desc
- goInfoDesc *Desc
-}
-
-func newBaseGoCollector() baseGoCollector {
- return baseGoCollector{
- goroutinesDesc: NewDesc(
- "go_goroutines",
- "Number of goroutines that currently exist.",
- nil, nil),
- threadsDesc: NewDesc(
- "go_threads",
- "Number of OS threads created.",
- nil, nil),
- gcDesc: NewDesc(
- "go_gc_duration_seconds",
- "A summary of the pause duration of garbage collection cycles.",
- nil, nil),
- gcLastTimeDesc: NewDesc(
- "go_memstats_last_gc_time_seconds",
- "Number of seconds since 1970 of last garbage collection.",
- nil, nil),
- goInfoDesc: NewDesc(
- "go_info",
- "Information about the Go environment.",
- nil, Labels{"version": runtime.Version()}),
- }
-}
-
-// Describe returns all descriptions of the collector.
-func (c *baseGoCollector) Describe(ch chan<- *Desc) {
- ch <- c.goroutinesDesc
- ch <- c.threadsDesc
- ch <- c.gcDesc
- ch <- c.gcLastTimeDesc
- ch <- c.goInfoDesc
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *baseGoCollector) Collect(ch chan<- Metric) {
- ch <- MustNewConstMetric(c.goroutinesDesc, GaugeValue, float64(runtime.NumGoroutine()))
-
- n := getRuntimeNumThreads()
- ch <- MustNewConstMetric(c.threadsDesc, GaugeValue, n)
-
- var stats debug.GCStats
- stats.PauseQuantiles = make([]time.Duration, 5)
- debug.ReadGCStats(&stats)
-
- quantiles := make(map[float64]float64)
- for idx, pq := range stats.PauseQuantiles[1:] {
- quantiles[float64(idx+1)/float64(len(stats.PauseQuantiles)-1)] = pq.Seconds()
- }
- quantiles[0.0] = stats.PauseQuantiles[0].Seconds()
- ch <- MustNewConstSummary(c.gcDesc, uint64(stats.NumGC), stats.PauseTotal.Seconds(), quantiles)
- ch <- MustNewConstMetric(c.gcLastTimeDesc, GaugeValue, float64(stats.LastGC.UnixNano())/1e9)
- ch <- MustNewConstMetric(c.goInfoDesc, GaugeValue, 1)
-}
-
-func memstatNamespace(s string) string {
- return "go_memstats_" + s
-}
-
-// memStatsMetrics provide description, evaluator, runtime/metrics name, and
-// value type for memstat metrics.
-type memStatsMetrics []struct {
- desc *Desc
- eval func(*runtime.MemStats) float64
- valType ValueType
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go
deleted file mode 100644
index 897a6e9..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !go1.17
-// +build !go1.17
-
-package prometheus
-
-import (
- "runtime"
- "sync"
- "time"
-)
-
-type goCollector struct {
- base baseGoCollector
-
- // ms... are memstats related.
- msLast *runtime.MemStats // Previously collected memstats.
- msLastTimestamp time.Time
- msMtx sync.Mutex // Protects msLast and msLastTimestamp.
- msMetrics memStatsMetrics
- msRead func(*runtime.MemStats) // For mocking in tests.
- msMaxWait time.Duration // Wait time for fresh memstats.
- msMaxAge time.Duration // Maximum allowed age of old memstats.
-}
-
-// NewGoCollector is the obsolete version of collectors.NewGoCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewGoCollector instead.
-func NewGoCollector() Collector {
- msMetrics := goRuntimeMemStats()
- msMetrics = append(msMetrics, struct {
- desc *Desc
- eval func(*runtime.MemStats) float64
- valType ValueType
- }{
- // This metric is omitted in Go1.17+, see https://github.com/prometheus/client_golang/issues/842#issuecomment-861812034
- desc: NewDesc(
- memstatNamespace("gc_cpu_fraction"),
- "The fraction of this program's available CPU time used by the GC since the program started.",
- nil, nil,
- ),
- eval: func(ms *runtime.MemStats) float64 { return ms.GCCPUFraction },
- valType: GaugeValue,
- })
- return &goCollector{
- base: newBaseGoCollector(),
- msLast: &runtime.MemStats{},
- msRead: runtime.ReadMemStats,
- msMaxWait: time.Second,
- msMaxAge: 5 * time.Minute,
- msMetrics: msMetrics,
- }
-}
-
-// Describe returns all descriptions of the collector.
-func (c *goCollector) Describe(ch chan<- *Desc) {
- c.base.Describe(ch)
- for _, i := range c.msMetrics {
- ch <- i.desc
- }
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *goCollector) Collect(ch chan<- Metric) {
- var (
- ms = &runtime.MemStats{}
- done = make(chan struct{})
- )
- // Start reading memstats first as it might take a while.
- go func() {
- c.msRead(ms)
- c.msMtx.Lock()
- c.msLast = ms
- c.msLastTimestamp = time.Now()
- c.msMtx.Unlock()
- close(done)
- }()
-
- // Collect base non-memory metrics.
- c.base.Collect(ch)
-
- timer := time.NewTimer(c.msMaxWait)
- select {
- case <-done: // Our own ReadMemStats succeeded in time. Use it.
- timer.Stop() // Important for high collection frequencies to not pile up timers.
- c.msCollect(ch, ms)
- return
- case <-timer.C: // Time out, use last memstats if possible. Continue below.
- }
- c.msMtx.Lock()
- if time.Since(c.msLastTimestamp) < c.msMaxAge {
- // Last memstats are recent enough. Collect from them under the lock.
- c.msCollect(ch, c.msLast)
- c.msMtx.Unlock()
- return
- }
- // If we are here, the last memstats are too old or don't exist. We have
- // to wait until our own ReadMemStats finally completes. For that to
- // happen, we have to release the lock.
- c.msMtx.Unlock()
- <-done
- c.msCollect(ch, ms)
-}
-
-func (c *goCollector) msCollect(ch chan<- Metric, ms *runtime.MemStats) {
- for _, i := range c.msMetrics {
- ch <- MustNewConstMetric(i.desc, i.valType, i.eval(ms))
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
deleted file mode 100644
index 2d8d9f6..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go
+++ /dev/null
@@ -1,567 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build go1.17
-// +build go1.17
-
-package prometheus
-
-import (
- "math"
- "runtime"
- "runtime/metrics"
- "strings"
- "sync"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/proto"
-)
-
-const (
- // constants for strings referenced more than once.
- goGCHeapTinyAllocsObjects = "/gc/heap/tiny/allocs:objects"
- goGCHeapAllocsObjects = "/gc/heap/allocs:objects"
- goGCHeapFreesObjects = "/gc/heap/frees:objects"
- goGCHeapFreesBytes = "/gc/heap/frees:bytes"
- goGCHeapAllocsBytes = "/gc/heap/allocs:bytes"
- goGCHeapObjects = "/gc/heap/objects:objects"
- goGCHeapGoalBytes = "/gc/heap/goal:bytes"
- goMemoryClassesTotalBytes = "/memory/classes/total:bytes"
- goMemoryClassesHeapObjectsBytes = "/memory/classes/heap/objects:bytes"
- goMemoryClassesHeapUnusedBytes = "/memory/classes/heap/unused:bytes"
- goMemoryClassesHeapReleasedBytes = "/memory/classes/heap/released:bytes"
- goMemoryClassesHeapFreeBytes = "/memory/classes/heap/free:bytes"
- goMemoryClassesHeapStacksBytes = "/memory/classes/heap/stacks:bytes"
- goMemoryClassesOSStacksBytes = "/memory/classes/os-stacks:bytes"
- goMemoryClassesMetadataMSpanInuseBytes = "/memory/classes/metadata/mspan/inuse:bytes"
- goMemoryClassesMetadataMSPanFreeBytes = "/memory/classes/metadata/mspan/free:bytes"
- goMemoryClassesMetadataMCacheInuseBytes = "/memory/classes/metadata/mcache/inuse:bytes"
- goMemoryClassesMetadataMCacheFreeBytes = "/memory/classes/metadata/mcache/free:bytes"
- goMemoryClassesProfilingBucketsBytes = "/memory/classes/profiling/buckets:bytes"
- goMemoryClassesMetadataOtherBytes = "/memory/classes/metadata/other:bytes"
- goMemoryClassesOtherBytes = "/memory/classes/other:bytes"
-)
-
-// rmNamesForMemStatsMetrics represents runtime/metrics names required to populate goRuntimeMemStats from like logic.
-var rmNamesForMemStatsMetrics = []string{
- goGCHeapTinyAllocsObjects,
- goGCHeapAllocsObjects,
- goGCHeapFreesObjects,
- goGCHeapAllocsBytes,
- goGCHeapObjects,
- goGCHeapGoalBytes,
- goMemoryClassesTotalBytes,
- goMemoryClassesHeapObjectsBytes,
- goMemoryClassesHeapUnusedBytes,
- goMemoryClassesHeapReleasedBytes,
- goMemoryClassesHeapFreeBytes,
- goMemoryClassesHeapStacksBytes,
- goMemoryClassesOSStacksBytes,
- goMemoryClassesMetadataMSpanInuseBytes,
- goMemoryClassesMetadataMSPanFreeBytes,
- goMemoryClassesMetadataMCacheInuseBytes,
- goMemoryClassesMetadataMCacheFreeBytes,
- goMemoryClassesProfilingBucketsBytes,
- goMemoryClassesMetadataOtherBytes,
- goMemoryClassesOtherBytes,
-}
-
-func bestEffortLookupRM(lookup []string) []metrics.Description {
- ret := make([]metrics.Description, 0, len(lookup))
- for _, rm := range metrics.All() {
- for _, m := range lookup {
- if m == rm.Name {
- ret = append(ret, rm)
- }
- }
- }
- return ret
-}
-
-type goCollector struct {
- base baseGoCollector
-
- // mu protects updates to all fields ensuring a consistent
- // snapshot is always produced by Collect.
- mu sync.Mutex
-
- // Contains all samples that has to retrieved from runtime/metrics (not all of them will be exposed).
- sampleBuf []metrics.Sample
- // sampleMap allows lookup for MemStats metrics and runtime/metrics histograms for exact sums.
- sampleMap map[string]*metrics.Sample
-
- // rmExposedMetrics represents all runtime/metrics package metrics
- // that were configured to be exposed.
- rmExposedMetrics []collectorMetric
- rmExactSumMapForHist map[string]string
-
- // With Go 1.17, the runtime/metrics package was introduced.
- // From that point on, metric names produced by the runtime/metrics
- // package could be generated from runtime/metrics names. However,
- // these differ from the old names for the same values.
- //
- // This field exists to export the same values under the old names
- // as well.
- msMetrics memStatsMetrics
- msMetricsEnabled bool
-}
-
-type rmMetricDesc struct {
- metrics.Description
-}
-
-func matchRuntimeMetricsRules(rules []internal.GoCollectorRule) []rmMetricDesc {
- var descs []rmMetricDesc
- for _, d := range metrics.All() {
- var (
- deny = true
- desc rmMetricDesc
- )
-
- for _, r := range rules {
- if !r.Matcher.MatchString(d.Name) {
- continue
- }
- deny = r.Deny
- }
- if deny {
- continue
- }
-
- desc.Description = d
- descs = append(descs, desc)
- }
- return descs
-}
-
-func defaultGoCollectorOptions() internal.GoCollectorOptions {
- return internal.GoCollectorOptions{
- RuntimeMetricSumForHist: map[string]string{
- "/gc/heap/allocs-by-size:bytes": goGCHeapAllocsBytes,
- "/gc/heap/frees-by-size:bytes": goGCHeapFreesBytes,
- },
- RuntimeMetricRules: []internal.GoCollectorRule{
- //{Matcher: regexp.MustCompile("")},
- },
- }
-}
-
-// NewGoCollector is the obsolete version of collectors.NewGoCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewGoCollector instead.
-func NewGoCollector(opts ...func(o *internal.GoCollectorOptions)) Collector {
- opt := defaultGoCollectorOptions()
- for _, o := range opts {
- o(&opt)
- }
-
- exposedDescriptions := matchRuntimeMetricsRules(opt.RuntimeMetricRules)
-
- // Collect all histogram samples so that we can get their buckets.
- // The API guarantees that the buckets are always fixed for the lifetime
- // of the process.
- var histograms []metrics.Sample
- for _, d := range exposedDescriptions {
- if d.Kind == metrics.KindFloat64Histogram {
- histograms = append(histograms, metrics.Sample{Name: d.Name})
- }
- }
-
- if len(histograms) > 0 {
- metrics.Read(histograms)
- }
-
- bucketsMap := make(map[string][]float64)
- for i := range histograms {
- bucketsMap[histograms[i].Name] = histograms[i].Value.Float64Histogram().Buckets
- }
-
- // Generate a collector for each exposed runtime/metrics metric.
- metricSet := make([]collectorMetric, 0, len(exposedDescriptions))
- // SampleBuf is used for reading from runtime/metrics.
- // We are assuming the largest case to have stable pointers for sampleMap purposes.
- sampleBuf := make([]metrics.Sample, 0, len(exposedDescriptions)+len(opt.RuntimeMetricSumForHist)+len(rmNamesForMemStatsMetrics))
- sampleMap := make(map[string]*metrics.Sample, len(exposedDescriptions))
- for _, d := range exposedDescriptions {
- namespace, subsystem, name, ok := internal.RuntimeMetricsToProm(&d.Description)
- if !ok {
- // Just ignore this metric; we can't do anything with it here.
- // If a user decides to use the latest version of Go, we don't want
- // to fail here. This condition is tested in TestExpectedRuntimeMetrics.
- continue
- }
-
- sampleBuf = append(sampleBuf, metrics.Sample{Name: d.Name})
- sampleMap[d.Name] = &sampleBuf[len(sampleBuf)-1]
-
- var m collectorMetric
- if d.Kind == metrics.KindFloat64Histogram {
- _, hasSum := opt.RuntimeMetricSumForHist[d.Name]
- unit := d.Name[strings.IndexRune(d.Name, ':')+1:]
- m = newBatchHistogram(
- NewDesc(
- BuildFQName(namespace, subsystem, name),
- d.Description.Description,
- nil,
- nil,
- ),
- internal.RuntimeMetricsBucketsForUnit(bucketsMap[d.Name], unit),
- hasSum,
- )
- } else if d.Cumulative {
- m = NewCounter(CounterOpts{
- Namespace: namespace,
- Subsystem: subsystem,
- Name: name,
- Help: d.Description.Description,
- },
- )
- } else {
- m = NewGauge(GaugeOpts{
- Namespace: namespace,
- Subsystem: subsystem,
- Name: name,
- Help: d.Description.Description,
- })
- }
- metricSet = append(metricSet, m)
- }
-
- // Add exact sum metrics to sampleBuf if not added before.
- for _, h := range histograms {
- sumMetric, ok := opt.RuntimeMetricSumForHist[h.Name]
- if !ok {
- continue
- }
-
- if _, ok := sampleMap[sumMetric]; ok {
- continue
- }
- sampleBuf = append(sampleBuf, metrics.Sample{Name: sumMetric})
- sampleMap[sumMetric] = &sampleBuf[len(sampleBuf)-1]
- }
-
- var (
- msMetrics memStatsMetrics
- msDescriptions []metrics.Description
- )
-
- if !opt.DisableMemStatsLikeMetrics {
- msMetrics = goRuntimeMemStats()
- msDescriptions = bestEffortLookupRM(rmNamesForMemStatsMetrics)
-
- // Check if metric was not exposed before and if not, add to sampleBuf.
- for _, mdDesc := range msDescriptions {
- if _, ok := sampleMap[mdDesc.Name]; ok {
- continue
- }
- sampleBuf = append(sampleBuf, metrics.Sample{Name: mdDesc.Name})
- sampleMap[mdDesc.Name] = &sampleBuf[len(sampleBuf)-1]
- }
- }
-
- return &goCollector{
- base: newBaseGoCollector(),
- sampleBuf: sampleBuf,
- sampleMap: sampleMap,
- rmExposedMetrics: metricSet,
- rmExactSumMapForHist: opt.RuntimeMetricSumForHist,
- msMetrics: msMetrics,
- msMetricsEnabled: !opt.DisableMemStatsLikeMetrics,
- }
-}
-
-// Describe returns all descriptions of the collector.
-func (c *goCollector) Describe(ch chan<- *Desc) {
- c.base.Describe(ch)
- for _, i := range c.msMetrics {
- ch <- i.desc
- }
- for _, m := range c.rmExposedMetrics {
- ch <- m.Desc()
- }
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *goCollector) Collect(ch chan<- Metric) {
- // Collect base non-memory metrics.
- c.base.Collect(ch)
-
- if len(c.sampleBuf) == 0 {
- return
- }
-
- // Collect must be thread-safe, so prevent concurrent use of
- // sampleBuf elements. Just read into sampleBuf but write all the data
- // we get into our Metrics or MemStats.
- //
- // This lock also ensures that the Metrics we send out are all from
- // the same updates, ensuring their mutual consistency insofar as
- // is guaranteed by the runtime/metrics package.
- //
- // N.B. This locking is heavy-handed, but Collect is expected to be called
- // relatively infrequently. Also the core operation here, metrics.Read,
- // is fast (O(tens of microseconds)) so contention should certainly be
- // low, though channel operations and any allocations may add to that.
- c.mu.Lock()
- defer c.mu.Unlock()
-
- // Populate runtime/metrics sample buffer.
- metrics.Read(c.sampleBuf)
-
- // Collect all our runtime/metrics user chose to expose from sampleBuf (if any).
- for i, metric := range c.rmExposedMetrics {
- // We created samples for exposed metrics first in order, so indexes match.
- sample := c.sampleBuf[i]
-
- // N.B. switch on concrete type because it's significantly more efficient
- // than checking for the Counter and Gauge interface implementations. In
- // this case, we control all the types here.
- switch m := metric.(type) {
- case *counter:
- // Guard against decreases. This should never happen, but a failure
- // to do so will result in a panic, which is a harsh consequence for
- // a metrics collection bug.
- v0, v1 := m.get(), unwrapScalarRMValue(sample.Value)
- if v1 > v0 {
- m.Add(unwrapScalarRMValue(sample.Value) - m.get())
- }
- m.Collect(ch)
- case *gauge:
- m.Set(unwrapScalarRMValue(sample.Value))
- m.Collect(ch)
- case *batchHistogram:
- m.update(sample.Value.Float64Histogram(), c.exactSumFor(sample.Name))
- m.Collect(ch)
- default:
- panic("unexpected metric type")
- }
- }
-
- if c.msMetricsEnabled {
- // ms is a dummy MemStats that we populate ourselves so that we can
- // populate the old metrics from it if goMemStatsCollection is enabled.
- var ms runtime.MemStats
- memStatsFromRM(&ms, c.sampleMap)
- for _, i := range c.msMetrics {
- ch <- MustNewConstMetric(i.desc, i.valType, i.eval(&ms))
- }
- }
-}
-
-// unwrapScalarRMValue unwraps a runtime/metrics value that is assumed
-// to be scalar and returns the equivalent float64 value. Panics if the
-// value is not scalar.
-func unwrapScalarRMValue(v metrics.Value) float64 {
- switch v.Kind() {
- case metrics.KindUint64:
- return float64(v.Uint64())
- case metrics.KindFloat64:
- return v.Float64()
- case metrics.KindBad:
- // Unsupported metric.
- //
- // This should never happen because we always populate our metric
- // set from the runtime/metrics package.
- panic("unexpected unsupported metric")
- default:
- // Unsupported metric kind.
- //
- // This should never happen because we check for this during initialization
- // and flag and filter metrics whose kinds we don't understand.
- panic("unexpected unsupported metric kind")
- }
-}
-
-// exactSumFor takes a runtime/metrics metric name (that is assumed to
-// be of kind KindFloat64Histogram) and returns its exact sum and whether
-// its exact sum exists.
-//
-// The runtime/metrics API for histograms doesn't currently expose exact
-// sums, but some of the other metrics are in fact exact sums of histograms.
-func (c *goCollector) exactSumFor(rmName string) float64 {
- sumName, ok := c.rmExactSumMapForHist[rmName]
- if !ok {
- return 0
- }
- s, ok := c.sampleMap[sumName]
- if !ok {
- return 0
- }
- return unwrapScalarRMValue(s.Value)
-}
-
-func memStatsFromRM(ms *runtime.MemStats, rm map[string]*metrics.Sample) {
- lookupOrZero := func(name string) uint64 {
- if s, ok := rm[name]; ok {
- return s.Value.Uint64()
- }
- return 0
- }
-
- // Currently, MemStats adds tiny alloc count to both Mallocs AND Frees.
- // The reason for this is because MemStats couldn't be extended at the time
- // but there was a desire to have Mallocs at least be a little more representative,
- // while having Mallocs - Frees still represent a live object count.
- // Unfortunately, MemStats doesn't actually export a large allocation count,
- // so it's impossible to pull this number out directly.
- tinyAllocs := lookupOrZero(goGCHeapTinyAllocsObjects)
- ms.Mallocs = lookupOrZero(goGCHeapAllocsObjects) + tinyAllocs
- ms.Frees = lookupOrZero(goGCHeapFreesObjects) + tinyAllocs
-
- ms.TotalAlloc = lookupOrZero(goGCHeapAllocsBytes)
- ms.Sys = lookupOrZero(goMemoryClassesTotalBytes)
- ms.Lookups = 0 // Already always zero.
- ms.HeapAlloc = lookupOrZero(goMemoryClassesHeapObjectsBytes)
- ms.Alloc = ms.HeapAlloc
- ms.HeapInuse = ms.HeapAlloc + lookupOrZero(goMemoryClassesHeapUnusedBytes)
- ms.HeapReleased = lookupOrZero(goMemoryClassesHeapReleasedBytes)
- ms.HeapIdle = ms.HeapReleased + lookupOrZero(goMemoryClassesHeapFreeBytes)
- ms.HeapSys = ms.HeapInuse + ms.HeapIdle
- ms.HeapObjects = lookupOrZero(goGCHeapObjects)
- ms.StackInuse = lookupOrZero(goMemoryClassesHeapStacksBytes)
- ms.StackSys = ms.StackInuse + lookupOrZero(goMemoryClassesOSStacksBytes)
- ms.MSpanInuse = lookupOrZero(goMemoryClassesMetadataMSpanInuseBytes)
- ms.MSpanSys = ms.MSpanInuse + lookupOrZero(goMemoryClassesMetadataMSPanFreeBytes)
- ms.MCacheInuse = lookupOrZero(goMemoryClassesMetadataMCacheInuseBytes)
- ms.MCacheSys = ms.MCacheInuse + lookupOrZero(goMemoryClassesMetadataMCacheFreeBytes)
- ms.BuckHashSys = lookupOrZero(goMemoryClassesProfilingBucketsBytes)
- ms.GCSys = lookupOrZero(goMemoryClassesMetadataOtherBytes)
- ms.OtherSys = lookupOrZero(goMemoryClassesOtherBytes)
- ms.NextGC = lookupOrZero(goGCHeapGoalBytes)
-
- // N.B. GCCPUFraction is intentionally omitted. This metric is not useful,
- // and often misleading due to the fact that it's an average over the lifetime
- // of the process.
- // See https://github.com/prometheus/client_golang/issues/842#issuecomment-861812034
- // for more details.
- ms.GCCPUFraction = 0
-}
-
-// batchHistogram is a mutable histogram that is updated
-// in batches.
-type batchHistogram struct {
- selfCollector
-
- // Static fields updated only once.
- desc *Desc
- hasSum bool
-
- // Because this histogram operates in batches, it just uses a
- // single mutex for everything. updates are always serialized
- // but Write calls may operate concurrently with updates.
- // Contention between these two sources should be rare.
- mu sync.Mutex
- buckets []float64 // Inclusive lower bounds, like runtime/metrics.
- counts []uint64
- sum float64 // Used if hasSum is true.
-}
-
-// newBatchHistogram creates a new batch histogram value with the given
-// Desc, buckets, and whether or not it has an exact sum available.
-//
-// buckets must always be from the runtime/metrics package, following
-// the same conventions.
-func newBatchHistogram(desc *Desc, buckets []float64, hasSum bool) *batchHistogram {
- // We need to remove -Inf values. runtime/metrics keeps them around.
- // But -Inf bucket should not be allowed for prometheus histograms.
- if buckets[0] == math.Inf(-1) {
- buckets = buckets[1:]
- }
- h := &batchHistogram{
- desc: desc,
- buckets: buckets,
- // Because buckets follows runtime/metrics conventions, there's
- // 1 more value in the buckets list than there are buckets represented,
- // because in runtime/metrics, the bucket values represent *boundaries*,
- // and non-Inf boundaries are inclusive lower bounds for that bucket.
- counts: make([]uint64, len(buckets)-1),
- hasSum: hasSum,
- }
- h.init(h)
- return h
-}
-
-// update updates the batchHistogram from a runtime/metrics histogram.
-//
-// sum must be provided if the batchHistogram was created to have an exact sum.
-// h.buckets must be a strict subset of his.Buckets.
-func (h *batchHistogram) update(his *metrics.Float64Histogram, sum float64) {
- counts, buckets := his.Counts, his.Buckets
-
- h.mu.Lock()
- defer h.mu.Unlock()
-
- // Clear buckets.
- for i := range h.counts {
- h.counts[i] = 0
- }
- // Copy and reduce buckets.
- var j int
- for i, count := range counts {
- h.counts[j] += count
- if buckets[i+1] == h.buckets[j+1] {
- j++
- }
- }
- if h.hasSum {
- h.sum = sum
- }
-}
-
-func (h *batchHistogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *batchHistogram) Write(out *dto.Metric) error {
- h.mu.Lock()
- defer h.mu.Unlock()
-
- sum := float64(0)
- if h.hasSum {
- sum = h.sum
- }
- dtoBuckets := make([]*dto.Bucket, 0, len(h.counts))
- totalCount := uint64(0)
- for i, count := range h.counts {
- totalCount += count
- if !h.hasSum {
- if count != 0 {
- // N.B. This computed sum is an underestimate.
- sum += h.buckets[i] * float64(count)
- }
- }
-
- // Skip the +Inf bucket, but only for the bucket list.
- // It must still count for sum and totalCount.
- if math.IsInf(h.buckets[i+1], 1) {
- break
- }
- // Float64Histogram's upper bound is exclusive, so make it inclusive
- // by obtaining the next float64 value down, in order.
- upperBound := math.Nextafter(h.buckets[i+1], h.buckets[i])
- dtoBuckets = append(dtoBuckets, &dto.Bucket{
- CumulativeCount: proto.Uint64(totalCount),
- UpperBound: proto.Float64(upperBound),
- })
- }
- out.Histogram = &dto.Histogram{
- Bucket: dtoBuckets,
- SampleCount: proto.Uint64(totalCount),
- SampleSum: proto.Float64(sum),
- }
- return nil
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go b/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
deleted file mode 100644
index b5c8bcb..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/histogram.go
+++ /dev/null
@@ -1,1577 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "math"
- "runtime"
- "sort"
- "sync"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/types/known/timestamppb"
-)
-
-// nativeHistogramBounds for the frac of observed values. Only relevant for
-// schema > 0. The position in the slice is the schema. (0 is never used, just
-// here for convenience of using the schema directly as the index.)
-//
-// TODO(beorn7): Currently, we do a binary search into these slices. There are
-// ways to turn it into a small number of simple array lookups. It probably only
-// matters for schema 5 and beyond, but should be investigated. See this comment
-// as a starting point:
-// https://github.com/open-telemetry/opentelemetry-specification/issues/1776#issuecomment-870164310
-var nativeHistogramBounds = [][]float64{
- // Schema "0":
- {0.5},
- // Schema 1:
- {0.5, 0.7071067811865475},
- // Schema 2:
- {0.5, 0.5946035575013605, 0.7071067811865475, 0.8408964152537144},
- // Schema 3:
- {
- 0.5, 0.5452538663326288, 0.5946035575013605, 0.6484197773255048,
- 0.7071067811865475, 0.7711054127039704, 0.8408964152537144, 0.9170040432046711,
- },
- // Schema 4:
- {
- 0.5, 0.5221368912137069, 0.5452538663326288, 0.5693943173783458,
- 0.5946035575013605, 0.620928906036742, 0.6484197773255048, 0.6771277734684463,
- 0.7071067811865475, 0.7384130729697496, 0.7711054127039704, 0.805245165974627,
- 0.8408964152537144, 0.8781260801866495, 0.9170040432046711, 0.9576032806985735,
- },
- // Schema 5:
- {
- 0.5, 0.5109485743270583, 0.5221368912137069, 0.5335702003384117,
- 0.5452538663326288, 0.5571933712979462, 0.5693943173783458, 0.5818624293887887,
- 0.5946035575013605, 0.6076236799902344, 0.620928906036742, 0.6345254785958666,
- 0.6484197773255048, 0.6626183215798706, 0.6771277734684463, 0.6919549409819159,
- 0.7071067811865475, 0.7225904034885232, 0.7384130729697496, 0.7545822137967112,
- 0.7711054127039704, 0.7879904225539431, 0.805245165974627, 0.8228777390769823,
- 0.8408964152537144, 0.8593096490612387, 0.8781260801866495, 0.8973545375015533,
- 0.9170040432046711, 0.9370838170551498, 0.9576032806985735, 0.9785720620876999,
- },
- // Schema 6:
- {
- 0.5, 0.5054446430258502, 0.5109485743270583, 0.5165124395106142,
- 0.5221368912137069, 0.5278225891802786, 0.5335702003384117, 0.5393803988785598,
- 0.5452538663326288, 0.5511912916539204, 0.5571933712979462, 0.5632608093041209,
- 0.5693943173783458, 0.5755946149764913, 0.5818624293887887, 0.5881984958251406,
- 0.5946035575013605, 0.6010783657263515, 0.6076236799902344, 0.6142402680534349,
- 0.620928906036742, 0.6276903785123455, 0.6345254785958666, 0.6414350080393891,
- 0.6484197773255048, 0.6554806057623822, 0.6626183215798706, 0.6698337620266515,
- 0.6771277734684463, 0.6845012114872953, 0.6919549409819159, 0.6994898362691555,
- 0.7071067811865475, 0.7148066691959849, 0.7225904034885232, 0.7304588970903234,
- 0.7384130729697496, 0.7464538641456323, 0.7545822137967112, 0.762799075372269,
- 0.7711054127039704, 0.7795022001189185, 0.7879904225539431, 0.7965710756711334,
- 0.805245165974627, 0.8140137109286738, 0.8228777390769823, 0.8318382901633681,
- 0.8408964152537144, 0.8500531768592616, 0.8593096490612387, 0.8686669176368529,
- 0.8781260801866495, 0.8876882462632604, 0.8973545375015533, 0.9071260877501991,
- 0.9170040432046711, 0.9269895625416926, 0.9370838170551498, 0.9472879907934827,
- 0.9576032806985735, 0.9680308967461471, 0.9785720620876999, 0.9892280131939752,
- },
- // Schema 7:
- {
- 0.5, 0.5027149505564014, 0.5054446430258502, 0.5081891574554764,
- 0.5109485743270583, 0.5137229745593818, 0.5165124395106142, 0.5193170509806894,
- 0.5221368912137069, 0.5249720429003435, 0.5278225891802786, 0.5306886136446309,
- 0.5335702003384117, 0.5364674337629877, 0.5393803988785598, 0.5423091811066545,
- 0.5452538663326288, 0.5482145409081883, 0.5511912916539204, 0.5541842058618393,
- 0.5571933712979462, 0.5602188762048033, 0.5632608093041209, 0.5663192597993595,
- 0.5693943173783458, 0.572486072215902, 0.5755946149764913, 0.5787200368168754,
- 0.5818624293887887, 0.585021884841625, 0.5881984958251406, 0.5913923554921704,
- 0.5946035575013605, 0.5978321960199137, 0.6010783657263515, 0.6043421618132907,
- 0.6076236799902344, 0.6109230164863786, 0.6142402680534349, 0.6175755319684665,
- 0.620928906036742, 0.6243004885946023, 0.6276903785123455, 0.6310986751971253,
- 0.6345254785958666, 0.637970889198196, 0.6414350080393891, 0.6449179367033329,
- 0.6484197773255048, 0.6519406325959679, 0.6554806057623822, 0.659039800633032,
- 0.6626183215798706, 0.6662162735415805, 0.6698337620266515, 0.6734708931164728,
- 0.6771277734684463, 0.6808045103191123, 0.6845012114872953, 0.688217985377265,
- 0.6919549409819159, 0.6957121878859629, 0.6994898362691555, 0.7032879969095076,
- 0.7071067811865475, 0.7109463010845827, 0.7148066691959849, 0.718687998724491,
- 0.7225904034885232, 0.7265139979245261, 0.7304588970903234, 0.7344252166684908,
- 0.7384130729697496, 0.7424225829363761, 0.7464538641456323, 0.7505070348132126,
- 0.7545822137967112, 0.7586795205991071, 0.762799075372269, 0.7669409989204777,
- 0.7711054127039704, 0.7752924388424999, 0.7795022001189185, 0.7837348199827764,
- 0.7879904225539431, 0.7922691326262467, 0.7965710756711334, 0.8008963778413465,
- 0.805245165974627, 0.8096175675974316, 0.8140137109286738, 0.8184337248834821,
- 0.8228777390769823, 0.8273458838280969, 0.8318382901633681, 0.8363550898207981,
- 0.8408964152537144, 0.8454623996346523, 0.8500531768592616, 0.8546688815502312,
- 0.8593096490612387, 0.8639756154809185, 0.8686669176368529, 0.8733836930995842,
- 0.8781260801866495, 0.8828942179666361, 0.8876882462632604, 0.8925083056594671,
- 0.8973545375015533, 0.9022270839033115, 0.9071260877501991, 0.9120516927035263,
- 0.9170040432046711, 0.9219832844793128, 0.9269895625416926, 0.9320230241988943,
- 0.9370838170551498, 0.9421720895161669, 0.9472879907934827, 0.9524316709088368,
- 0.9576032806985735, 0.9628029718180622, 0.9680308967461471, 0.9732872087896164,
- 0.9785720620876999, 0.9838856116165875, 0.9892280131939752, 0.9945994234836328,
- },
- // Schema 8:
- {
- 0.5, 0.5013556375251013, 0.5027149505564014, 0.5040779490592088,
- 0.5054446430258502, 0.5068150424757447, 0.5081891574554764, 0.509566998038869,
- 0.5109485743270583, 0.5123338964485679, 0.5137229745593818, 0.5151158188430205,
- 0.5165124395106142, 0.5179128468009786, 0.5193170509806894, 0.520725062344158,
- 0.5221368912137069, 0.5235525479396449, 0.5249720429003435, 0.526395386502313,
- 0.5278225891802786, 0.5292536613972564, 0.5306886136446309, 0.5321274564422321,
- 0.5335702003384117, 0.5350168559101208, 0.5364674337629877, 0.5379219445313954,
- 0.5393803988785598, 0.5408428074966075, 0.5423091811066545, 0.5437795304588847,
- 0.5452538663326288, 0.5467321995364429, 0.5482145409081883, 0.549700901315111,
- 0.5511912916539204, 0.5526857228508706, 0.5541842058618393, 0.5556867516724088,
- 0.5571933712979462, 0.5587040757836845, 0.5602188762048033, 0.5617377836665098,
- 0.5632608093041209, 0.564787964283144, 0.5663192597993595, 0.5678547070789026,
- 0.5693943173783458, 0.5709381019847808, 0.572486072215902, 0.5740382394200894,
- 0.5755946149764913, 0.5771552102951081, 0.5787200368168754, 0.5802891060137493,
- 0.5818624293887887, 0.5834400184762408, 0.585021884841625, 0.5866080400818185,
- 0.5881984958251406, 0.5897932637314379, 0.5913923554921704, 0.5929957828304968,
- 0.5946035575013605, 0.5962156912915756, 0.5978321960199137, 0.5994530835371903,
- 0.6010783657263515, 0.6027080545025619, 0.6043421618132907, 0.6059806996384005,
- 0.6076236799902344, 0.6092711149137041, 0.6109230164863786, 0.6125793968185725,
- 0.6142402680534349, 0.6159056423670379, 0.6175755319684665, 0.6192499490999082,
- 0.620928906036742, 0.622612415087629, 0.6243004885946023, 0.6259931389331581,
- 0.6276903785123455, 0.6293922197748583, 0.6310986751971253, 0.6328097572894031,
- 0.6345254785958666, 0.6362458516947014, 0.637970889198196, 0.6397006037528346,
- 0.6414350080393891, 0.6431741147730128, 0.6449179367033329, 0.6466664866145447,
- 0.6484197773255048, 0.6501778216898253, 0.6519406325959679, 0.6537082229673385,
- 0.6554806057623822, 0.6572577939746774, 0.659039800633032, 0.6608266388015788,
- 0.6626183215798706, 0.6644148621029772, 0.6662162735415805, 0.6680225691020727,
- 0.6698337620266515, 0.6716498655934177, 0.6734708931164728, 0.6752968579460171,
- 0.6771277734684463, 0.6789636531064505, 0.6808045103191123, 0.6826503586020058,
- 0.6845012114872953, 0.6863570825438342, 0.688217985377265, 0.690083933630119,
- 0.6919549409819159, 0.6938310211492645, 0.6957121878859629, 0.6975984549830999,
- 0.6994898362691555, 0.7013863456101023, 0.7032879969095076, 0.7051948041086352,
- 0.7071067811865475, 0.7090239421602076, 0.7109463010845827, 0.7128738720527471,
- 0.7148066691959849, 0.7167447066838943, 0.718687998724491, 0.7206365595643126,
- 0.7225904034885232, 0.7245495448210174, 0.7265139979245261, 0.7284837772007218,
- 0.7304588970903234, 0.7324393720732029, 0.7344252166684908, 0.7364164454346837,
- 0.7384130729697496, 0.7404151139112358, 0.7424225829363761, 0.7444354947621984,
- 0.7464538641456323, 0.7484777058836176, 0.7505070348132126, 0.7525418658117031,
- 0.7545822137967112, 0.7566280937263048, 0.7586795205991071, 0.7607365094544071,
- 0.762799075372269, 0.7648672334736434, 0.7669409989204777, 0.7690203869158282,
- 0.7711054127039704, 0.7731960915705107, 0.7752924388424999, 0.7773944698885442,
- 0.7795022001189185, 0.7816156449856788, 0.7837348199827764, 0.7858597406461707,
- 0.7879904225539431, 0.7901268813264122, 0.7922691326262467, 0.7944171921585818,
- 0.7965710756711334, 0.7987307989543135, 0.8008963778413465, 0.8030678282083853,
- 0.805245165974627, 0.8074284071024302, 0.8096175675974316, 0.8118126635086642,
- 0.8140137109286738, 0.8162207259936375, 0.8184337248834821, 0.820652723822003,
- 0.8228777390769823, 0.8251087869603088, 0.8273458838280969, 0.8295890460808079,
- 0.8318382901633681, 0.8340936325652911, 0.8363550898207981, 0.8386226785089391,
- 0.8408964152537144, 0.8431763167241966, 0.8454623996346523, 0.8477546807446661,
- 0.8500531768592616, 0.8523579048290255, 0.8546688815502312, 0.8569861239649629,
- 0.8593096490612387, 0.8616394738731368, 0.8639756154809185, 0.8663180910111553,
- 0.8686669176368529, 0.871022112577578, 0.8733836930995842, 0.8757516765159389,
- 0.8781260801866495, 0.8805069215187917, 0.8828942179666361, 0.8852879870317771,
- 0.8876882462632604, 0.890095013257712, 0.8925083056594671, 0.8949281411607002,
- 0.8973545375015533, 0.8997875124702672, 0.9022270839033115, 0.9046732696855155,
- 0.9071260877501991, 0.909585556079304, 0.9120516927035263, 0.9145245157024483,
- 0.9170040432046711, 0.9194902933879467, 0.9219832844793128, 0.9244830347552253,
- 0.9269895625416926, 0.92950288621441, 0.9320230241988943, 0.9345499949706191,
- 0.9370838170551498, 0.93962450902828, 0.9421720895161669, 0.9447265771954693,
- 0.9472879907934827, 0.9498563490882775, 0.9524316709088368, 0.9550139751351947,
- 0.9576032806985735, 0.9601996065815236, 0.9628029718180622, 0.9654133954938133,
- 0.9680308967461471, 0.9706554947643201, 0.9732872087896164, 0.9759260581154889,
- 0.9785720620876999, 0.9812252401044634, 0.9838856116165875, 0.9865531961276168,
- 0.9892280131939752, 0.9919100824251095, 0.9945994234836328, 0.9972960560854698,
- },
-}
-
-// The nativeHistogramBounds above can be generated with the code below.
-//
-// TODO(beorn7): It's tempting to actually use `go generate` to generate the
-// code above. However, this could lead to slightly different numbers on
-// different architectures. We still need to come to terms if we are fine with
-// that, or if we might prefer to specify precise numbers in the standard.
-//
-// var nativeHistogramBounds [][]float64 = make([][]float64, 9)
-//
-// func init() {
-// // Populate nativeHistogramBounds.
-// numBuckets := 1
-// for i := range nativeHistogramBounds {
-// bounds := []float64{0.5}
-// factor := math.Exp2(math.Exp2(float64(-i)))
-// for j := 0; j < numBuckets-1; j++ {
-// var bound float64
-// if (j+1)%2 == 0 {
-// // Use previously calculated value for increased precision.
-// bound = nativeHistogramBounds[i-1][j/2+1]
-// } else {
-// bound = bounds[j] * factor
-// }
-// bounds = append(bounds, bound)
-// }
-// numBuckets *= 2
-// nativeHistogramBounds[i] = bounds
-// }
-// }
-
-// A Histogram counts individual observations from an event or sample stream in
-// configurable static buckets (or in dynamic sparse buckets as part of the
-// experimental Native Histograms, see below for more details). Similar to a
-// Summary, it also provides a sum of observations and an observation count.
-//
-// On the Prometheus server, quantiles can be calculated from a Histogram using
-// the histogram_quantile PromQL function.
-//
-// Note that Histograms, in contrast to Summaries, can be aggregated in PromQL
-// (see the documentation for detailed procedures). However, Histograms require
-// the user to pre-define suitable buckets, and they are in general less
-// accurate. (Both problems are addressed by the experimental Native
-// Histograms. To use them, configure a NativeHistogramBucketFactor in the
-// HistogramOpts. They also require a Prometheus server v2.40+ with the
-// corresponding feature flag enabled.)
-//
-// The Observe method of a Histogram has a very low performance overhead in
-// comparison with the Observe method of a Summary.
-//
-// To create Histogram instances, use NewHistogram.
-type Histogram interface {
- Metric
- Collector
-
- // Observe adds a single observation to the histogram. Observations are
- // usually positive or zero. Negative observations are accepted but
- // prevent current versions of Prometheus from properly detecting
- // counter resets in the sum of observations. (The experimental Native
- // Histograms handle negative observations properly.) See
- // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations
- // for details.
- Observe(float64)
-}
-
-// bucketLabel is used for the label that defines the upper bound of a
-// bucket of a histogram ("le" -> "less or equal").
-const bucketLabel = "le"
-
-// DefBuckets are the default Histogram buckets. The default buckets are
-// tailored to broadly measure the response time (in seconds) of a network
-// service. Most likely, however, you will be required to define buckets
-// customized to your use case.
-var DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}
-
-// DefNativeHistogramZeroThreshold is the default value for
-// NativeHistogramZeroThreshold in the HistogramOpts.
-//
-// The value is 2^-128 (or 0.5*2^-127 in the actual IEEE 754 representation),
-// which is a bucket boundary at all possible resolutions.
-const DefNativeHistogramZeroThreshold = 2.938735877055719e-39
-
-// NativeHistogramZeroThresholdZero can be used as NativeHistogramZeroThreshold
-// in the HistogramOpts to create a zero bucket of width zero, i.e. a zero
-// bucket that only receives observations of precisely zero.
-const NativeHistogramZeroThresholdZero = -1
-
-var errBucketLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in histograms", bucketLabel,
-)
-
-// LinearBuckets creates 'count' regular buckets, each 'width' wide, where the
-// lowest bucket has an upper bound of 'start'. The final +Inf bucket is not
-// counted and not included in the returned slice. The returned slice is meant
-// to be used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is zero or negative.
-func LinearBuckets(start, width float64, count int) []float64 {
- if count < 1 {
- panic("LinearBuckets needs a positive count")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start += width
- }
- return buckets
-}
-
-// ExponentialBuckets creates 'count' regular buckets, where the lowest bucket
-// has an upper bound of 'start' and each following bucket's upper bound is
-// 'factor' times the previous bucket's upper bound. The final +Inf bucket is
-// not counted and not included in the returned slice. The returned slice is
-// meant to be used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is 0 or negative, if 'start' is 0 or negative,
-// or if 'factor' is less than or equal 1.
-func ExponentialBuckets(start, factor float64, count int) []float64 {
- if count < 1 {
- panic("ExponentialBuckets needs a positive count")
- }
- if start <= 0 {
- panic("ExponentialBuckets needs a positive start value")
- }
- if factor <= 1 {
- panic("ExponentialBuckets needs a factor greater than 1")
- }
- buckets := make([]float64, count)
- for i := range buckets {
- buckets[i] = start
- start *= factor
- }
- return buckets
-}
-
-// ExponentialBucketsRange creates 'count' buckets, where the lowest bucket is
-// 'min' and the highest bucket is 'max'. The final +Inf bucket is not counted
-// and not included in the returned slice. The returned slice is meant to be
-// used for the Buckets field of HistogramOpts.
-//
-// The function panics if 'count' is 0 or negative, if 'min' is 0 or negative.
-func ExponentialBucketsRange(min, max float64, count int) []float64 {
- if count < 1 {
- panic("ExponentialBucketsRange count needs a positive count")
- }
- if min <= 0 {
- panic("ExponentialBucketsRange min needs to be greater than 0")
- }
-
- // Formula for exponential buckets.
- // max = min*growthFactor^(bucketCount-1)
-
- // We know max/min and highest bucket. Solve for growthFactor.
- growthFactor := math.Pow(max/min, 1.0/float64(count-1))
-
- // Now that we know growthFactor, solve for each bucket.
- buckets := make([]float64, count)
- for i := 1; i <= count; i++ {
- buckets[i-1] = min * math.Pow(growthFactor, float64(i-1))
- }
- return buckets
-}
-
-// HistogramOpts bundles the options for creating a Histogram metric. It is
-// mandatory to set Name to a non-empty string. All other fields are optional
-// and can safely be left at their zero value, although it is strongly
-// encouraged to set a Help string.
-type HistogramOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Histogram (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Histogram must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Histogram.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels
- ConstLabels Labels
-
- // Buckets defines the buckets into which observations are counted. Each
- // element in the slice is the upper inclusive bound of a bucket. The
- // values must be sorted in strictly increasing order. There is no need
- // to add a highest bucket with +Inf bound, it will be added
- // implicitly. If Buckets is left as nil or set to a slice of length
- // zero, it is replaced by default buckets. The default buckets are
- // DefBuckets if no buckets for a native histogram (see below) are used,
- // otherwise the default is no buckets. (In other words, if you want to
- // use both regular buckets and buckets for a native histogram, you have
- // to define the regular buckets here explicitly.)
- Buckets []float64
-
- // If NativeHistogramBucketFactor is greater than one, so-called sparse
- // buckets are used (in addition to the regular buckets, if defined
- // above). A Histogram with sparse buckets will be ingested as a Native
- // Histogram by a Prometheus server with that feature enabled (requires
- // Prometheus v2.40+). Sparse buckets are exponential buckets covering
- // the whole float64 range (with the exception of the “zero” bucket, see
- // NativeHistogramZeroThreshold below). From any one bucket to the next,
- // the width of the bucket grows by a constant
- // factor. NativeHistogramBucketFactor provides an upper bound for this
- // factor (exception see below). The smaller
- // NativeHistogramBucketFactor, the more buckets will be used and thus
- // the more costly the histogram will become. A generally good trade-off
- // between cost and accuracy is a value of 1.1 (each bucket is at most
- // 10% wider than the previous one), which will result in each power of
- // two divided into 8 buckets (e.g. there will be 8 buckets between 1
- // and 2, same as between 2 and 4, and 4 and 8, etc.).
- //
- // Details about the actually used factor: The factor is calculated as
- // 2^(2^-n), where n is an integer number between (and including) -4 and
- // 8. n is chosen so that the resulting factor is the largest that is
- // still smaller or equal to NativeHistogramBucketFactor. Note that the
- // smallest possible factor is therefore approx. 1.00271 (i.e. 2^(2^-8)
- // ). If NativeHistogramBucketFactor is greater than 1 but smaller than
- // 2^(2^-8), then the actually used factor is still 2^(2^-8) even though
- // it is larger than the provided NativeHistogramBucketFactor.
- //
- // NOTE: Native Histograms are still an experimental feature. Their
- // behavior might still change without a major version
- // bump. Subsequently, all NativeHistogram... options here might still
- // change their behavior or name (or might completely disappear) without
- // a major version bump.
- NativeHistogramBucketFactor float64
- // All observations with an absolute value of less or equal
- // NativeHistogramZeroThreshold are accumulated into a “zero” bucket.
- // For best results, this should be close to a bucket boundary. This is
- // usually the case if picking a power of two. If
- // NativeHistogramZeroThreshold is left at zero,
- // DefNativeHistogramZeroThreshold is used as the threshold. To
- // configure a zero bucket with an actual threshold of zero (i.e. only
- // observations of precisely zero will go into the zero bucket), set
- // NativeHistogramZeroThreshold to the NativeHistogramZeroThresholdZero
- // constant (or any negative float value).
- NativeHistogramZeroThreshold float64
-
- // The remaining fields define a strategy to limit the number of
- // populated sparse buckets. If NativeHistogramMaxBucketNumber is left
- // at zero, the number of buckets is not limited. (Note that this might
- // lead to unbounded memory consumption if the values observed by the
- // Histogram are sufficiently wide-spread. In particular, this could be
- // used as a DoS attack vector. Where the observed values depend on
- // external inputs, it is highly recommended to set a
- // NativeHistogramMaxBucketNumber.) Once the set
- // NativeHistogramMaxBucketNumber is exceeded, the following strategy is
- // enacted:
- // - First, if the last reset (or the creation) of the histogram is at
- // least NativeHistogramMinResetDuration ago, then the whole
- // histogram is reset to its initial state (including regular
- // buckets).
- // - If less time has passed, or if NativeHistogramMinResetDuration is
- // zero, no reset is performed. Instead, the zero threshold is
- // increased sufficiently to reduce the number of buckets to or below
- // NativeHistogramMaxBucketNumber, but not to more than
- // NativeHistogramMaxZeroThreshold. Thus, if
- // NativeHistogramMaxZeroThreshold is already at or below the current
- // zero threshold, nothing happens at this step.
- // - After that, if the number of buckets still exceeds
- // NativeHistogramMaxBucketNumber, the resolution of the histogram is
- // reduced by doubling the width of the sparse buckets (up to a
- // growth factor between one bucket to the next of 2^(2^4) = 65536,
- // see above).
- // - Any increased zero threshold or reduced resolution is reset back
- // to their original values once NativeHistogramMinResetDuration has
- // passed (since the last reset or the creation of the histogram).
- NativeHistogramMaxBucketNumber uint32
- NativeHistogramMinResetDuration time.Duration
- NativeHistogramMaxZeroThreshold float64
-
- // now is for testing purposes, by default it's time.Now.
- now func() time.Time
-
- // afterFunc is for testing purposes, by default it's time.AfterFunc.
- afterFunc func(time.Duration, func()) *time.Timer
-}
-
-// HistogramVecOpts bundles the options to create a HistogramVec metric.
-// It is mandatory to set HistogramOpts, see there for mandatory fields. VariableLabels
-// is optional and can safely be left to its default value.
-type HistogramVecOpts struct {
- HistogramOpts
-
- // VariableLabels are used to partition the metric vector by the given set
- // of labels. Each label value will be constrained with the optional Constraint
- // function, if provided.
- VariableLabels ConstrainableLabels
-}
-
-// NewHistogram creates a new Histogram based on the provided HistogramOpts. It
-// panics if the buckets in HistogramOpts are not in strictly increasing order.
-//
-// The returned implementation also implements ExemplarObserver. It is safe to
-// perform the corresponding type assertion. Exemplars are tracked separately
-// for each bucket.
-func NewHistogram(opts HistogramOpts) Histogram {
- return newHistogram(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram {
- if len(desc.variableLabels.names) != len(labelValues) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels.names, labelValues))
- }
-
- for _, n := range desc.variableLabels.names {
- if n == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == bucketLabel {
- panic(errBucketLabelNotAllowed)
- }
- }
-
- if opts.now == nil {
- opts.now = time.Now
- }
- if opts.afterFunc == nil {
- opts.afterFunc = time.AfterFunc
- }
- h := &histogram{
- desc: desc,
- upperBounds: opts.Buckets,
- labelPairs: MakeLabelPairs(desc, labelValues),
- nativeHistogramMaxBuckets: opts.NativeHistogramMaxBucketNumber,
- nativeHistogramMaxZeroThreshold: opts.NativeHistogramMaxZeroThreshold,
- nativeHistogramMinResetDuration: opts.NativeHistogramMinResetDuration,
- lastResetTime: opts.now(),
- now: opts.now,
- afterFunc: opts.afterFunc,
- }
- if len(h.upperBounds) == 0 && opts.NativeHistogramBucketFactor <= 1 {
- h.upperBounds = DefBuckets
- }
- if opts.NativeHistogramBucketFactor <= 1 {
- h.nativeHistogramSchema = math.MinInt32 // To mark that there are no sparse buckets.
- } else {
- switch {
- case opts.NativeHistogramZeroThreshold > 0:
- h.nativeHistogramZeroThreshold = opts.NativeHistogramZeroThreshold
- case opts.NativeHistogramZeroThreshold == 0:
- h.nativeHistogramZeroThreshold = DefNativeHistogramZeroThreshold
- } // Leave h.nativeHistogramZeroThreshold at 0 otherwise.
- h.nativeHistogramSchema = pickSchema(opts.NativeHistogramBucketFactor)
- }
- for i, upperBound := range h.upperBounds {
- if i < len(h.upperBounds)-1 {
- if upperBound >= h.upperBounds[i+1] {
- panic(fmt.Errorf(
- "histogram buckets must be in increasing order: %f >= %f",
- upperBound, h.upperBounds[i+1],
- ))
- }
- } else {
- if math.IsInf(upperBound, +1) {
- // The +Inf bucket is implicit. Remove it here.
- h.upperBounds = h.upperBounds[:i]
- }
- }
- }
- // Finally we know the final length of h.upperBounds and can make buckets
- // for both counts as well as exemplars:
- h.counts[0] = &histogramCounts{buckets: make([]uint64, len(h.upperBounds))}
- atomic.StoreUint64(&h.counts[0].nativeHistogramZeroThresholdBits, math.Float64bits(h.nativeHistogramZeroThreshold))
- atomic.StoreInt32(&h.counts[0].nativeHistogramSchema, h.nativeHistogramSchema)
- h.counts[1] = &histogramCounts{buckets: make([]uint64, len(h.upperBounds))}
- atomic.StoreUint64(&h.counts[1].nativeHistogramZeroThresholdBits, math.Float64bits(h.nativeHistogramZeroThreshold))
- atomic.StoreInt32(&h.counts[1].nativeHistogramSchema, h.nativeHistogramSchema)
- h.exemplars = make([]atomic.Value, len(h.upperBounds)+1)
-
- h.init(h) // Init self-collection.
- return h
-}
-
-type histogramCounts struct {
- // Order in this struct matters for the alignment required by atomic
- // operations, see http://golang.org/pkg/sync/atomic/#pkg-note-BUG
-
- // sumBits contains the bits of the float64 representing the sum of all
- // observations.
- sumBits uint64
- count uint64
-
- // nativeHistogramZeroBucket counts all (positive and negative)
- // observations in the zero bucket (with an absolute value less or equal
- // the current threshold, see next field.
- nativeHistogramZeroBucket uint64
- // nativeHistogramZeroThresholdBits is the bit pattern of the current
- // threshold for the zero bucket. It's initially equal to
- // nativeHistogramZeroThreshold but may change according to the bucket
- // count limitation strategy.
- nativeHistogramZeroThresholdBits uint64
- // nativeHistogramSchema may change over time according to the bucket
- // count limitation strategy and therefore has to be saved here.
- nativeHistogramSchema int32
- // Number of (positive and negative) sparse buckets.
- nativeHistogramBucketsNumber uint32
-
- // Regular buckets.
- buckets []uint64
-
- // The sparse buckets for native histograms are implemented with a
- // sync.Map for now. A dedicated data structure will likely be more
- // efficient. There are separate maps for negative and positive
- // observations. The map's value is an *int64, counting observations in
- // that bucket. (Note that we don't use uint64 as an int64 won't
- // overflow in practice, and working with signed numbers from the
- // beginning simplifies the handling of deltas.) The map's key is the
- // index of the bucket according to the used
- // nativeHistogramSchema. Index 0 is for an upper bound of 1.
- nativeHistogramBucketsPositive, nativeHistogramBucketsNegative sync.Map
-}
-
-// observe manages the parts of observe that only affects
-// histogramCounts. doSparse is true if sparse buckets should be done,
-// too.
-func (hc *histogramCounts) observe(v float64, bucket int, doSparse bool) {
- if bucket < len(hc.buckets) {
- atomic.AddUint64(&hc.buckets[bucket], 1)
- }
- atomicAddFloat(&hc.sumBits, v)
- if doSparse && !math.IsNaN(v) {
- var (
- key int
- schema = atomic.LoadInt32(&hc.nativeHistogramSchema)
- zeroThreshold = math.Float64frombits(atomic.LoadUint64(&hc.nativeHistogramZeroThresholdBits))
- bucketCreated, isInf bool
- )
- if math.IsInf(v, 0) {
- // Pretend v is MaxFloat64 but later increment key by one.
- if math.IsInf(v, +1) {
- v = math.MaxFloat64
- } else {
- v = -math.MaxFloat64
- }
- isInf = true
- }
- frac, exp := math.Frexp(math.Abs(v))
- if schema > 0 {
- bounds := nativeHistogramBounds[schema]
- key = sort.SearchFloat64s(bounds, frac) + (exp-1)*len(bounds)
- } else {
- key = exp
- if frac == 0.5 {
- key--
- }
- offset := (1 << -schema) - 1
- key = (key + offset) >> -schema
- }
- if isInf {
- key++
- }
- switch {
- case v > zeroThreshold:
- bucketCreated = addToBucket(&hc.nativeHistogramBucketsPositive, key, 1)
- case v < -zeroThreshold:
- bucketCreated = addToBucket(&hc.nativeHistogramBucketsNegative, key, 1)
- default:
- atomic.AddUint64(&hc.nativeHistogramZeroBucket, 1)
- }
- if bucketCreated {
- atomic.AddUint32(&hc.nativeHistogramBucketsNumber, 1)
- }
- }
- // Increment count last as we take it as a signal that the observation
- // is complete.
- atomic.AddUint64(&hc.count, 1)
-}
-
-type histogram struct {
- // countAndHotIdx enables lock-free writes with use of atomic updates.
- // The most significant bit is the hot index [0 or 1] of the count field
- // below. Observe calls update the hot one. All remaining bits count the
- // number of Observe calls. Observe starts by incrementing this counter,
- // and finish by incrementing the count field in the respective
- // histogramCounts, as a marker for completion.
- //
- // Calls of the Write method (which are non-mutating reads from the
- // perspective of the histogram) swap the hot–cold under the writeMtx
- // lock. A cooldown is awaited (while locked) by comparing the number of
- // observations with the initiation count. Once they match, then the
- // last observation on the now cool one has completed. All cold fields must
- // be merged into the new hot before releasing writeMtx.
- //
- // Fields with atomic access first! See alignment constraint:
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- countAndHotIdx uint64
-
- selfCollector
- desc *Desc
-
- // Only used in the Write method and for sparse bucket management.
- mtx sync.Mutex
-
- // Two counts, one is "hot" for lock-free observations, the other is
- // "cold" for writing out a dto.Metric. It has to be an array of
- // pointers to guarantee 64bit alignment of the histogramCounts, see
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
- counts [2]*histogramCounts
-
- upperBounds []float64
- labelPairs []*dto.LabelPair
- exemplars []atomic.Value // One more than buckets (to include +Inf), each a *dto.Exemplar.
- nativeHistogramSchema int32 // The initial schema. Set to math.MinInt32 if no sparse buckets are used.
- nativeHistogramZeroThreshold float64 // The initial zero threshold.
- nativeHistogramMaxZeroThreshold float64
- nativeHistogramMaxBuckets uint32
- nativeHistogramMinResetDuration time.Duration
- // lastResetTime is protected by mtx. It is also used as created timestamp.
- lastResetTime time.Time
- // resetScheduled is protected by mtx. It is true if a reset is
- // scheduled for a later time (when nativeHistogramMinResetDuration has
- // passed).
- resetScheduled bool
-
- // now is for testing purposes, by default it's time.Now.
- now func() time.Time
-
- // afterFunc is for testing purposes, by default it's time.AfterFunc.
- afterFunc func(time.Duration, func()) *time.Timer
-}
-
-func (h *histogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *histogram) Observe(v float64) {
- h.observe(v, h.findBucket(v))
-}
-
-func (h *histogram) ObserveWithExemplar(v float64, e Labels) {
- i := h.findBucket(v)
- h.observe(v, i)
- h.updateExemplar(v, i, e)
-}
-
-func (h *histogram) Write(out *dto.Metric) error {
- // For simplicity, we protect this whole method by a mutex. It is not in
- // the hot path, i.e. Observe is called much more often than Write. The
- // complication of making Write lock-free isn't worth it, if possible at
- // all.
- h.mtx.Lock()
- defer h.mtx.Unlock()
-
- // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
- // without touching the count bits. See the struct comments for a full
- // description of the algorithm.
- n := atomic.AddUint64(&h.countAndHotIdx, 1<<63)
- // count is contained unchanged in the lower 63 bits.
- count := n & ((1 << 63) - 1)
- // The most significant bit tells us which counts is hot. The complement
- // is thus the cold one.
- hotCounts := h.counts[n>>63]
- coldCounts := h.counts[(^n)>>63]
-
- waitForCooldown(count, coldCounts)
-
- his := &dto.Histogram{
- Bucket: make([]*dto.Bucket, len(h.upperBounds)),
- SampleCount: proto.Uint64(count),
- SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
- CreatedTimestamp: timestamppb.New(h.lastResetTime),
- }
- out.Histogram = his
- out.Label = h.labelPairs
-
- var cumCount uint64
- for i, upperBound := range h.upperBounds {
- cumCount += atomic.LoadUint64(&coldCounts.buckets[i])
- his.Bucket[i] = &dto.Bucket{
- CumulativeCount: proto.Uint64(cumCount),
- UpperBound: proto.Float64(upperBound),
- }
- if e := h.exemplars[i].Load(); e != nil {
- his.Bucket[i].Exemplar = e.(*dto.Exemplar)
- }
- }
- // If there is an exemplar for the +Inf bucket, we have to add that bucket explicitly.
- if e := h.exemplars[len(h.upperBounds)].Load(); e != nil {
- b := &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(math.Inf(1)),
- Exemplar: e.(*dto.Exemplar),
- }
- his.Bucket = append(his.Bucket, b)
- }
- if h.nativeHistogramSchema > math.MinInt32 {
- his.ZeroThreshold = proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.nativeHistogramZeroThresholdBits)))
- his.Schema = proto.Int32(atomic.LoadInt32(&coldCounts.nativeHistogramSchema))
- zeroBucket := atomic.LoadUint64(&coldCounts.nativeHistogramZeroBucket)
-
- defer func() {
- coldCounts.nativeHistogramBucketsPositive.Range(addAndReset(&hotCounts.nativeHistogramBucketsPositive, &hotCounts.nativeHistogramBucketsNumber))
- coldCounts.nativeHistogramBucketsNegative.Range(addAndReset(&hotCounts.nativeHistogramBucketsNegative, &hotCounts.nativeHistogramBucketsNumber))
- }()
-
- his.ZeroCount = proto.Uint64(zeroBucket)
- his.NegativeSpan, his.NegativeDelta = makeBuckets(&coldCounts.nativeHistogramBucketsNegative)
- his.PositiveSpan, his.PositiveDelta = makeBuckets(&coldCounts.nativeHistogramBucketsPositive)
-
- // Add a no-op span to a histogram without observations and with
- // a zero threshold of zero. Otherwise, a native histogram would
- // look like a classic histogram to scrapers.
- if *his.ZeroThreshold == 0 && *his.ZeroCount == 0 && len(his.PositiveSpan) == 0 && len(his.NegativeSpan) == 0 {
- his.PositiveSpan = []*dto.BucketSpan{{
- Offset: proto.Int32(0),
- Length: proto.Uint32(0),
- }}
- }
- }
- addAndResetCounts(hotCounts, coldCounts)
- return nil
-}
-
-// findBucket returns the index of the bucket for the provided value, or
-// len(h.upperBounds) for the +Inf bucket.
-func (h *histogram) findBucket(v float64) int {
- // TODO(beorn7): For small numbers of buckets (<30), a linear search is
- // slightly faster than the binary search. If we really care, we could
- // switch from one search strategy to the other depending on the number
- // of buckets.
- //
- // Microbenchmarks (BenchmarkHistogramNoLabels):
- // 11 buckets: 38.3 ns/op linear - binary 48.7 ns/op
- // 100 buckets: 78.1 ns/op linear - binary 54.9 ns/op
- // 300 buckets: 154 ns/op linear - binary 61.6 ns/op
- return sort.SearchFloat64s(h.upperBounds, v)
-}
-
-// observe is the implementation for Observe without the findBucket part.
-func (h *histogram) observe(v float64, bucket int) {
- // Do not add to sparse buckets for NaN observations.
- doSparse := h.nativeHistogramSchema > math.MinInt32 && !math.IsNaN(v)
- // We increment h.countAndHotIdx so that the counter in the lower
- // 63 bits gets incremented. At the same time, we get the new value
- // back, which we can use to find the currently-hot counts.
- n := atomic.AddUint64(&h.countAndHotIdx, 1)
- hotCounts := h.counts[n>>63]
- hotCounts.observe(v, bucket, doSparse)
- if doSparse {
- h.limitBuckets(hotCounts, v, bucket)
- }
-}
-
-// limitBuckets applies a strategy to limit the number of populated sparse
-// buckets. It's generally best effort, and there are situations where the
-// number can go higher (if even the lowest resolution isn't enough to reduce
-// the number sufficiently, or if the provided counts aren't fully updated yet
-// by a concurrently happening Write call).
-func (h *histogram) limitBuckets(counts *histogramCounts, value float64, bucket int) {
- if h.nativeHistogramMaxBuckets == 0 {
- return // No limit configured.
- }
- if h.nativeHistogramMaxBuckets >= atomic.LoadUint32(&counts.nativeHistogramBucketsNumber) {
- return // Bucket limit not exceeded yet.
- }
-
- h.mtx.Lock()
- defer h.mtx.Unlock()
-
- // The hot counts might have been swapped just before we acquired the
- // lock. Re-fetch the hot counts first...
- n := atomic.LoadUint64(&h.countAndHotIdx)
- hotIdx := n >> 63
- coldIdx := (^n) >> 63
- hotCounts := h.counts[hotIdx]
- coldCounts := h.counts[coldIdx]
- // ...and then check again if we really have to reduce the bucket count.
- if h.nativeHistogramMaxBuckets >= atomic.LoadUint32(&hotCounts.nativeHistogramBucketsNumber) {
- return // Bucket limit not exceeded after all.
- }
- // Try the various strategies in order.
- if h.maybeReset(hotCounts, coldCounts, coldIdx, value, bucket) {
- return
- }
- // One of the other strategies will happen. To undo what they will do as
- // soon as enough time has passed to satisfy
- // h.nativeHistogramMinResetDuration, schedule a reset at the right time
- // if we haven't done so already.
- if h.nativeHistogramMinResetDuration > 0 && !h.resetScheduled {
- h.resetScheduled = true
- h.afterFunc(h.nativeHistogramMinResetDuration-h.now().Sub(h.lastResetTime), h.reset)
- }
-
- if h.maybeWidenZeroBucket(hotCounts, coldCounts) {
- return
- }
- h.doubleBucketWidth(hotCounts, coldCounts)
-}
-
-// maybeReset resets the whole histogram if at least
-// h.nativeHistogramMinResetDuration has been passed. It returns true if the
-// histogram has been reset. The caller must have locked h.mtx.
-func (h *histogram) maybeReset(
- hot, cold *histogramCounts, coldIdx uint64, value float64, bucket int,
-) bool {
- // We are using the possibly mocked h.now() rather than
- // time.Since(h.lastResetTime) to enable testing.
- if h.nativeHistogramMinResetDuration == 0 || // No reset configured.
- h.resetScheduled || // Do not interefere if a reset is already scheduled.
- h.now().Sub(h.lastResetTime) < h.nativeHistogramMinResetDuration {
- return false
- }
- // Completely reset coldCounts.
- h.resetCounts(cold)
- // Repeat the latest observation to not lose it completely.
- cold.observe(value, bucket, true)
- // Make coldCounts the new hot counts while resetting countAndHotIdx.
- n := atomic.SwapUint64(&h.countAndHotIdx, (coldIdx<<63)+1)
- count := n & ((1 << 63) - 1)
- waitForCooldown(count, hot)
- // Finally, reset the formerly hot counts, too.
- h.resetCounts(hot)
- h.lastResetTime = h.now()
- return true
-}
-
-// reset resets the whole histogram. It locks h.mtx itself, i.e. it has to be
-// called without having locked h.mtx.
-func (h *histogram) reset() {
- h.mtx.Lock()
- defer h.mtx.Unlock()
-
- n := atomic.LoadUint64(&h.countAndHotIdx)
- hotIdx := n >> 63
- coldIdx := (^n) >> 63
- hot := h.counts[hotIdx]
- cold := h.counts[coldIdx]
- // Completely reset coldCounts.
- h.resetCounts(cold)
- // Make coldCounts the new hot counts while resetting countAndHotIdx.
- n = atomic.SwapUint64(&h.countAndHotIdx, coldIdx<<63)
- count := n & ((1 << 63) - 1)
- waitForCooldown(count, hot)
- // Finally, reset the formerly hot counts, too.
- h.resetCounts(hot)
- h.lastResetTime = h.now()
- h.resetScheduled = false
-}
-
-// maybeWidenZeroBucket widens the zero bucket until it includes the existing
-// buckets closest to the zero bucket (which could be two, if an equidistant
-// negative and a positive bucket exists, but usually it's only one bucket to be
-// merged into the new wider zero bucket). h.nativeHistogramMaxZeroThreshold
-// limits how far the zero bucket can be extended, and if that's not enough to
-// include an existing bucket, the method returns false. The caller must have
-// locked h.mtx.
-func (h *histogram) maybeWidenZeroBucket(hot, cold *histogramCounts) bool {
- currentZeroThreshold := math.Float64frombits(atomic.LoadUint64(&hot.nativeHistogramZeroThresholdBits))
- if currentZeroThreshold >= h.nativeHistogramMaxZeroThreshold {
- return false
- }
- // Find the key of the bucket closest to zero.
- smallestKey := findSmallestKey(&hot.nativeHistogramBucketsPositive)
- smallestNegativeKey := findSmallestKey(&hot.nativeHistogramBucketsNegative)
- if smallestNegativeKey < smallestKey {
- smallestKey = smallestNegativeKey
- }
- if smallestKey == math.MaxInt32 {
- return false
- }
- newZeroThreshold := getLe(smallestKey, atomic.LoadInt32(&hot.nativeHistogramSchema))
- if newZeroThreshold > h.nativeHistogramMaxZeroThreshold {
- return false // New threshold would exceed the max threshold.
- }
- atomic.StoreUint64(&cold.nativeHistogramZeroThresholdBits, math.Float64bits(newZeroThreshold))
- // Remove applicable buckets.
- if _, loaded := cold.nativeHistogramBucketsNegative.LoadAndDelete(smallestKey); loaded {
- atomicDecUint32(&cold.nativeHistogramBucketsNumber)
- }
- if _, loaded := cold.nativeHistogramBucketsPositive.LoadAndDelete(smallestKey); loaded {
- atomicDecUint32(&cold.nativeHistogramBucketsNumber)
- }
- // Make cold counts the new hot counts.
- n := atomic.AddUint64(&h.countAndHotIdx, 1<<63)
- count := n & ((1 << 63) - 1)
- // Swap the pointer names to represent the new roles and make
- // the rest less confusing.
- hot, cold = cold, hot
- waitForCooldown(count, cold)
- // Add all the now cold counts to the new hot counts...
- addAndResetCounts(hot, cold)
- // ...adjust the new zero threshold in the cold counts, too...
- atomic.StoreUint64(&cold.nativeHistogramZeroThresholdBits, math.Float64bits(newZeroThreshold))
- // ...and then merge the newly deleted buckets into the wider zero
- // bucket.
- mergeAndDeleteOrAddAndReset := func(hotBuckets, coldBuckets *sync.Map) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
- key := k.(int)
- bucket := v.(*int64)
- if key == smallestKey {
- // Merge into hot zero bucket...
- atomic.AddUint64(&hot.nativeHistogramZeroBucket, uint64(atomic.LoadInt64(bucket)))
- // ...and delete from cold counts.
- coldBuckets.Delete(key)
- atomicDecUint32(&cold.nativeHistogramBucketsNumber)
- } else {
- // Add to corresponding hot bucket...
- if addToBucket(hotBuckets, key, atomic.LoadInt64(bucket)) {
- atomic.AddUint32(&hot.nativeHistogramBucketsNumber, 1)
- }
- // ...and reset cold bucket.
- atomic.StoreInt64(bucket, 0)
- }
- return true
- }
- }
-
- cold.nativeHistogramBucketsPositive.Range(mergeAndDeleteOrAddAndReset(&hot.nativeHistogramBucketsPositive, &cold.nativeHistogramBucketsPositive))
- cold.nativeHistogramBucketsNegative.Range(mergeAndDeleteOrAddAndReset(&hot.nativeHistogramBucketsNegative, &cold.nativeHistogramBucketsNegative))
- return true
-}
-
-// doubleBucketWidth doubles the bucket width (by decrementing the schema
-// number). Note that very sparse buckets could lead to a low reduction of the
-// bucket count (or even no reduction at all). The method does nothing if the
-// schema is already -4.
-func (h *histogram) doubleBucketWidth(hot, cold *histogramCounts) {
- coldSchema := atomic.LoadInt32(&cold.nativeHistogramSchema)
- if coldSchema == -4 {
- return // Already at lowest resolution.
- }
- coldSchema--
- atomic.StoreInt32(&cold.nativeHistogramSchema, coldSchema)
- // Play it simple and just delete all cold buckets.
- atomic.StoreUint32(&cold.nativeHistogramBucketsNumber, 0)
- deleteSyncMap(&cold.nativeHistogramBucketsNegative)
- deleteSyncMap(&cold.nativeHistogramBucketsPositive)
- // Make coldCounts the new hot counts.
- n := atomic.AddUint64(&h.countAndHotIdx, 1<<63)
- count := n & ((1 << 63) - 1)
- // Swap the pointer names to represent the new roles and make
- // the rest less confusing.
- hot, cold = cold, hot
- waitForCooldown(count, cold)
- // Add all the now cold counts to the new hot counts...
- addAndResetCounts(hot, cold)
- // ...adjust the schema in the cold counts, too...
- atomic.StoreInt32(&cold.nativeHistogramSchema, coldSchema)
- // ...and then merge the cold buckets into the wider hot buckets.
- merge := func(hotBuckets *sync.Map) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
- key := k.(int)
- bucket := v.(*int64)
- // Adjust key to match the bucket to merge into.
- if key > 0 {
- key++
- }
- key /= 2
- // Add to corresponding hot bucket.
- if addToBucket(hotBuckets, key, atomic.LoadInt64(bucket)) {
- atomic.AddUint32(&hot.nativeHistogramBucketsNumber, 1)
- }
- return true
- }
- }
-
- cold.nativeHistogramBucketsPositive.Range(merge(&hot.nativeHistogramBucketsPositive))
- cold.nativeHistogramBucketsNegative.Range(merge(&hot.nativeHistogramBucketsNegative))
- // Play it simple again and just delete all cold buckets.
- atomic.StoreUint32(&cold.nativeHistogramBucketsNumber, 0)
- deleteSyncMap(&cold.nativeHistogramBucketsNegative)
- deleteSyncMap(&cold.nativeHistogramBucketsPositive)
-}
-
-func (h *histogram) resetCounts(counts *histogramCounts) {
- atomic.StoreUint64(&counts.sumBits, 0)
- atomic.StoreUint64(&counts.count, 0)
- atomic.StoreUint64(&counts.nativeHistogramZeroBucket, 0)
- atomic.StoreUint64(&counts.nativeHistogramZeroThresholdBits, math.Float64bits(h.nativeHistogramZeroThreshold))
- atomic.StoreInt32(&counts.nativeHistogramSchema, h.nativeHistogramSchema)
- atomic.StoreUint32(&counts.nativeHistogramBucketsNumber, 0)
- for i := range h.upperBounds {
- atomic.StoreUint64(&counts.buckets[i], 0)
- }
- deleteSyncMap(&counts.nativeHistogramBucketsNegative)
- deleteSyncMap(&counts.nativeHistogramBucketsPositive)
-}
-
-// updateExemplar replaces the exemplar for the provided bucket. With empty
-// labels, it's a no-op. It panics if any of the labels is invalid.
-func (h *histogram) updateExemplar(v float64, bucket int, l Labels) {
- if l == nil {
- return
- }
- e, err := newExemplar(v, h.now(), l)
- if err != nil {
- panic(err)
- }
- h.exemplars[bucket].Store(e)
-}
-
-// HistogramVec is a Collector that bundles a set of Histograms that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewHistogramVec.
-type HistogramVec struct {
- *MetricVec
-}
-
-// NewHistogramVec creates a new HistogramVec based on the provided HistogramOpts and
-// partitioned by the given label names.
-func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec {
- return V2.NewHistogramVec(HistogramVecOpts{
- HistogramOpts: opts,
- VariableLabels: UnconstrainedLabels(labelNames),
- })
-}
-
-// NewHistogramVec creates a new HistogramVec based on the provided HistogramVecOpts.
-func (v2) NewHistogramVec(opts HistogramVecOpts) *HistogramVec {
- desc := V2.NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- opts.VariableLabels,
- opts.ConstLabels,
- )
- return &HistogramVec{
- MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
- return newHistogram(desc, opts.HistogramOpts, lvs...)
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Histogram for the given slice of label
-// values (same order as the variable labels in Desc). If that combination of
-// label values is accessed for the first time, a new Histogram is created.
-//
-// It is possible to call this method without using the returned Histogram to only
-// create the new Histogram but leave it at its starting value, a Histogram without
-// any observations.
-//
-// Keeping the Histogram for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Histogram from the HistogramVec. In that case, the
-// Histogram will still exist, but it will not be exported anymore, even if a
-// Histogram with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of variable labels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) {
- metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Histogram for the given Labels map (the label names
-// must match those of the variable labels in Desc). If that label map is
-// accessed for the first time, a new Histogram is created. Implications of
-// creating a Histogram without using it and keeping the Histogram for later use
-// are the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the variable labels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) {
- metric, err := v.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-//
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (v *HistogramVec) WithLabelValues(lvs ...string) Observer {
- h, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return h
-}
-
-// With works as GetMetricWith but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-//
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (v *HistogramVec) With(labels Labels) Observer {
- h, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return h
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the HistogramVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) {
- vec, err := v.MetricVec.CurryWith(labels)
- if vec != nil {
- return &HistogramVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *HistogramVec) MustCurryWith(labels Labels) ObserverVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-type constHistogram struct {
- desc *Desc
- count uint64
- sum float64
- buckets map[float64]uint64
- labelPairs []*dto.LabelPair
- createdTs *timestamppb.Timestamp
-}
-
-func (h *constHistogram) Desc() *Desc {
- return h.desc
-}
-
-func (h *constHistogram) Write(out *dto.Metric) error {
- his := &dto.Histogram{
- CreatedTimestamp: h.createdTs,
- }
-
- buckets := make([]*dto.Bucket, 0, len(h.buckets))
-
- his.SampleCount = proto.Uint64(h.count)
- his.SampleSum = proto.Float64(h.sum)
- for upperBound, count := range h.buckets {
- buckets = append(buckets, &dto.Bucket{
- CumulativeCount: proto.Uint64(count),
- UpperBound: proto.Float64(upperBound),
- })
- }
-
- if len(buckets) > 0 {
- sort.Sort(buckSort(buckets))
- }
- his.Bucket = buckets
-
- out.Histogram = his
- out.Label = h.labelPairs
-
- return nil
-}
-
-// NewConstHistogram returns a metric representing a Prometheus histogram with
-// fixed values for the count, sum, and bucket counts. As those parameters
-// cannot be changed, the returned value does not implement the Histogram
-// interface (but only the Metric interface). Users of this package will not
-// have much use for it in regular operations. However, when implementing custom
-// Collectors, it is useful as a throw-away metric that is generated on the fly
-// to send it to Prometheus in the Collect method.
-//
-// buckets is a map of upper bounds to cumulative counts, excluding the +Inf
-// bucket. The +Inf bucket is implicit, and its value is equal to the provided count.
-//
-// NewConstHistogram returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc or if Desc is invalid.
-func NewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil {
- return nil, err
- }
- return &constHistogram{
- desc: desc,
- count: count,
- sum: sum,
- buckets: buckets,
- labelPairs: MakeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstHistogram is a version of NewConstHistogram that panics where
-// NewConstHistogram would have returned an error.
-func MustNewConstHistogram(
- desc *Desc,
- count uint64,
- sum float64,
- buckets map[float64]uint64,
- labelValues ...string,
-) Metric {
- m, err := NewConstHistogram(desc, count, sum, buckets, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type buckSort []*dto.Bucket
-
-func (s buckSort) Len() int {
- return len(s)
-}
-
-func (s buckSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s buckSort) Less(i, j int) bool {
- return s[i].GetUpperBound() < s[j].GetUpperBound()
-}
-
-// pickSchema returns the largest number n between -4 and 8 such that
-// 2^(2^-n) is less or equal the provided bucketFactor.
-//
-// Special cases:
-// - bucketFactor <= 1: panics.
-// - bucketFactor < 2^(2^-8) (but > 1): still returns 8.
-func pickSchema(bucketFactor float64) int32 {
- if bucketFactor <= 1 {
- panic(fmt.Errorf("bucketFactor %f is <=1", bucketFactor))
- }
- floor := math.Floor(math.Log2(math.Log2(bucketFactor)))
- switch {
- case floor <= -8:
- return 8
- case floor >= 4:
- return -4
- default:
- return -int32(floor)
- }
-}
-
-func makeBuckets(buckets *sync.Map) ([]*dto.BucketSpan, []int64) {
- var ii []int
- buckets.Range(func(k, v interface{}) bool {
- ii = append(ii, k.(int))
- return true
- })
- sort.Ints(ii)
-
- if len(ii) == 0 {
- return nil, nil
- }
-
- var (
- spans []*dto.BucketSpan
- deltas []int64
- prevCount int64
- nextI int
- )
-
- appendDelta := func(count int64) {
- *spans[len(spans)-1].Length++
- deltas = append(deltas, count-prevCount)
- prevCount = count
- }
-
- for n, i := range ii {
- v, _ := buckets.Load(i)
- count := atomic.LoadInt64(v.(*int64))
- // Multiple spans with only small gaps in between are probably
- // encoded more efficiently as one larger span with a few empty
- // buckets. Needs some research to find the sweet spot. For now,
- // we assume that gaps of one or two buckets should not create
- // a new span.
- iDelta := int32(i - nextI)
- if n == 0 || iDelta > 2 {
- // We have to create a new span, either because we are
- // at the very beginning, or because we have found a gap
- // of more than two buckets.
- spans = append(spans, &dto.BucketSpan{
- Offset: proto.Int32(iDelta),
- Length: proto.Uint32(0),
- })
- } else {
- // We have found a small gap (or no gap at all).
- // Insert empty buckets as needed.
- for j := int32(0); j < iDelta; j++ {
- appendDelta(0)
- }
- }
- appendDelta(count)
- nextI = i + 1
- }
- return spans, deltas
-}
-
-// addToBucket increments the sparse bucket at key by the provided amount. It
-// returns true if a new sparse bucket had to be created for that.
-func addToBucket(buckets *sync.Map, key int, increment int64) bool {
- if existingBucket, ok := buckets.Load(key); ok {
- // Fast path without allocation.
- atomic.AddInt64(existingBucket.(*int64), increment)
- return false
- }
- // Bucket doesn't exist yet. Slow path allocating new counter.
- newBucket := increment // TODO(beorn7): Check if this is sufficient to not let increment escape.
- if actualBucket, loaded := buckets.LoadOrStore(key, &newBucket); loaded {
- // The bucket was created concurrently in another goroutine.
- // Have to increment after all.
- atomic.AddInt64(actualBucket.(*int64), increment)
- return false
- }
- return true
-}
-
-// addAndReset returns a function to be used with sync.Map.Range of spare
-// buckets in coldCounts. It increments the buckets in the provided hotBuckets
-// according to the buckets ranged through. It then resets all buckets ranged
-// through to 0 (but leaves them in place so that they don't need to get
-// recreated on the next scrape).
-func addAndReset(hotBuckets *sync.Map, bucketNumber *uint32) func(k, v interface{}) bool {
- return func(k, v interface{}) bool {
- bucket := v.(*int64)
- if addToBucket(hotBuckets, k.(int), atomic.LoadInt64(bucket)) {
- atomic.AddUint32(bucketNumber, 1)
- }
- atomic.StoreInt64(bucket, 0)
- return true
- }
-}
-
-func deleteSyncMap(m *sync.Map) {
- m.Range(func(k, v interface{}) bool {
- m.Delete(k)
- return true
- })
-}
-
-func findSmallestKey(m *sync.Map) int {
- result := math.MaxInt32
- m.Range(func(k, v interface{}) bool {
- key := k.(int)
- if key < result {
- result = key
- }
- return true
- })
- return result
-}
-
-func getLe(key int, schema int32) float64 {
- // Here a bit of context about the behavior for the last bucket counting
- // regular numbers (called simply "last bucket" below) and the bucket
- // counting observations of ±Inf (called "inf bucket" below, with a key
- // one higher than that of the "last bucket"):
- //
- // If we apply the usual formula to the last bucket, its upper bound
- // would be calculated as +Inf. The reason is that the max possible
- // regular float64 number (math.MaxFloat64) doesn't coincide with one of
- // the calculated bucket boundaries. So the calculated boundary has to
- // be larger than math.MaxFloat64, and the only float64 larger than
- // math.MaxFloat64 is +Inf. However, we want to count actual
- // observations of ±Inf in the inf bucket. Therefore, we have to treat
- // the upper bound of the last bucket specially and set it to
- // math.MaxFloat64. (The upper bound of the inf bucket, with its key
- // being one higher than that of the last bucket, naturally comes out as
- // +Inf by the usual formula. So that's fine.)
- //
- // math.MaxFloat64 has a frac of 0.9999999999999999 and an exp of
- // 1024. If there were a float64 number following math.MaxFloat64, it
- // would have a frac of 1.0 and an exp of 1024, or equivalently a frac
- // of 0.5 and an exp of 1025. However, since frac must be smaller than
- // 1, and exp must be smaller than 1025, either representation overflows
- // a float64. (Which, in turn, is the reason that math.MaxFloat64 is the
- // largest possible float64. Q.E.D.) However, the formula for
- // calculating the upper bound from the idx and schema of the last
- // bucket results in precisely that. It is either frac=1.0 & exp=1024
- // (for schema < 0) or frac=0.5 & exp=1025 (for schema >=0). (This is,
- // by the way, a power of two where the exponent itself is a power of
- // two, 2¹⁰ in fact, which coinicides with a bucket boundary in all
- // schemas.) So these are the special cases we have to catch below.
- if schema < 0 {
- exp := key << -schema
- if exp == 1024 {
- // This is the last bucket before the overflow bucket
- // (for ±Inf observations). Return math.MaxFloat64 as
- // explained above.
- return math.MaxFloat64
- }
- return math.Ldexp(1, exp)
- }
-
- fracIdx := key & ((1 << schema) - 1)
- frac := nativeHistogramBounds[schema][fracIdx]
- exp := (key >> schema) + 1
- if frac == 0.5 && exp == 1025 {
- // This is the last bucket before the overflow bucket (for ±Inf
- // observations). Return math.MaxFloat64 as explained above.
- return math.MaxFloat64
- }
- return math.Ldexp(frac, exp)
-}
-
-// waitForCooldown returns after the count field in the provided histogramCounts
-// has reached the provided count value.
-func waitForCooldown(count uint64, counts *histogramCounts) {
- for count != atomic.LoadUint64(&counts.count) {
- runtime.Gosched() // Let observations get work done.
- }
-}
-
-// atomicAddFloat adds the provided float atomically to another float
-// represented by the bit pattern the bits pointer is pointing to.
-func atomicAddFloat(bits *uint64, v float64) {
- for {
- loadedBits := atomic.LoadUint64(bits)
- newBits := math.Float64bits(math.Float64frombits(loadedBits) + v)
- if atomic.CompareAndSwapUint64(bits, loadedBits, newBits) {
- break
- }
- }
-}
-
-// atomicDecUint32 atomically decrements the uint32 p points to. See
-// https://pkg.go.dev/sync/atomic#AddUint32 to understand how this is done.
-func atomicDecUint32(p *uint32) {
- atomic.AddUint32(p, ^uint32(0))
-}
-
-// addAndResetCounts adds certain fields (count, sum, conventional buckets, zero
-// bucket) from the cold counts to the corresponding fields in the hot
-// counts. Those fields are then reset to 0 in the cold counts.
-func addAndResetCounts(hot, cold *histogramCounts) {
- atomic.AddUint64(&hot.count, atomic.LoadUint64(&cold.count))
- atomic.StoreUint64(&cold.count, 0)
- coldSum := math.Float64frombits(atomic.LoadUint64(&cold.sumBits))
- atomicAddFloat(&hot.sumBits, coldSum)
- atomic.StoreUint64(&cold.sumBits, 0)
- for i := range hot.buckets {
- atomic.AddUint64(&hot.buckets[i], atomic.LoadUint64(&cold.buckets[i]))
- atomic.StoreUint64(&cold.buckets[i], 0)
- }
- atomic.AddUint64(&hot.nativeHistogramZeroBucket, atomic.LoadUint64(&cold.nativeHistogramZeroBucket))
- atomic.StoreUint64(&cold.nativeHistogramZeroBucket, 0)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go
deleted file mode 100644
index 1ed5abe..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/almost_equal.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2015 Björn Rabenstein
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in all
-// copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-// SOFTWARE.
-//
-// The code in this package is copy/paste to avoid a dependency. Hence this file
-// carries the copyright of the original repo.
-// https://github.com/beorn7/floats
-package internal
-
-import (
- "math"
-)
-
-// minNormalFloat64 is the smallest positive normal value of type float64.
-var minNormalFloat64 = math.Float64frombits(0x0010000000000000)
-
-// AlmostEqualFloat64 returns true if a and b are equal within a relative error
-// of epsilon. See http://floating-point-gui.de/errors/comparison/ for the
-// details of the applied method.
-func AlmostEqualFloat64(a, b, epsilon float64) bool {
- if a == b {
- return true
- }
- absA := math.Abs(a)
- absB := math.Abs(b)
- diff := math.Abs(a - b)
- if a == 0 || b == 0 || absA+absB < minNormalFloat64 {
- return diff < epsilon*minNormalFloat64
- }
- return diff/math.Min(absA+absB, math.MaxFloat64) < epsilon
-}
-
-// AlmostEqualFloat64s is the slice form of AlmostEqualFloat64.
-func AlmostEqualFloat64s(a, b []float64, epsilon float64) bool {
- if len(a) != len(b) {
- return false
- }
- for i := range a {
- if !AlmostEqualFloat64(a[i], b[i], epsilon) {
- return false
- }
- }
- return true
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
deleted file mode 100644
index a595a20..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go
+++ /dev/null
@@ -1,654 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-// It provides tools to compare sequences of strings and generate textual diffs.
-//
-// Maintaining `GetUnifiedDiffString` here because original repository
-// (https://github.com/pmezard/go-difflib) is no longer maintained.
-package internal
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-)
-
-func min(a, b int) int {
- if a < b {
- return a
- }
- return b
-}
-
-func max(a, b int) int {
- if a > b {
- return a
- }
- return b
-}
-
-func calculateRatio(matches, length int) float64 {
- if length > 0 {
- return 2.0 * float64(matches) / float64(length)
- }
- return 1.0
-}
-
-type Match struct {
- A int
- B int
- Size int
-}
-
-type OpCode struct {
- Tag byte
- I1 int
- I2 int
- J1 int
- J2 int
-}
-
-// SequenceMatcher compares sequence of strings. The basic
-// algorithm predates, and is a little fancier than, an algorithm
-// published in the late 1980's by Ratcliff and Obershelp under the
-// hyperbolic name "gestalt pattern matching". The basic idea is to find
-// the longest contiguous matching subsequence that contains no "junk"
-// elements (R-O doesn't address junk). The same idea is then applied
-// recursively to the pieces of the sequences to the left and to the right
-// of the matching subsequence. This does not yield minimal edit
-// sequences, but does tend to yield matches that "look right" to people.
-//
-// SequenceMatcher tries to compute a "human-friendly diff" between two
-// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the
-// longest *contiguous* & junk-free matching subsequence. That's what
-// catches peoples' eyes. The Windows(tm) windiff has another interesting
-// notion, pairing up elements that appear uniquely in each sequence.
-// That, and the method here, appear to yield more intuitive difference
-// reports than does diff. This method appears to be the least vulnerable
-// to synching up on blocks of "junk lines", though (like blank lines in
-// ordinary text files, or maybe "
" lines in HTML files). That may be
-// because this is the only method of the 3 that has a *concept* of
-// "junk" .
-//
-// Timing: Basic R-O is cubic time worst case and quadratic time expected
-// case. SequenceMatcher is quadratic time for the worst case and has
-// expected-case behavior dependent in a complicated way on how many
-// elements the sequences have in common; best case time is linear.
-type SequenceMatcher struct {
- a []string
- b []string
- b2j map[string][]int
- IsJunk func(string) bool
- autoJunk bool
- bJunk map[string]struct{}
- matchingBlocks []Match
- fullBCount map[string]int
- bPopular map[string]struct{}
- opCodes []OpCode
-}
-
-func NewMatcher(a, b []string) *SequenceMatcher {
- m := SequenceMatcher{autoJunk: true}
- m.SetSeqs(a, b)
- return &m
-}
-
-func NewMatcherWithJunk(a, b []string, autoJunk bool,
- isJunk func(string) bool,
-) *SequenceMatcher {
- m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk}
- m.SetSeqs(a, b)
- return &m
-}
-
-// Set two sequences to be compared.
-func (m *SequenceMatcher) SetSeqs(a, b []string) {
- m.SetSeq1(a)
- m.SetSeq2(b)
-}
-
-// Set the first sequence to be compared. The second sequence to be compared is
-// not changed.
-//
-// SequenceMatcher computes and caches detailed information about the second
-// sequence, so if you want to compare one sequence S against many sequences,
-// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other
-// sequences.
-//
-// See also SetSeqs() and SetSeq2().
-func (m *SequenceMatcher) SetSeq1(a []string) {
- if &a == &m.a {
- return
- }
- m.a = a
- m.matchingBlocks = nil
- m.opCodes = nil
-}
-
-// Set the second sequence to be compared. The first sequence to be compared is
-// not changed.
-func (m *SequenceMatcher) SetSeq2(b []string) {
- if &b == &m.b {
- return
- }
- m.b = b
- m.matchingBlocks = nil
- m.opCodes = nil
- m.fullBCount = nil
- m.chainB()
-}
-
-func (m *SequenceMatcher) chainB() {
- // Populate line -> index mapping
- b2j := map[string][]int{}
- for i, s := range m.b {
- indices := b2j[s]
- indices = append(indices, i)
- b2j[s] = indices
- }
-
- // Purge junk elements
- m.bJunk = map[string]struct{}{}
- if m.IsJunk != nil {
- junk := m.bJunk
- for s := range b2j {
- if m.IsJunk(s) {
- junk[s] = struct{}{}
- }
- }
- for s := range junk {
- delete(b2j, s)
- }
- }
-
- // Purge remaining popular elements
- popular := map[string]struct{}{}
- n := len(m.b)
- if m.autoJunk && n >= 200 {
- ntest := n/100 + 1
- for s, indices := range b2j {
- if len(indices) > ntest {
- popular[s] = struct{}{}
- }
- }
- for s := range popular {
- delete(b2j, s)
- }
- }
- m.bPopular = popular
- m.b2j = b2j
-}
-
-func (m *SequenceMatcher) isBJunk(s string) bool {
- _, ok := m.bJunk[s]
- return ok
-}
-
-// Find longest matching block in a[alo:ahi] and b[blo:bhi].
-//
-// If IsJunk is not defined:
-//
-// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where
-//
-// alo <= i <= i+k <= ahi
-// blo <= j <= j+k <= bhi
-//
-// and for all (i',j',k') meeting those conditions,
-//
-// k >= k'
-// i <= i'
-// and if i == i', j <= j'
-//
-// In other words, of all maximal matching blocks, return one that
-// starts earliest in a, and of all those maximal matching blocks that
-// start earliest in a, return the one that starts earliest in b.
-//
-// If IsJunk is defined, first the longest matching block is
-// determined as above, but with the additional restriction that no
-// junk element appears in the block. Then that block is extended as
-// far as possible by matching (only) junk elements on both sides. So
-// the resulting block never matches on junk except as identical junk
-// happens to be adjacent to an "interesting" match.
-//
-// If no blocks match, return (alo, blo, 0).
-func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match {
- // CAUTION: stripping common prefix or suffix would be incorrect.
- // E.g.,
- // ab
- // acab
- // Longest matching block is "ab", but if common prefix is
- // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so
- // strip, so ends up claiming that ab is changed to acab by
- // inserting "ca" in the middle. That's minimal but unintuitive:
- // "it's obvious" that someone inserted "ac" at the front.
- // Windiff ends up at the same place as diff, but by pairing up
- // the unique 'b's and then matching the first two 'a's.
- besti, bestj, bestsize := alo, blo, 0
-
- // find longest junk-free match
- // during an iteration of the loop, j2len[j] = length of longest
- // junk-free match ending with a[i-1] and b[j]
- j2len := map[int]int{}
- for i := alo; i != ahi; i++ {
- // look at all instances of a[i] in b; note that because
- // b2j has no junk keys, the loop is skipped if a[i] is junk
- newj2len := map[int]int{}
- for _, j := range m.b2j[m.a[i]] {
- // a[i] matches b[j]
- if j < blo {
- continue
- }
- if j >= bhi {
- break
- }
- k := j2len[j-1] + 1
- newj2len[j] = k
- if k > bestsize {
- besti, bestj, bestsize = i-k+1, j-k+1, k
- }
- }
- j2len = newj2len
- }
-
- // Extend the best by non-junk elements on each end. In particular,
- // "popular" non-junk elements aren't in b2j, which greatly speeds
- // the inner loop above, but also means "the best" match so far
- // doesn't contain any junk *or* popular non-junk elements.
- for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- !m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize++
- }
-
- // Now that we have a wholly interesting match (albeit possibly
- // empty!), we may as well suck up the matching junk on each
- // side of it too. Can't think of a good reason not to, and it
- // saves post-processing the (possibly considerable) expense of
- // figuring out what to do with it. In the case of an empty
- // interesting match, this is clearly the right thing to do,
- // because no other kind of match is possible in the regions.
- for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) &&
- m.a[besti-1] == m.b[bestj-1] {
- besti, bestj, bestsize = besti-1, bestj-1, bestsize+1
- }
- for besti+bestsize < ahi && bestj+bestsize < bhi &&
- m.isBJunk(m.b[bestj+bestsize]) &&
- m.a[besti+bestsize] == m.b[bestj+bestsize] {
- bestsize++
- }
-
- return Match{A: besti, B: bestj, Size: bestsize}
-}
-
-// Return list of triples describing matching subsequences.
-//
-// Each triple is of the form (i, j, n), and means that
-// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in
-// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are
-// adjacent triples in the list, and the second is not the last triple in the
-// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe
-// adjacent equal blocks.
-//
-// The last triple is a dummy, (len(a), len(b), 0), and is the only
-// triple with n==0.
-func (m *SequenceMatcher) GetMatchingBlocks() []Match {
- if m.matchingBlocks != nil {
- return m.matchingBlocks
- }
-
- var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match
- matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match {
- match := m.findLongestMatch(alo, ahi, blo, bhi)
- i, j, k := match.A, match.B, match.Size
- if match.Size > 0 {
- if alo < i && blo < j {
- matched = matchBlocks(alo, i, blo, j, matched)
- }
- matched = append(matched, match)
- if i+k < ahi && j+k < bhi {
- matched = matchBlocks(i+k, ahi, j+k, bhi, matched)
- }
- }
- return matched
- }
- matched := matchBlocks(0, len(m.a), 0, len(m.b), nil)
-
- // It's possible that we have adjacent equal blocks in the
- // matching_blocks list now.
- nonAdjacent := []Match{}
- i1, j1, k1 := 0, 0, 0
- for _, b := range matched {
- // Is this block adjacent to i1, j1, k1?
- i2, j2, k2 := b.A, b.B, b.Size
- if i1+k1 == i2 && j1+k1 == j2 {
- // Yes, so collapse them -- this just increases the length of
- // the first block by the length of the second, and the first
- // block so lengthened remains the block to compare against.
- k1 += k2
- } else {
- // Not adjacent. Remember the first block (k1==0 means it's
- // the dummy we started with), and make the second block the
- // new block to compare against.
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
- i1, j1, k1 = i2, j2, k2
- }
- }
- if k1 > 0 {
- nonAdjacent = append(nonAdjacent, Match{i1, j1, k1})
- }
-
- nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0})
- m.matchingBlocks = nonAdjacent
- return m.matchingBlocks
-}
-
-// Return list of 5-tuples describing how to turn a into b.
-//
-// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple
-// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the
-// tuple preceding it, and likewise for j1 == the previous j2.
-//
-// The tags are characters, with these meanings:
-//
-// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2]
-//
-// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case.
-//
-// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case.
-//
-// 'e' (equal): a[i1:i2] == b[j1:j2]
-func (m *SequenceMatcher) GetOpCodes() []OpCode {
- if m.opCodes != nil {
- return m.opCodes
- }
- i, j := 0, 0
- matching := m.GetMatchingBlocks()
- opCodes := make([]OpCode, 0, len(matching))
- for _, m := range matching {
- // invariant: we've pumped out correct diffs to change
- // a[:i] into b[:j], and the next matching block is
- // a[ai:ai+size] == b[bj:bj+size]. So we need to pump
- // out a diff to change a[i:ai] into b[j:bj], pump out
- // the matching block, and move (i,j) beyond the match
- ai, bj, size := m.A, m.B, m.Size
- tag := byte(0)
- if i < ai && j < bj {
- tag = 'r'
- } else if i < ai {
- tag = 'd'
- } else if j < bj {
- tag = 'i'
- }
- if tag > 0 {
- opCodes = append(opCodes, OpCode{tag, i, ai, j, bj})
- }
- i, j = ai+size, bj+size
- // the list of matching blocks is terminated by a
- // sentinel with size 0
- if size > 0 {
- opCodes = append(opCodes, OpCode{'e', ai, i, bj, j})
- }
- }
- m.opCodes = opCodes
- return m.opCodes
-}
-
-// Isolate change clusters by eliminating ranges with no changes.
-//
-// Return a generator of groups with up to n lines of context.
-// Each group is in the same format as returned by GetOpCodes().
-func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode {
- if n < 0 {
- n = 3
- }
- codes := m.GetOpCodes()
- if len(codes) == 0 {
- codes = []OpCode{{'e', 0, 1, 0, 1}}
- }
- // Fixup leading and trailing groups if they show no changes.
- if codes[0].Tag == 'e' {
- c := codes[0]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2}
- }
- if codes[len(codes)-1].Tag == 'e' {
- c := codes[len(codes)-1]
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)}
- }
- nn := n + n
- groups := [][]OpCode{}
- group := []OpCode{}
- for _, c := range codes {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- // End the current group and start a new one whenever
- // there is a large range with no changes.
- if c.Tag == 'e' && i2-i1 > nn {
- group = append(group, OpCode{
- c.Tag, i1, min(i2, i1+n),
- j1, min(j2, j1+n),
- })
- groups = append(groups, group)
- group = []OpCode{}
- i1, j1 = max(i1, i2-n), max(j1, j2-n)
- }
- group = append(group, OpCode{c.Tag, i1, i2, j1, j2})
- }
- if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') {
- groups = append(groups, group)
- }
- return groups
-}
-
-// Return a measure of the sequences' similarity (float in [0,1]).
-//
-// Where T is the total number of elements in both sequences, and
-// M is the number of matches, this is 2.0*M / T.
-// Note that this is 1 if the sequences are identical, and 0 if
-// they have nothing in common.
-//
-// .Ratio() is expensive to compute if you haven't already computed
-// .GetMatchingBlocks() or .GetOpCodes(), in which case you may
-// want to try .QuickRatio() or .RealQuickRation() first to get an
-// upper bound.
-func (m *SequenceMatcher) Ratio() float64 {
- matches := 0
- for _, m := range m.GetMatchingBlocks() {
- matches += m.Size
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() relatively quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute.
-func (m *SequenceMatcher) QuickRatio() float64 {
- // viewing a and b as multisets, set matches to the cardinality
- // of their intersection; this counts the number of matches
- // without regard to order, so is clearly an upper bound
- if m.fullBCount == nil {
- m.fullBCount = map[string]int{}
- for _, s := range m.b {
- m.fullBCount[s]++
- }
- }
-
- // avail[x] is the number of times x appears in 'b' less the
- // number of times we've seen it in 'a' so far ... kinda
- avail := map[string]int{}
- matches := 0
- for _, s := range m.a {
- n, ok := avail[s]
- if !ok {
- n = m.fullBCount[s]
- }
- avail[s] = n - 1
- if n > 0 {
- matches++
- }
- }
- return calculateRatio(matches, len(m.a)+len(m.b))
-}
-
-// Return an upper bound on ratio() very quickly.
-//
-// This isn't defined beyond that it is an upper bound on .Ratio(), and
-// is faster to compute than either .Ratio() or .QuickRatio().
-func (m *SequenceMatcher) RealQuickRatio() float64 {
- la, lb := len(m.a), len(m.b)
- return calculateRatio(min(la, lb), la+lb)
-}
-
-// Convert range to the "ed" format
-func formatRangeUnified(start, stop int) string {
- // Per the diff spec at http://www.unix.org/single_unix_specification/
- beginning := start + 1 // lines start numbering with one
- length := stop - start
- if length == 1 {
- return fmt.Sprintf("%d", beginning)
- }
- if length == 0 {
- beginning-- // empty ranges begin at line just before the range
- }
- return fmt.Sprintf("%d,%d", beginning, length)
-}
-
-// Unified diff parameters
-type UnifiedDiff struct {
- A []string // First sequence lines
- FromFile string // First file name
- FromDate string // First file time
- B []string // Second sequence lines
- ToFile string // Second file name
- ToDate string // Second file time
- Eol string // Headers end of line, defaults to LF
- Context int // Number of context lines
-}
-
-// Compare two sequences of lines; generate the delta as a unified diff.
-//
-// Unified diffs are a compact way of showing line changes and a few
-// lines of context. The number of context lines is set by 'n' which
-// defaults to three.
-//
-// By default, the diff control lines (those with ---, +++, or @@) are
-// created with a trailing newline. This is helpful so that inputs
-// created from file.readlines() result in diffs that are suitable for
-// file.writelines() since both the inputs and outputs have trailing
-// newlines.
-//
-// For inputs that do not have trailing newlines, set the lineterm
-// argument to "" so that the output will be uniformly newline free.
-//
-// The unidiff format normally has a header for filenames and modification
-// times. Any or all of these may be specified using strings for
-// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.
-// The modification times are normally expressed in the ISO 8601 format.
-func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error {
- buf := bufio.NewWriter(writer)
- defer buf.Flush()
- wf := func(format string, args ...interface{}) error {
- _, err := buf.WriteString(fmt.Sprintf(format, args...))
- return err
- }
- ws := func(s string) error {
- _, err := buf.WriteString(s)
- return err
- }
-
- if len(diff.Eol) == 0 {
- diff.Eol = "\n"
- }
-
- started := false
- m := NewMatcher(diff.A, diff.B)
- for _, g := range m.GetGroupedOpCodes(diff.Context) {
- if !started {
- started = true
- fromDate := ""
- if len(diff.FromDate) > 0 {
- fromDate = "\t" + diff.FromDate
- }
- toDate := ""
- if len(diff.ToDate) > 0 {
- toDate = "\t" + diff.ToDate
- }
- if diff.FromFile != "" || diff.ToFile != "" {
- err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol)
- if err != nil {
- return err
- }
- err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol)
- if err != nil {
- return err
- }
- }
- }
- first, last := g[0], g[len(g)-1]
- range1 := formatRangeUnified(first.I1, last.I2)
- range2 := formatRangeUnified(first.J1, last.J2)
- if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil {
- return err
- }
- for _, c := range g {
- i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2
- if c.Tag == 'e' {
- for _, line := range diff.A[i1:i2] {
- if err := ws(" " + line); err != nil {
- return err
- }
- }
- continue
- }
- if c.Tag == 'r' || c.Tag == 'd' {
- for _, line := range diff.A[i1:i2] {
- if err := ws("-" + line); err != nil {
- return err
- }
- }
- }
- if c.Tag == 'r' || c.Tag == 'i' {
- for _, line := range diff.B[j1:j2] {
- if err := ws("+" + line); err != nil {
- return err
- }
- }
- }
- }
- }
- return nil
-}
-
-// Like WriteUnifiedDiff but returns the diff a string.
-func GetUnifiedDiffString(diff UnifiedDiff) (string, error) {
- w := &bytes.Buffer{}
- err := WriteUnifiedDiff(w, diff)
- return w.String(), err
-}
-
-// Split a string on "\n" while preserving them. The output can be used
-// as input for UnifiedDiff and ContextDiff structures.
-func SplitLines(s string) []string {
- lines := strings.SplitAfter(s, "\n")
- lines[len(lines)-1] += "\n"
- return lines
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go
deleted file mode 100644
index 723b45d..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package internal
-
-import "regexp"
-
-type GoCollectorRule struct {
- Matcher *regexp.Regexp
- Deny bool
-}
-
-// GoCollectorOptions should not be used be directly by anything, except `collectors` package.
-// Use it via collectors package instead. See issue
-// https://github.com/prometheus/client_golang/issues/1030.
-//
-// This is internal, so external users only can use it via `collector.WithGoCollector*` methods
-type GoCollectorOptions struct {
- DisableMemStatsLikeMetrics bool
- RuntimeMetricSumForHist map[string]string
- RuntimeMetricRules []GoCollectorRule
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go
deleted file mode 100644
index 97d17d6..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build go1.17
-// +build go1.17
-
-package internal
-
-import (
- "math"
- "path"
- "runtime/metrics"
- "strings"
-
- "github.com/prometheus/common/model"
-)
-
-// RuntimeMetricsToProm produces a Prometheus metric name from a runtime/metrics
-// metric description and validates whether the metric is suitable for integration
-// with Prometheus.
-//
-// Returns false if a name could not be produced, or if Prometheus does not understand
-// the runtime/metrics Kind.
-//
-// Note that the main reason a name couldn't be produced is if the runtime/metrics
-// package exports a name with characters outside the valid Prometheus metric name
-// character set. This is theoretically possible, but should never happen in practice.
-// Still, don't rely on it.
-func RuntimeMetricsToProm(d *metrics.Description) (string, string, string, bool) {
- namespace := "go"
-
- comp := strings.SplitN(d.Name, ":", 2)
- key := comp[0]
- unit := comp[1]
-
- // The last path element in the key is the name,
- // the rest is the subsystem.
- subsystem := path.Dir(key[1:] /* remove leading / */)
- name := path.Base(key)
-
- // subsystem is translated by replacing all / and - with _.
- subsystem = strings.ReplaceAll(subsystem, "/", "_")
- subsystem = strings.ReplaceAll(subsystem, "-", "_")
-
- // unit is translated assuming that the unit contains no
- // non-ASCII characters.
- unit = strings.ReplaceAll(unit, "-", "_")
- unit = strings.ReplaceAll(unit, "*", "_")
- unit = strings.ReplaceAll(unit, "/", "_per_")
-
- // name has - replaced with _ and is concatenated with the unit and
- // other data.
- name = strings.ReplaceAll(name, "-", "_")
- name += "_" + unit
- if d.Cumulative && d.Kind != metrics.KindFloat64Histogram {
- name += "_total"
- }
-
- valid := model.IsValidMetricName(model.LabelValue(namespace + "_" + subsystem + "_" + name))
- switch d.Kind {
- case metrics.KindUint64:
- case metrics.KindFloat64:
- case metrics.KindFloat64Histogram:
- default:
- valid = false
- }
- return namespace, subsystem, name, valid
-}
-
-// RuntimeMetricsBucketsForUnit takes a set of buckets obtained for a runtime/metrics histogram
-// type (so, lower-bound inclusive) and a unit from a runtime/metrics name, and produces
-// a reduced set of buckets. This function always removes any -Inf bucket as it's represented
-// as the bottom-most upper-bound inclusive bucket in Prometheus.
-func RuntimeMetricsBucketsForUnit(buckets []float64, unit string) []float64 {
- switch unit {
- case "bytes":
- // Re-bucket as powers of 2.
- return reBucketExp(buckets, 2)
- case "seconds":
- // Re-bucket as powers of 10 and then merge all buckets greater
- // than 1 second into the +Inf bucket.
- b := reBucketExp(buckets, 10)
- for i := range b {
- if b[i] <= 1 {
- continue
- }
- b[i] = math.Inf(1)
- b = b[:i+1]
- break
- }
- return b
- }
- return buckets
-}
-
-// reBucketExp takes a list of bucket boundaries (lower bound inclusive) and
-// downsamples the buckets to those a multiple of base apart. The end result
-// is a roughly exponential (in many cases, perfectly exponential) bucketing
-// scheme.
-func reBucketExp(buckets []float64, base float64) []float64 {
- bucket := buckets[0]
- var newBuckets []float64
- // We may see a -Inf here, in which case, add it and skip it
- // since we risk producing NaNs otherwise.
- //
- // We need to preserve -Inf values to maintain runtime/metrics
- // conventions. We'll strip it out later.
- if bucket == math.Inf(-1) {
- newBuckets = append(newBuckets, bucket)
- buckets = buckets[1:]
- bucket = buckets[0]
- }
- // From now on, bucket should always have a non-Inf value because
- // Infs are only ever at the ends of the bucket lists, so
- // arithmetic operations on it are non-NaN.
- for i := 1; i < len(buckets); i++ {
- if bucket >= 0 && buckets[i] < bucket*base {
- // The next bucket we want to include is at least bucket*base.
- continue
- } else if bucket < 0 && buckets[i] < bucket/base {
- // In this case the bucket we're targeting is negative, and since
- // we're ascending through buckets here, we need to divide to get
- // closer to zero exponentially.
- continue
- }
- // The +Inf bucket will always be the last one, and we'll always
- // end up including it here because bucket
- newBuckets = append(newBuckets, bucket)
- bucket = buckets[i]
- }
- return append(newBuckets, bucket)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
deleted file mode 100644
index 6515c11..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package internal
-
-import (
- "sort"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// LabelPairSorter implements sort.Interface. It is used to sort a slice of
-// dto.LabelPair pointers.
-type LabelPairSorter []*dto.LabelPair
-
-func (s LabelPairSorter) Len() int {
- return len(s)
-}
-
-func (s LabelPairSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s LabelPairSorter) Less(i, j int) bool {
- return s[i].GetName() < s[j].GetName()
-}
-
-// MetricSorter is a sortable slice of *dto.Metric.
-type MetricSorter []*dto.Metric
-
-func (s MetricSorter) Len() int {
- return len(s)
-}
-
-func (s MetricSorter) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s MetricSorter) Less(i, j int) bool {
- if len(s[i].Label) != len(s[j].Label) {
- // This should not happen. The metrics are
- // inconsistent. However, we have to deal with the fact, as
- // people might use custom collectors or metric family injection
- // to create inconsistent metrics. So let's simply compare the
- // number of labels in this case. That will still yield
- // reproducible sorting.
- return len(s[i].Label) < len(s[j].Label)
- }
- for n, lp := range s[i].Label {
- vi := lp.GetValue()
- vj := s[j].Label[n].GetValue()
- if vi != vj {
- return vi < vj
- }
- }
-
- // We should never arrive here. Multiple metrics with the same
- // label set in the same scrape will lead to undefined ingestion
- // behavior. However, as above, we have to provide stable sorting
- // here, even for inconsistent metrics. So sort equal metrics
- // by their timestamp, with missing timestamps (implying "now")
- // coming last.
- if s[i].TimestampMs == nil {
- return false
- }
- if s[j].TimestampMs == nil {
- return true
- }
- return s[i].GetTimestampMs() < s[j].GetTimestampMs()
-}
-
-// NormalizeMetricFamilies returns a MetricFamily slice with empty
-// MetricFamilies pruned and the remaining MetricFamilies sorted by name within
-// the slice, with the contained Metrics sorted within each MetricFamily.
-func NormalizeMetricFamilies(metricFamiliesByName map[string]*dto.MetricFamily) []*dto.MetricFamily {
- for _, mf := range metricFamiliesByName {
- sort.Sort(MetricSorter(mf.Metric))
- }
- names := make([]string, 0, len(metricFamiliesByName))
- for name, mf := range metricFamiliesByName {
- if len(mf.Metric) > 0 {
- names = append(names, name)
- }
- }
- sort.Strings(names)
- result := make([]*dto.MetricFamily, 0, len(names))
- for _, name := range names {
- result = append(result, metricFamiliesByName[name])
- }
- return result
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/labels.go b/vendor/github.com/prometheus/client_golang/prometheus/labels.go
deleted file mode 100644
index c21911f..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/labels.go
+++ /dev/null
@@ -1,188 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "strings"
- "unicode/utf8"
-
- "github.com/prometheus/common/model"
-)
-
-// Labels represents a collection of label name -> value mappings. This type is
-// commonly used with the With(Labels) and GetMetricWith(Labels) methods of
-// metric vector Collectors, e.g.:
-//
-// myVec.With(Labels{"code": "404", "method": "GET"}).Add(42)
-//
-// The other use-case is the specification of constant label pairs in Opts or to
-// create a Desc.
-type Labels map[string]string
-
-// LabelConstraint normalizes label values.
-type LabelConstraint func(string) string
-
-// ConstrainedLabels represents a label name and its constrain function
-// to normalize label values. This type is commonly used when constructing
-// metric vector Collectors.
-type ConstrainedLabel struct {
- Name string
- Constraint LabelConstraint
-}
-
-// ConstrainableLabels is an interface that allows creating of labels that can
-// be optionally constrained.
-//
-// prometheus.V2().NewCounterVec(CounterVecOpts{
-// CounterOpts: {...}, // Usual CounterOpts fields
-// VariableLabels: []ConstrainedLabels{
-// {Name: "A"},
-// {Name: "B", Constraint: func(v string) string { ... }},
-// },
-// })
-type ConstrainableLabels interface {
- compile() *compiledLabels
- labelNames() []string
-}
-
-// ConstrainedLabels represents a collection of label name -> constrain function
-// to normalize label values. This type is commonly used when constructing
-// metric vector Collectors.
-type ConstrainedLabels []ConstrainedLabel
-
-func (cls ConstrainedLabels) compile() *compiledLabels {
- compiled := &compiledLabels{
- names: make([]string, len(cls)),
- labelConstraints: map[string]LabelConstraint{},
- }
-
- for i, label := range cls {
- compiled.names[i] = label.Name
- if label.Constraint != nil {
- compiled.labelConstraints[label.Name] = label.Constraint
- }
- }
-
- return compiled
-}
-
-func (cls ConstrainedLabels) labelNames() []string {
- names := make([]string, len(cls))
- for i, label := range cls {
- names[i] = label.Name
- }
- return names
-}
-
-// UnconstrainedLabels represents collection of label without any constraint on
-// their value. Thus, it is simply a collection of label names.
-//
-// UnconstrainedLabels([]string{ "A", "B" })
-//
-// is equivalent to
-//
-// ConstrainedLabels {
-// { Name: "A" },
-// { Name: "B" },
-// }
-type UnconstrainedLabels []string
-
-func (uls UnconstrainedLabels) compile() *compiledLabels {
- return &compiledLabels{
- names: uls,
- }
-}
-
-func (uls UnconstrainedLabels) labelNames() []string {
- return uls
-}
-
-type compiledLabels struct {
- names []string
- labelConstraints map[string]LabelConstraint
-}
-
-func (cls *compiledLabels) compile() *compiledLabels {
- return cls
-}
-
-func (cls *compiledLabels) labelNames() []string {
- return cls.names
-}
-
-func (cls *compiledLabels) constrain(labelName, value string) string {
- if fn, ok := cls.labelConstraints[labelName]; ok && fn != nil {
- return fn(value)
- }
- return value
-}
-
-// reservedLabelPrefix is a prefix which is not legal in user-supplied
-// label names.
-const reservedLabelPrefix = "__"
-
-var errInconsistentCardinality = errors.New("inconsistent label cardinality")
-
-func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error {
- return fmt.Errorf(
- "%w: %q has %d variable labels named %q but %d values %q were provided",
- errInconsistentCardinality, fqName,
- len(labels), labels,
- len(labelValues), labelValues,
- )
-}
-
-func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error {
- if len(labels) != expectedNumberOfValues {
- return fmt.Errorf(
- "%w: expected %d label values but got %d in %#v",
- errInconsistentCardinality, expectedNumberOfValues,
- len(labels), labels,
- )
- }
-
- for name, val := range labels {
- if !utf8.ValidString(val) {
- return fmt.Errorf("label %s: value %q is not valid UTF-8", name, val)
- }
- }
-
- return nil
-}
-
-func validateLabelValues(vals []string, expectedNumberOfValues int) error {
- if len(vals) != expectedNumberOfValues {
- // The call below makes vals escape, copy them to avoid that.
- vals := append([]string(nil), vals...)
- return fmt.Errorf(
- "%w: expected %d label values but got %d in %#v",
- errInconsistentCardinality, expectedNumberOfValues,
- len(vals), vals,
- )
- }
-
- for _, val := range vals {
- if !utf8.ValidString(val) {
- return fmt.Errorf("label value %q is not valid UTF-8", val)
- }
- }
-
- return nil
-}
-
-func checkLabelName(l string) bool {
- return model.LabelName(l).IsValid() && !strings.HasPrefix(l, reservedLabelPrefix)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/metric.go b/vendor/github.com/prometheus/client_golang/prometheus/metric.go
deleted file mode 100644
index f018e57..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/metric.go
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "math"
- "sort"
- "strings"
- "time"
-
- dto "github.com/prometheus/client_model/go"
- "github.com/prometheus/common/model"
- "google.golang.org/protobuf/proto"
-)
-
-var separatorByteSlice = []byte{model.SeparatorByte} // For convenient use with xxhash.
-
-// A Metric models a single sample value with its meta data being exported to
-// Prometheus. Implementations of Metric in this package are Gauge, Counter,
-// Histogram, Summary, and Untyped.
-type Metric interface {
- // Desc returns the descriptor for the Metric. This method idempotently
- // returns the same descriptor throughout the lifetime of the
- // Metric. The returned descriptor is immutable by contract. A Metric
- // unable to describe itself must return an invalid descriptor (created
- // with NewInvalidDesc).
- Desc() *Desc
- // Write encodes the Metric into a "Metric" Protocol Buffer data
- // transmission object.
- //
- // Metric implementations must observe concurrency safety as reads of
- // this metric may occur at any time, and any blocking occurs at the
- // expense of total performance of rendering all registered
- // metrics. Ideally, Metric implementations should support concurrent
- // readers.
- //
- // While populating dto.Metric, it is the responsibility of the
- // implementation to ensure validity of the Metric protobuf (like valid
- // UTF-8 strings or syntactically valid metric and label names). It is
- // recommended to sort labels lexicographically. Callers of Write should
- // still make sure of sorting if they depend on it.
- Write(*dto.Metric) error
- // TODO(beorn7): The original rationale of passing in a pre-allocated
- // dto.Metric protobuf to save allocations has disappeared. The
- // signature of this method should be changed to "Write() (*dto.Metric,
- // error)".
-}
-
-// Opts bundles the options for creating most Metric types. Each metric
-// implementation XXX has its own XXXOpts type, but in most cases, it is just
-// an alias of this type (which might change when the requirement arises.)
-//
-// It is mandatory to set Name to a non-empty string. All other fields are
-// optional and can safely be left at their zero value, although it is strongly
-// encouraged to set a Help string.
-type Opts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Metric (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the metric must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this metric.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels
- ConstLabels Labels
-
- // now is for testing purposes, by default it's time.Now.
- now func() time.Time
-}
-
-// BuildFQName joins the given three name components by "_". Empty name
-// components are ignored. If the name parameter itself is empty, an empty
-// string is returned, no matter what. Metric implementations included in this
-// library use this function internally to generate the fully-qualified metric
-// name from the name component in their Opts. Users of the library will only
-// need this function if they implement their own Metric or instantiate a Desc
-// (with NewDesc) directly.
-func BuildFQName(namespace, subsystem, name string) string {
- if name == "" {
- return ""
- }
- switch {
- case namespace != "" && subsystem != "":
- return strings.Join([]string{namespace, subsystem, name}, "_")
- case namespace != "":
- return strings.Join([]string{namespace, name}, "_")
- case subsystem != "":
- return strings.Join([]string{subsystem, name}, "_")
- }
- return name
-}
-
-type invalidMetric struct {
- desc *Desc
- err error
-}
-
-// NewInvalidMetric returns a metric whose Write method always returns the
-// provided error. It is useful if a Collector finds itself unable to collect
-// a metric and wishes to report an error to the registry.
-func NewInvalidMetric(desc *Desc, err error) Metric {
- return &invalidMetric{desc, err}
-}
-
-func (m *invalidMetric) Desc() *Desc { return m.desc }
-
-func (m *invalidMetric) Write(*dto.Metric) error { return m.err }
-
-type timestampedMetric struct {
- Metric
- t time.Time
-}
-
-func (m timestampedMetric) Write(pb *dto.Metric) error {
- e := m.Metric.Write(pb)
- pb.TimestampMs = proto.Int64(m.t.Unix()*1000 + int64(m.t.Nanosecond()/1000000))
- return e
-}
-
-// NewMetricWithTimestamp returns a new Metric wrapping the provided Metric in a
-// way that it has an explicit timestamp set to the provided Time. This is only
-// useful in rare cases as the timestamp of a Prometheus metric should usually
-// be set by the Prometheus server during scraping. Exceptions include mirroring
-// metrics with given timestamps from other metric
-// sources.
-//
-// NewMetricWithTimestamp works best with MustNewConstMetric,
-// MustNewConstHistogram, and MustNewConstSummary, see example.
-//
-// Currently, the exposition formats used by Prometheus are limited to
-// millisecond resolution. Thus, the provided time will be rounded down to the
-// next full millisecond value.
-func NewMetricWithTimestamp(t time.Time, m Metric) Metric {
- return timestampedMetric{Metric: m, t: t}
-}
-
-type withExemplarsMetric struct {
- Metric
-
- exemplars []*dto.Exemplar
-}
-
-func (m *withExemplarsMetric) Write(pb *dto.Metric) error {
- if err := m.Metric.Write(pb); err != nil {
- return err
- }
-
- switch {
- case pb.Counter != nil:
- pb.Counter.Exemplar = m.exemplars[len(m.exemplars)-1]
- case pb.Histogram != nil:
- for _, e := range m.exemplars {
- // pb.Histogram.Bucket are sorted by UpperBound.
- i := sort.Search(len(pb.Histogram.Bucket), func(i int) bool {
- return pb.Histogram.Bucket[i].GetUpperBound() >= e.GetValue()
- })
- if i < len(pb.Histogram.Bucket) {
- pb.Histogram.Bucket[i].Exemplar = e
- } else {
- // The +Inf bucket should be explicitly added if there is an exemplar for it, similar to non-const histogram logic in https://github.com/prometheus/client_golang/blob/main/prometheus/histogram.go#L357-L365.
- b := &dto.Bucket{
- CumulativeCount: proto.Uint64(pb.Histogram.GetSampleCount()),
- UpperBound: proto.Float64(math.Inf(1)),
- Exemplar: e,
- }
- pb.Histogram.Bucket = append(pb.Histogram.Bucket, b)
- }
- }
- default:
- // TODO(bwplotka): Implement Gauge?
- return errors.New("cannot inject exemplar into Gauge, Summary or Untyped")
- }
-
- return nil
-}
-
-// Exemplar is easier to use, user-facing representation of *dto.Exemplar.
-type Exemplar struct {
- Value float64
- Labels Labels
- // Optional.
- // Default value (time.Time{}) indicates its empty, which should be
- // understood as time.Now() time at the moment of creation of metric.
- Timestamp time.Time
-}
-
-// NewMetricWithExemplars returns a new Metric wrapping the provided Metric with given
-// exemplars. Exemplars are validated.
-//
-// Only last applicable exemplar is injected from the list.
-// For example for Counter it means last exemplar is injected.
-// For Histogram, it means last applicable exemplar for each bucket is injected.
-//
-// NewMetricWithExemplars works best with MustNewConstMetric and
-// MustNewConstHistogram, see example.
-func NewMetricWithExemplars(m Metric, exemplars ...Exemplar) (Metric, error) {
- if len(exemplars) == 0 {
- return nil, errors.New("no exemplar was passed for NewMetricWithExemplars")
- }
-
- var (
- now = time.Now()
- exs = make([]*dto.Exemplar, len(exemplars))
- err error
- )
- for i, e := range exemplars {
- ts := e.Timestamp
- if ts == (time.Time{}) {
- ts = now
- }
- exs[i], err = newExemplar(e.Value, ts, e.Labels)
- if err != nil {
- return nil, err
- }
- }
-
- return &withExemplarsMetric{Metric: m, exemplars: exs}, nil
-}
-
-// MustNewMetricWithExemplars is a version of NewMetricWithExemplars that panics where
-// NewMetricWithExemplars would have returned an error.
-func MustNewMetricWithExemplars(m Metric, exemplars ...Exemplar) Metric {
- ret, err := NewMetricWithExemplars(m, exemplars...)
- if err != nil {
- panic(err)
- }
- return ret
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/num_threads.go b/vendor/github.com/prometheus/client_golang/prometheus/num_threads.go
deleted file mode 100644
index 7c12b21..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/num_threads.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !js || wasm
-// +build !js wasm
-
-package prometheus
-
-import "runtime"
-
-// getRuntimeNumThreads returns the number of open OS threads.
-func getRuntimeNumThreads() float64 {
- n, _ := runtime.ThreadCreateProfile(nil)
- return float64(n)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/num_threads_gopherjs.go b/vendor/github.com/prometheus/client_golang/prometheus/num_threads_gopherjs.go
deleted file mode 100644
index 7348df0..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/num_threads_gopherjs.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build js && !wasm
-// +build js,!wasm
-
-package prometheus
-
-// getRuntimeNumThreads returns the number of open OS threads.
-func getRuntimeNumThreads() float64 {
- return 1
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/observer.go b/vendor/github.com/prometheus/client_golang/prometheus/observer.go
deleted file mode 100644
index 03773b2..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/observer.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// Observer is the interface that wraps the Observe method, which is used by
-// Histogram and Summary to add observations.
-type Observer interface {
- Observe(float64)
-}
-
-// The ObserverFunc type is an adapter to allow the use of ordinary
-// functions as Observers. If f is a function with the appropriate
-// signature, ObserverFunc(f) is an Observer that calls f.
-//
-// This adapter is usually used in connection with the Timer type, and there are
-// two general use cases:
-//
-// The most common one is to use a Gauge as the Observer for a Timer.
-// See the "Gauge" Timer example.
-//
-// The more advanced use case is to create a function that dynamically decides
-// which Observer to use for observing the duration. See the "Complex" Timer
-// example.
-type ObserverFunc func(float64)
-
-// Observe calls f(value). It implements Observer.
-func (f ObserverFunc) Observe(value float64) {
- f(value)
-}
-
-// ObserverVec is an interface implemented by `HistogramVec` and `SummaryVec`.
-type ObserverVec interface {
- GetMetricWith(Labels) (Observer, error)
- GetMetricWithLabelValues(lvs ...string) (Observer, error)
- With(Labels) Observer
- WithLabelValues(...string) Observer
- CurryWith(Labels) (ObserverVec, error)
- MustCurryWith(Labels) ObserverVec
-
- Collector
-}
-
-// ExemplarObserver is implemented by Observers that offer the option of
-// observing a value together with an exemplar. Its ObserveWithExemplar method
-// works like the Observe method of an Observer but also replaces the currently
-// saved exemplar (if any) with a new one, created from the provided value, the
-// current time as timestamp, and the provided Labels. Empty Labels will lead to
-// a valid (label-less) exemplar. But if Labels is nil, the current exemplar is
-// left in place. ObserveWithExemplar panics if any of the provided labels are
-// invalid or if the provided labels contain more than 128 runes in total.
-type ExemplarObserver interface {
- ObserveWithExemplar(value float64, exemplar Labels)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
deleted file mode 100644
index 8548dd1..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "os"
- "strconv"
- "strings"
-)
-
-type processCollector struct {
- collectFn func(chan<- Metric)
- pidFn func() (int, error)
- reportErrors bool
- cpuTotal *Desc
- openFDs, maxFDs *Desc
- vsize, maxVsize *Desc
- rss *Desc
- startTime *Desc
-}
-
-// ProcessCollectorOpts defines the behavior of a process metrics collector
-// created with NewProcessCollector.
-type ProcessCollectorOpts struct {
- // PidFn returns the PID of the process the collector collects metrics
- // for. It is called upon each collection. By default, the PID of the
- // current process is used, as determined on construction time by
- // calling os.Getpid().
- PidFn func() (int, error)
- // If non-empty, each of the collected metrics is prefixed by the
- // provided string and an underscore ("_").
- Namespace string
- // If true, any error encountered during collection is reported as an
- // invalid metric (see NewInvalidMetric). Otherwise, errors are ignored
- // and the collected metrics will be incomplete. (Possibly, no metrics
- // will be collected at all.) While that's usually not desired, it is
- // appropriate for the common "mix-in" of process metrics, where process
- // metrics are nice to have, but failing to collect them should not
- // disrupt the collection of the remaining metrics.
- ReportErrors bool
-}
-
-// NewProcessCollector is the obsolete version of collectors.NewProcessCollector.
-// See there for documentation.
-//
-// Deprecated: Use collectors.NewProcessCollector instead.
-func NewProcessCollector(opts ProcessCollectorOpts) Collector {
- ns := ""
- if len(opts.Namespace) > 0 {
- ns = opts.Namespace + "_"
- }
-
- c := &processCollector{
- reportErrors: opts.ReportErrors,
- cpuTotal: NewDesc(
- ns+"process_cpu_seconds_total",
- "Total user and system CPU time spent in seconds.",
- nil, nil,
- ),
- openFDs: NewDesc(
- ns+"process_open_fds",
- "Number of open file descriptors.",
- nil, nil,
- ),
- maxFDs: NewDesc(
- ns+"process_max_fds",
- "Maximum number of open file descriptors.",
- nil, nil,
- ),
- vsize: NewDesc(
- ns+"process_virtual_memory_bytes",
- "Virtual memory size in bytes.",
- nil, nil,
- ),
- maxVsize: NewDesc(
- ns+"process_virtual_memory_max_bytes",
- "Maximum amount of virtual memory available in bytes.",
- nil, nil,
- ),
- rss: NewDesc(
- ns+"process_resident_memory_bytes",
- "Resident memory size in bytes.",
- nil, nil,
- ),
- startTime: NewDesc(
- ns+"process_start_time_seconds",
- "Start time of the process since unix epoch in seconds.",
- nil, nil,
- ),
- }
-
- if opts.PidFn == nil {
- c.pidFn = getPIDFn()
- } else {
- c.pidFn = opts.PidFn
- }
-
- // Set up process metric collection if supported by the runtime.
- if canCollectProcess() {
- c.collectFn = c.processCollect
- } else {
- c.collectFn = func(ch chan<- Metric) {
- c.reportError(ch, nil, errors.New("process metrics not supported on this platform"))
- }
- }
-
- return c
-}
-
-// Describe returns all descriptions of the collector.
-func (c *processCollector) Describe(ch chan<- *Desc) {
- ch <- c.cpuTotal
- ch <- c.openFDs
- ch <- c.maxFDs
- ch <- c.vsize
- ch <- c.maxVsize
- ch <- c.rss
- ch <- c.startTime
-}
-
-// Collect returns the current state of all metrics of the collector.
-func (c *processCollector) Collect(ch chan<- Metric) {
- c.collectFn(ch)
-}
-
-func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) {
- if !c.reportErrors {
- return
- }
- if desc == nil {
- desc = NewInvalidDesc(err)
- }
- ch <- NewInvalidMetric(desc, err)
-}
-
-// NewPidFileFn returns a function that retrieves a pid from the specified file.
-// It is meant to be used for the PidFn field in ProcessCollectorOpts.
-func NewPidFileFn(pidFilePath string) func() (int, error) {
- return func() (int, error) {
- content, err := os.ReadFile(pidFilePath)
- if err != nil {
- return 0, fmt.Errorf("can't read pid file %q: %w", pidFilePath, err)
- }
- pid, err := strconv.Atoi(strings.TrimSpace(string(content)))
- if err != nil {
- return 0, fmt.Errorf("can't parse pid file %q: %w", pidFilePath, err)
- }
-
- return pid, nil
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_js.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_js.go
deleted file mode 100644
index b1e363d..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_js.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build js
-// +build js
-
-package prometheus
-
-func canCollectProcess() bool {
- return false
-}
-
-func (c *processCollector) processCollect(ch chan<- Metric) {
- // noop on this platform
- return
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go
deleted file mode 100644
index 8c1136c..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows && !js && !wasip1
-// +build !windows,!js,!wasip1
-
-package prometheus
-
-import (
- "github.com/prometheus/procfs"
-)
-
-func canCollectProcess() bool {
- _, err := procfs.NewDefaultFS()
- return err == nil
-}
-
-func (c *processCollector) processCollect(ch chan<- Metric) {
- pid, err := c.pidFn()
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- p, err := procfs.NewProc(pid)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- if stat, err := p.Stat(); err == nil {
- ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime())
- ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory()))
- ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory()))
- if startTime, err := stat.StartTime(); err == nil {
- ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime)
- } else {
- c.reportError(ch, c.startTime, err)
- }
- } else {
- c.reportError(ch, nil, err)
- }
-
- if fds, err := p.FileDescriptorsLen(); err == nil {
- ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds))
- } else {
- c.reportError(ch, c.openFDs, err)
- }
-
- if limits, err := p.Limits(); err == nil {
- ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles))
- ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace))
- } else {
- c.reportError(ch, nil, err)
- }
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_wasip1.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_wasip1.go
deleted file mode 100644
index d8d9a6d..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_wasip1.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2023 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build wasip1
-// +build wasip1
-
-package prometheus
-
-func canCollectProcess() bool {
- return false
-}
-
-func (*processCollector) processCollect(chan<- Metric) {
- // noop on this platform
- return
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
deleted file mode 100644
index f973398..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "syscall"
- "unsafe"
-
- "golang.org/x/sys/windows"
-)
-
-func canCollectProcess() bool {
- return true
-}
-
-var (
- modpsapi = syscall.NewLazyDLL("psapi.dll")
- modkernel32 = syscall.NewLazyDLL("kernel32.dll")
-
- procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo")
- procGetProcessHandleCount = modkernel32.NewProc("GetProcessHandleCount")
-)
-
-type processMemoryCounters struct {
- // System interface description
- // https://docs.microsoft.com/en-us/windows/desktop/api/psapi/ns-psapi-process_memory_counters_ex
-
- // Refer to the Golang internal implementation
- // https://golang.org/src/internal/syscall/windows/psapi_windows.go
- _ uint32
- PageFaultCount uint32
- PeakWorkingSetSize uintptr
- WorkingSetSize uintptr
- QuotaPeakPagedPoolUsage uintptr
- QuotaPagedPoolUsage uintptr
- QuotaPeakNonPagedPoolUsage uintptr
- QuotaNonPagedPoolUsage uintptr
- PagefileUsage uintptr
- PeakPagefileUsage uintptr
- PrivateUsage uintptr
-}
-
-func getProcessMemoryInfo(handle windows.Handle) (processMemoryCounters, error) {
- mem := processMemoryCounters{}
- r1, _, err := procGetProcessMemoryInfo.Call(
- uintptr(handle),
- uintptr(unsafe.Pointer(&mem)),
- uintptr(unsafe.Sizeof(mem)),
- )
- if r1 != 1 {
- return mem, err
- } else {
- return mem, nil
- }
-}
-
-func getProcessHandleCount(handle windows.Handle) (uint32, error) {
- var count uint32
- r1, _, err := procGetProcessHandleCount.Call(
- uintptr(handle),
- uintptr(unsafe.Pointer(&count)),
- )
- if r1 != 1 {
- return 0, err
- } else {
- return count, nil
- }
-}
-
-func (c *processCollector) processCollect(ch chan<- Metric) {
- h, err := windows.GetCurrentProcess()
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
-
- var startTime, exitTime, kernelTime, userTime windows.Filetime
- err = windows.GetProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.startTime, GaugeValue, float64(startTime.Nanoseconds()/1e9))
- ch <- MustNewConstMetric(c.cpuTotal, CounterValue, fileTimeToSeconds(kernelTime)+fileTimeToSeconds(userTime))
-
- mem, err := getProcessMemoryInfo(h)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(mem.PrivateUsage))
- ch <- MustNewConstMetric(c.rss, GaugeValue, float64(mem.WorkingSetSize))
-
- handles, err := getProcessHandleCount(h)
- if err != nil {
- c.reportError(ch, nil, err)
- return
- }
- ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(handles))
- ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(16*1024*1024)) // Windows has a hard-coded max limit, not per-process.
-}
-
-func fileTimeToSeconds(ft windows.Filetime) float64 {
- return float64(uint64(ft.HighDateTime)<<32+uint64(ft.LowDateTime)) / 1e7
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go
deleted file mode 100644
index 5e2ced2..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go
+++ /dev/null
@@ -1,1075 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "bytes"
- "errors"
- "fmt"
- "os"
- "path/filepath"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "sync"
- "unicode/utf8"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-
- "github.com/cespare/xxhash/v2"
- dto "github.com/prometheus/client_model/go"
- "github.com/prometheus/common/expfmt"
- "google.golang.org/protobuf/proto"
-)
-
-const (
- // Capacity for the channel to collect metrics and descriptors.
- capMetricChan = 1000
- capDescChan = 10
-)
-
-// DefaultRegisterer and DefaultGatherer are the implementations of the
-// Registerer and Gatherer interface a number of convenience functions in this
-// package act on. Initially, both variables point to the same Registry, which
-// has a process collector (currently on Linux only, see NewProcessCollector)
-// and a Go collector (see NewGoCollector, in particular the note about
-// stop-the-world implication with Go versions older than 1.9) already
-// registered. This approach to keep default instances as global state mirrors
-// the approach of other packages in the Go standard library. Note that there
-// are caveats. Change the variables with caution and only if you understand the
-// consequences. Users who want to avoid global state altogether should not use
-// the convenience functions and act on custom instances instead.
-var (
- defaultRegistry = NewRegistry()
- DefaultRegisterer Registerer = defaultRegistry
- DefaultGatherer Gatherer = defaultRegistry
-)
-
-func init() {
- MustRegister(NewProcessCollector(ProcessCollectorOpts{}))
- MustRegister(NewGoCollector())
-}
-
-// NewRegistry creates a new vanilla Registry without any Collectors
-// pre-registered.
-func NewRegistry() *Registry {
- return &Registry{
- collectorsByID: map[uint64]Collector{},
- descIDs: map[uint64]struct{}{},
- dimHashesByName: map[string]uint64{},
- }
-}
-
-// NewPedanticRegistry returns a registry that checks during collection if each
-// collected Metric is consistent with its reported Desc, and if the Desc has
-// actually been registered with the registry. Unchecked Collectors (those whose
-// Describe method does not yield any descriptors) are excluded from the check.
-//
-// Usually, a Registry will be happy as long as the union of all collected
-// Metrics is consistent and valid even if some metrics are not consistent with
-// their own Desc or a Desc provided by their registered Collector. Well-behaved
-// Collectors and Metrics will only provide consistent Descs. This Registry is
-// useful to test the implementation of Collectors and Metrics.
-func NewPedanticRegistry() *Registry {
- r := NewRegistry()
- r.pedanticChecksEnabled = true
- return r
-}
-
-// Registerer is the interface for the part of a registry in charge of
-// registering and unregistering. Users of custom registries should use
-// Registerer as type for registration purposes (rather than the Registry type
-// directly). In that way, they are free to use custom Registerer implementation
-// (e.g. for testing purposes).
-type Registerer interface {
- // Register registers a new Collector to be included in metrics
- // collection. It returns an error if the descriptors provided by the
- // Collector are invalid or if they — in combination with descriptors of
- // already registered Collectors — do not fulfill the consistency and
- // uniqueness criteria described in the documentation of metric.Desc.
- //
- // If the provided Collector is equal to a Collector already registered
- // (which includes the case of re-registering the same Collector), the
- // returned error is an instance of AlreadyRegisteredError, which
- // contains the previously registered Collector.
- //
- // A Collector whose Describe method does not yield any Desc is treated
- // as unchecked. Registration will always succeed. No check for
- // re-registering (see previous paragraph) is performed. Thus, the
- // caller is responsible for not double-registering the same unchecked
- // Collector, and for providing a Collector that will not cause
- // inconsistent metrics on collection. (This would lead to scrape
- // errors.)
- Register(Collector) error
- // MustRegister works like Register but registers any number of
- // Collectors and panics upon the first registration that causes an
- // error.
- MustRegister(...Collector)
- // Unregister unregisters the Collector that equals the Collector passed
- // in as an argument. (Two Collectors are considered equal if their
- // Describe method yields the same set of descriptors.) The function
- // returns whether a Collector was unregistered. Note that an unchecked
- // Collector cannot be unregistered (as its Describe method does not
- // yield any descriptor).
- //
- // Note that even after unregistering, it will not be possible to
- // register a new Collector that is inconsistent with the unregistered
- // Collector, e.g. a Collector collecting metrics with the same name but
- // a different help string. The rationale here is that the same registry
- // instance must only collect consistent metrics throughout its
- // lifetime.
- Unregister(Collector) bool
-}
-
-// Gatherer is the interface for the part of a registry in charge of gathering
-// the collected metrics into a number of MetricFamilies. The Gatherer interface
-// comes with the same general implication as described for the Registerer
-// interface.
-type Gatherer interface {
- // Gather calls the Collect method of the registered Collectors and then
- // gathers the collected metrics into a lexicographically sorted slice
- // of uniquely named MetricFamily protobufs. Gather ensures that the
- // returned slice is valid and self-consistent so that it can be used
- // for valid exposition. As an exception to the strict consistency
- // requirements described for metric.Desc, Gather will tolerate
- // different sets of label names for metrics of the same metric family.
- //
- // Even if an error occurs, Gather attempts to gather as many metrics as
- // possible. Hence, if a non-nil error is returned, the returned
- // MetricFamily slice could be nil (in case of a fatal error that
- // prevented any meaningful metric collection) or contain a number of
- // MetricFamily protobufs, some of which might be incomplete, and some
- // might be missing altogether. The returned error (which might be a
- // MultiError) explains the details. Note that this is mostly useful for
- // debugging purposes. If the gathered protobufs are to be used for
- // exposition in actual monitoring, it is almost always better to not
- // expose an incomplete result and instead disregard the returned
- // MetricFamily protobufs in case the returned error is non-nil.
- Gather() ([]*dto.MetricFamily, error)
-}
-
-// Register registers the provided Collector with the DefaultRegisterer.
-//
-// Register is a shortcut for DefaultRegisterer.Register(c). See there for more
-// details.
-func Register(c Collector) error {
- return DefaultRegisterer.Register(c)
-}
-
-// MustRegister registers the provided Collectors with the DefaultRegisterer and
-// panics if any error occurs.
-//
-// MustRegister is a shortcut for DefaultRegisterer.MustRegister(cs...). See
-// there for more details.
-func MustRegister(cs ...Collector) {
- DefaultRegisterer.MustRegister(cs...)
-}
-
-// Unregister removes the registration of the provided Collector from the
-// DefaultRegisterer.
-//
-// Unregister is a shortcut for DefaultRegisterer.Unregister(c). See there for
-// more details.
-func Unregister(c Collector) bool {
- return DefaultRegisterer.Unregister(c)
-}
-
-// GathererFunc turns a function into a Gatherer.
-type GathererFunc func() ([]*dto.MetricFamily, error)
-
-// Gather implements Gatherer.
-func (gf GathererFunc) Gather() ([]*dto.MetricFamily, error) {
- return gf()
-}
-
-// AlreadyRegisteredError is returned by the Register method if the Collector to
-// be registered has already been registered before, or a different Collector
-// that collects the same metrics has been registered before. Registration fails
-// in that case, but you can detect from the kind of error what has
-// happened. The error contains fields for the existing Collector and the
-// (rejected) new Collector that equals the existing one. This can be used to
-// find out if an equal Collector has been registered before and switch over to
-// using the old one, as demonstrated in the example.
-type AlreadyRegisteredError struct {
- ExistingCollector, NewCollector Collector
-}
-
-func (err AlreadyRegisteredError) Error() string {
- return "duplicate metrics collector registration attempted"
-}
-
-// MultiError is a slice of errors implementing the error interface. It is used
-// by a Gatherer to report multiple errors during MetricFamily gathering.
-type MultiError []error
-
-// Error formats the contained errors as a bullet point list, preceded by the
-// total number of errors. Note that this results in a multi-line string.
-func (errs MultiError) Error() string {
- if len(errs) == 0 {
- return ""
- }
- buf := &bytes.Buffer{}
- fmt.Fprintf(buf, "%d error(s) occurred:", len(errs))
- for _, err := range errs {
- fmt.Fprintf(buf, "\n* %s", err)
- }
- return buf.String()
-}
-
-// Append appends the provided error if it is not nil.
-func (errs *MultiError) Append(err error) {
- if err != nil {
- *errs = append(*errs, err)
- }
-}
-
-// MaybeUnwrap returns nil if len(errs) is 0. It returns the first and only
-// contained error as error if len(errs is 1). In all other cases, it returns
-// the MultiError directly. This is helpful for returning a MultiError in a way
-// that only uses the MultiError if needed.
-func (errs MultiError) MaybeUnwrap() error {
- switch len(errs) {
- case 0:
- return nil
- case 1:
- return errs[0]
- default:
- return errs
- }
-}
-
-// Registry registers Prometheus collectors, collects their metrics, and gathers
-// them into MetricFamilies for exposition. It implements Registerer, Gatherer,
-// and Collector. The zero value is not usable. Create instances with
-// NewRegistry or NewPedanticRegistry.
-//
-// Registry implements Collector to allow it to be used for creating groups of
-// metrics. See the Grouping example for how this can be done.
-type Registry struct {
- mtx sync.RWMutex
- collectorsByID map[uint64]Collector // ID is a hash of the descIDs.
- descIDs map[uint64]struct{}
- dimHashesByName map[string]uint64
- uncheckedCollectors []Collector
- pedanticChecksEnabled bool
-}
-
-// Register implements Registerer.
-func (r *Registry) Register(c Collector) error {
- var (
- descChan = make(chan *Desc, capDescChan)
- newDescIDs = map[uint64]struct{}{}
- newDimHashesByName = map[string]uint64{}
- collectorID uint64 // All desc IDs XOR'd together.
- duplicateDescErr error
- )
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
- r.mtx.Lock()
- defer func() {
- // Drain channel in case of premature return to not leak a goroutine.
- for range descChan {
- }
- r.mtx.Unlock()
- }()
- // Conduct various tests...
- for desc := range descChan {
-
- // Is the descriptor valid at all?
- if desc.err != nil {
- return fmt.Errorf("descriptor %s is invalid: %w", desc, desc.err)
- }
-
- // Is the descID unique?
- // (In other words: Is the fqName + constLabel combination unique?)
- if _, exists := r.descIDs[desc.id]; exists {
- duplicateDescErr = fmt.Errorf("descriptor %s already exists with the same fully-qualified name and const label values", desc)
- }
- // If it is not a duplicate desc in this collector, XOR it to
- // the collectorID. (We allow duplicate descs within the same
- // collector, but their existence must be a no-op.)
- if _, exists := newDescIDs[desc.id]; !exists {
- newDescIDs[desc.id] = struct{}{}
- collectorID ^= desc.id
- }
-
- // Are all the label names and the help string consistent with
- // previous descriptors of the same name?
- // First check existing descriptors...
- if dimHash, exists := r.dimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return fmt.Errorf("a previously registered descriptor with the same fully-qualified name as %s has different label names or a different help string", desc)
- }
- } else {
- // ...then check the new descriptors already seen.
- if dimHash, exists := newDimHashesByName[desc.fqName]; exists {
- if dimHash != desc.dimHash {
- return fmt.Errorf("descriptors reported by collector have inconsistent label names or help strings for the same fully-qualified name, offender is %s", desc)
- }
- } else {
- newDimHashesByName[desc.fqName] = desc.dimHash
- }
- }
- }
- // A Collector yielding no Desc at all is considered unchecked.
- if len(newDescIDs) == 0 {
- r.uncheckedCollectors = append(r.uncheckedCollectors, c)
- return nil
- }
- if existing, exists := r.collectorsByID[collectorID]; exists {
- switch e := existing.(type) {
- case *wrappingCollector:
- return AlreadyRegisteredError{
- ExistingCollector: e.unwrapRecursively(),
- NewCollector: c,
- }
- default:
- return AlreadyRegisteredError{
- ExistingCollector: e,
- NewCollector: c,
- }
- }
- }
- // If the collectorID is new, but at least one of the descs existed
- // before, we are in trouble.
- if duplicateDescErr != nil {
- return duplicateDescErr
- }
-
- // Only after all tests have passed, actually register.
- r.collectorsByID[collectorID] = c
- for hash := range newDescIDs {
- r.descIDs[hash] = struct{}{}
- }
- for name, dimHash := range newDimHashesByName {
- r.dimHashesByName[name] = dimHash
- }
- return nil
-}
-
-// Unregister implements Registerer.
-func (r *Registry) Unregister(c Collector) bool {
- var (
- descChan = make(chan *Desc, capDescChan)
- descIDs = map[uint64]struct{}{}
- collectorID uint64 // All desc IDs XOR'd together.
- )
- go func() {
- c.Describe(descChan)
- close(descChan)
- }()
- for desc := range descChan {
- if _, exists := descIDs[desc.id]; !exists {
- collectorID ^= desc.id
- descIDs[desc.id] = struct{}{}
- }
- }
-
- r.mtx.RLock()
- if _, exists := r.collectorsByID[collectorID]; !exists {
- r.mtx.RUnlock()
- return false
- }
- r.mtx.RUnlock()
-
- r.mtx.Lock()
- defer r.mtx.Unlock()
-
- delete(r.collectorsByID, collectorID)
- for id := range descIDs {
- delete(r.descIDs, id)
- }
- // dimHashesByName is left untouched as those must be consistent
- // throughout the lifetime of a program.
- return true
-}
-
-// MustRegister implements Registerer.
-func (r *Registry) MustRegister(cs ...Collector) {
- for _, c := range cs {
- if err := r.Register(c); err != nil {
- panic(err)
- }
- }
-}
-
-// Gather implements Gatherer.
-func (r *Registry) Gather() ([]*dto.MetricFamily, error) {
- r.mtx.RLock()
-
- if len(r.collectorsByID) == 0 && len(r.uncheckedCollectors) == 0 {
- // Fast path.
- r.mtx.RUnlock()
- return nil, nil
- }
-
- var (
- checkedMetricChan = make(chan Metric, capMetricChan)
- uncheckedMetricChan = make(chan Metric, capMetricChan)
- metricHashes = map[uint64]struct{}{}
- wg sync.WaitGroup
- errs MultiError // The collected errors to return in the end.
- registeredDescIDs map[uint64]struct{} // Only used for pedantic checks
- )
-
- goroutineBudget := len(r.collectorsByID) + len(r.uncheckedCollectors)
- metricFamiliesByName := make(map[string]*dto.MetricFamily, len(r.dimHashesByName))
- checkedCollectors := make(chan Collector, len(r.collectorsByID))
- uncheckedCollectors := make(chan Collector, len(r.uncheckedCollectors))
- for _, collector := range r.collectorsByID {
- checkedCollectors <- collector
- }
- for _, collector := range r.uncheckedCollectors {
- uncheckedCollectors <- collector
- }
- // In case pedantic checks are enabled, we have to copy the map before
- // giving up the RLock.
- if r.pedanticChecksEnabled {
- registeredDescIDs = make(map[uint64]struct{}, len(r.descIDs))
- for id := range r.descIDs {
- registeredDescIDs[id] = struct{}{}
- }
- }
- r.mtx.RUnlock()
-
- wg.Add(goroutineBudget)
-
- collectWorker := func() {
- for {
- select {
- case collector := <-checkedCollectors:
- collector.Collect(checkedMetricChan)
- case collector := <-uncheckedCollectors:
- collector.Collect(uncheckedMetricChan)
- default:
- return
- }
- wg.Done()
- }
- }
-
- // Start the first worker now to make sure at least one is running.
- go collectWorker()
- goroutineBudget--
-
- // Close checkedMetricChan and uncheckedMetricChan once all collectors
- // are collected.
- go func() {
- wg.Wait()
- close(checkedMetricChan)
- close(uncheckedMetricChan)
- }()
-
- // Drain checkedMetricChan and uncheckedMetricChan in case of premature return.
- defer func() {
- if checkedMetricChan != nil {
- for range checkedMetricChan {
- }
- }
- if uncheckedMetricChan != nil {
- for range uncheckedMetricChan {
- }
- }
- }()
-
- // Copy the channel references so we can nil them out later to remove
- // them from the select statements below.
- cmc := checkedMetricChan
- umc := uncheckedMetricChan
-
- for {
- select {
- case metric, ok := <-cmc:
- if !ok {
- cmc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- registeredDescIDs,
- ))
- case metric, ok := <-umc:
- if !ok {
- umc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- nil,
- ))
- default:
- if goroutineBudget <= 0 || len(checkedCollectors)+len(uncheckedCollectors) == 0 {
- // All collectors are already being worked on or
- // we have already as many goroutines started as
- // there are collectors. Do the same as above,
- // just without the default.
- select {
- case metric, ok := <-cmc:
- if !ok {
- cmc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- registeredDescIDs,
- ))
- case metric, ok := <-umc:
- if !ok {
- umc = nil
- break
- }
- errs.Append(processMetric(
- metric, metricFamiliesByName,
- metricHashes,
- nil,
- ))
- }
- break
- }
- // Start more workers.
- go collectWorker()
- goroutineBudget--
- runtime.Gosched()
- }
- // Once both checkedMetricChan and uncheckedMetricChan are closed
- // and drained, the contraption above will nil out cmc and umc,
- // and then we can leave the collect loop here.
- if cmc == nil && umc == nil {
- break
- }
- }
- return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
-}
-
-// Describe implements Collector.
-func (r *Registry) Describe(ch chan<- *Desc) {
- r.mtx.RLock()
- defer r.mtx.RUnlock()
-
- // Only report the checked Collectors; unchecked collectors don't report any
- // Desc.
- for _, c := range r.collectorsByID {
- c.Describe(ch)
- }
-}
-
-// Collect implements Collector.
-func (r *Registry) Collect(ch chan<- Metric) {
- r.mtx.RLock()
- defer r.mtx.RUnlock()
-
- for _, c := range r.collectorsByID {
- c.Collect(ch)
- }
- for _, c := range r.uncheckedCollectors {
- c.Collect(ch)
- }
-}
-
-// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the
-// Prometheus text format, and writes it to a temporary file. Upon success, the
-// temporary file is renamed to the provided filename.
-//
-// This is intended for use with the textfile collector of the node exporter.
-// Note that the node exporter expects the filename to be suffixed with ".prom".
-func WriteToTextfile(filename string, g Gatherer) error {
- tmp, err := os.CreateTemp(filepath.Dir(filename), filepath.Base(filename))
- if err != nil {
- return err
- }
- defer os.Remove(tmp.Name())
-
- mfs, err := g.Gather()
- if err != nil {
- return err
- }
- for _, mf := range mfs {
- if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil {
- return err
- }
- }
- if err := tmp.Close(); err != nil {
- return err
- }
-
- if err := os.Chmod(tmp.Name(), 0o644); err != nil {
- return err
- }
- return os.Rename(tmp.Name(), filename)
-}
-
-// processMetric is an internal helper method only used by the Gather method.
-func processMetric(
- metric Metric,
- metricFamiliesByName map[string]*dto.MetricFamily,
- metricHashes map[uint64]struct{},
- registeredDescIDs map[uint64]struct{},
-) error {
- desc := metric.Desc()
- // Wrapped metrics collected by an unchecked Collector can have an
- // invalid Desc.
- if desc.err != nil {
- return desc.err
- }
- dtoMetric := &dto.Metric{}
- if err := metric.Write(dtoMetric); err != nil {
- return fmt.Errorf("error collecting metric %v: %w", desc, err)
- }
- metricFamily, ok := metricFamiliesByName[desc.fqName]
- if ok { // Existing name.
- if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- desc.fqName, dtoMetric, desc.help, metricFamily.GetHelp(),
- )
- }
- // TODO(beorn7): Simplify switch once Desc has type.
- switch metricFamily.GetType() {
- case dto.MetricType_COUNTER:
- if dtoMetric.Counter == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Counter",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_GAUGE:
- if dtoMetric.Gauge == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Gauge",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_SUMMARY:
- if dtoMetric.Summary == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Summary",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_UNTYPED:
- if dtoMetric.Untyped == nil {
- return fmt.Errorf(
- "collected metric %s %s should be Untyped",
- desc.fqName, dtoMetric,
- )
- }
- case dto.MetricType_HISTOGRAM:
- if dtoMetric.Histogram == nil {
- return fmt.Errorf(
- "collected metric %s %s should be a Histogram",
- desc.fqName, dtoMetric,
- )
- }
- default:
- panic("encountered MetricFamily with invalid type")
- }
- } else { // New name.
- metricFamily = &dto.MetricFamily{}
- metricFamily.Name = proto.String(desc.fqName)
- metricFamily.Help = proto.String(desc.help)
- // TODO(beorn7): Simplify switch once Desc has type.
- switch {
- case dtoMetric.Gauge != nil:
- metricFamily.Type = dto.MetricType_GAUGE.Enum()
- case dtoMetric.Counter != nil:
- metricFamily.Type = dto.MetricType_COUNTER.Enum()
- case dtoMetric.Summary != nil:
- metricFamily.Type = dto.MetricType_SUMMARY.Enum()
- case dtoMetric.Untyped != nil:
- metricFamily.Type = dto.MetricType_UNTYPED.Enum()
- case dtoMetric.Histogram != nil:
- metricFamily.Type = dto.MetricType_HISTOGRAM.Enum()
- default:
- return fmt.Errorf("empty metric collected: %s", dtoMetric)
- }
- if err := checkSuffixCollisions(metricFamily, metricFamiliesByName); err != nil {
- return err
- }
- metricFamiliesByName[desc.fqName] = metricFamily
- }
- if err := checkMetricConsistency(metricFamily, dtoMetric, metricHashes); err != nil {
- return err
- }
- if registeredDescIDs != nil {
- // Is the desc registered at all?
- if _, exist := registeredDescIDs[desc.id]; !exist {
- return fmt.Errorf(
- "collected metric %s %s with unregistered descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- if err := checkDescConsistency(metricFamily, dtoMetric, desc); err != nil {
- return err
- }
- }
- metricFamily.Metric = append(metricFamily.Metric, dtoMetric)
- return nil
-}
-
-// Gatherers is a slice of Gatherer instances that implements the Gatherer
-// interface itself. Its Gather method calls Gather on all Gatherers in the
-// slice in order and returns the merged results. Errors returned from the
-// Gather calls are all returned in a flattened MultiError. Duplicate and
-// inconsistent Metrics are skipped (first occurrence in slice order wins) and
-// reported in the returned error.
-//
-// Gatherers can be used to merge the Gather results from multiple
-// Registries. It also provides a way to directly inject existing MetricFamily
-// protobufs into the gathering by creating a custom Gatherer with a Gather
-// method that simply returns the existing MetricFamily protobufs. Note that no
-// registration is involved (in contrast to Collector registration), so
-// obviously registration-time checks cannot happen. Any inconsistencies between
-// the gathered MetricFamilies are reported as errors by the Gather method, and
-// inconsistent Metrics are dropped. Invalid parts of the MetricFamilies
-// (e.g. syntactically invalid metric or label names) will go undetected.
-type Gatherers []Gatherer
-
-// Gather implements Gatherer.
-func (gs Gatherers) Gather() ([]*dto.MetricFamily, error) {
- var (
- metricFamiliesByName = map[string]*dto.MetricFamily{}
- metricHashes = map[uint64]struct{}{}
- errs MultiError // The collected errors to return in the end.
- )
-
- for i, g := range gs {
- mfs, err := g.Gather()
- if err != nil {
- multiErr := MultiError{}
- if errors.As(err, &multiErr) {
- for _, err := range multiErr {
- errs = append(errs, fmt.Errorf("[from Gatherer #%d] %w", i+1, err))
- }
- } else {
- errs = append(errs, fmt.Errorf("[from Gatherer #%d] %w", i+1, err))
- }
- }
- for _, mf := range mfs {
- existingMF, exists := metricFamiliesByName[mf.GetName()]
- if exists {
- if existingMF.GetHelp() != mf.GetHelp() {
- errs = append(errs, fmt.Errorf(
- "gathered metric family %s has help %q but should have %q",
- mf.GetName(), mf.GetHelp(), existingMF.GetHelp(),
- ))
- continue
- }
- if existingMF.GetType() != mf.GetType() {
- errs = append(errs, fmt.Errorf(
- "gathered metric family %s has type %s but should have %s",
- mf.GetName(), mf.GetType(), existingMF.GetType(),
- ))
- continue
- }
- } else {
- existingMF = &dto.MetricFamily{}
- existingMF.Name = mf.Name
- existingMF.Help = mf.Help
- existingMF.Type = mf.Type
- if err := checkSuffixCollisions(existingMF, metricFamiliesByName); err != nil {
- errs = append(errs, err)
- continue
- }
- metricFamiliesByName[mf.GetName()] = existingMF
- }
- for _, m := range mf.Metric {
- if err := checkMetricConsistency(existingMF, m, metricHashes); err != nil {
- errs = append(errs, err)
- continue
- }
- existingMF.Metric = append(existingMF.Metric, m)
- }
- }
- }
- return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap()
-}
-
-// checkSuffixCollisions checks for collisions with the “magic” suffixes the
-// Prometheus text format and the internal metric representation of the
-// Prometheus server add while flattening Summaries and Histograms.
-func checkSuffixCollisions(mf *dto.MetricFamily, mfs map[string]*dto.MetricFamily) error {
- var (
- newName = mf.GetName()
- newType = mf.GetType()
- newNameWithoutSuffix = ""
- )
- switch {
- case strings.HasSuffix(newName, "_count"):
- newNameWithoutSuffix = newName[:len(newName)-6]
- case strings.HasSuffix(newName, "_sum"):
- newNameWithoutSuffix = newName[:len(newName)-4]
- case strings.HasSuffix(newName, "_bucket"):
- newNameWithoutSuffix = newName[:len(newName)-7]
- }
- if newNameWithoutSuffix != "" {
- if existingMF, ok := mfs[newNameWithoutSuffix]; ok {
- switch existingMF.GetType() {
- case dto.MetricType_SUMMARY:
- if !strings.HasSuffix(newName, "_bucket") {
- return fmt.Errorf(
- "collected metric named %q collides with previously collected summary named %q",
- newName, newNameWithoutSuffix,
- )
- }
- case dto.MetricType_HISTOGRAM:
- return fmt.Errorf(
- "collected metric named %q collides with previously collected histogram named %q",
- newName, newNameWithoutSuffix,
- )
- }
- }
- }
- if newType == dto.MetricType_SUMMARY || newType == dto.MetricType_HISTOGRAM {
- if _, ok := mfs[newName+"_count"]; ok {
- return fmt.Errorf(
- "collected histogram or summary named %q collides with previously collected metric named %q",
- newName, newName+"_count",
- )
- }
- if _, ok := mfs[newName+"_sum"]; ok {
- return fmt.Errorf(
- "collected histogram or summary named %q collides with previously collected metric named %q",
- newName, newName+"_sum",
- )
- }
- }
- if newType == dto.MetricType_HISTOGRAM {
- if _, ok := mfs[newName+"_bucket"]; ok {
- return fmt.Errorf(
- "collected histogram named %q collides with previously collected metric named %q",
- newName, newName+"_bucket",
- )
- }
- }
- return nil
-}
-
-// checkMetricConsistency checks if the provided Metric is consistent with the
-// provided MetricFamily. It also hashes the Metric labels and the MetricFamily
-// name. If the resulting hash is already in the provided metricHashes, an error
-// is returned. If not, it is added to metricHashes.
-func checkMetricConsistency(
- metricFamily *dto.MetricFamily,
- dtoMetric *dto.Metric,
- metricHashes map[uint64]struct{},
-) error {
- name := metricFamily.GetName()
-
- // Type consistency with metric family.
- if metricFamily.GetType() == dto.MetricType_GAUGE && dtoMetric.Gauge == nil ||
- metricFamily.GetType() == dto.MetricType_COUNTER && dtoMetric.Counter == nil ||
- metricFamily.GetType() == dto.MetricType_SUMMARY && dtoMetric.Summary == nil ||
- metricFamily.GetType() == dto.MetricType_HISTOGRAM && dtoMetric.Histogram == nil ||
- metricFamily.GetType() == dto.MetricType_UNTYPED && dtoMetric.Untyped == nil {
- return fmt.Errorf(
- "collected metric %q { %s} is not a %s",
- name, dtoMetric, metricFamily.GetType(),
- )
- }
-
- previousLabelName := ""
- for _, labelPair := range dtoMetric.GetLabel() {
- labelName := labelPair.GetName()
- if labelName == previousLabelName {
- return fmt.Errorf(
- "collected metric %q { %s} has two or more labels with the same name: %s",
- name, dtoMetric, labelName,
- )
- }
- if !checkLabelName(labelName) {
- return fmt.Errorf(
- "collected metric %q { %s} has a label with an invalid name: %s",
- name, dtoMetric, labelName,
- )
- }
- if dtoMetric.Summary != nil && labelName == quantileLabel {
- return fmt.Errorf(
- "collected metric %q { %s} must not have an explicit %q label",
- name, dtoMetric, quantileLabel,
- )
- }
- if !utf8.ValidString(labelPair.GetValue()) {
- return fmt.Errorf(
- "collected metric %q { %s} has a label named %q whose value is not utf8: %#v",
- name, dtoMetric, labelName, labelPair.GetValue())
- }
- previousLabelName = labelName
- }
-
- // Is the metric unique (i.e. no other metric with the same name and the same labels)?
- h := xxhash.New()
- h.WriteString(name)
- h.Write(separatorByteSlice)
- // Make sure label pairs are sorted. We depend on it for the consistency
- // check.
- if !sort.IsSorted(internal.LabelPairSorter(dtoMetric.Label)) {
- // We cannot sort dtoMetric.Label in place as it is immutable by contract.
- copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label))
- copy(copiedLabels, dtoMetric.Label)
- sort.Sort(internal.LabelPairSorter(copiedLabels))
- dtoMetric.Label = copiedLabels
- }
- for _, lp := range dtoMetric.Label {
- h.WriteString(lp.GetName())
- h.Write(separatorByteSlice)
- h.WriteString(lp.GetValue())
- h.Write(separatorByteSlice)
- }
- if dtoMetric.TimestampMs != nil {
- h.WriteString(strconv.FormatInt(*(dtoMetric.TimestampMs), 10))
- h.Write(separatorByteSlice)
- }
- hSum := h.Sum64()
- if _, exists := metricHashes[hSum]; exists {
- return fmt.Errorf(
- "collected metric %q { %s} was collected before with the same name and label values",
- name, dtoMetric,
- )
- }
- metricHashes[hSum] = struct{}{}
- return nil
-}
-
-func checkDescConsistency(
- metricFamily *dto.MetricFamily,
- dtoMetric *dto.Metric,
- desc *Desc,
-) error {
- // Desc help consistency with metric family help.
- if metricFamily.GetHelp() != desc.help {
- return fmt.Errorf(
- "collected metric %s %s has help %q but should have %q",
- metricFamily.GetName(), dtoMetric, metricFamily.GetHelp(), desc.help,
- )
- }
-
- // Is the desc consistent with the content of the metric?
- lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label))
- copy(lpsFromDesc, desc.constLabelPairs)
- for _, l := range desc.variableLabels.names {
- lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
- Name: proto.String(l),
- })
- }
- if len(lpsFromDesc) != len(dtoMetric.Label) {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- sort.Sort(internal.LabelPairSorter(lpsFromDesc))
- for i, lpFromDesc := range lpsFromDesc {
- lpFromMetric := dtoMetric.Label[i]
- if lpFromDesc.GetName() != lpFromMetric.GetName() ||
- lpFromDesc.Value != nil && lpFromDesc.GetValue() != lpFromMetric.GetValue() {
- return fmt.Errorf(
- "labels in collected metric %s %s are inconsistent with descriptor %s",
- metricFamily.GetName(), dtoMetric, desc,
- )
- }
- }
- return nil
-}
-
-var _ TransactionalGatherer = &MultiTRegistry{}
-
-// MultiTRegistry is a TransactionalGatherer that joins gathered metrics from multiple
-// transactional gatherers.
-//
-// It is caller responsibility to ensure two registries have mutually exclusive metric families,
-// no deduplication will happen.
-type MultiTRegistry struct {
- tGatherers []TransactionalGatherer
-}
-
-// NewMultiTRegistry creates MultiTRegistry.
-func NewMultiTRegistry(tGatherers ...TransactionalGatherer) *MultiTRegistry {
- return &MultiTRegistry{
- tGatherers: tGatherers,
- }
-}
-
-// Gather implements TransactionalGatherer interface.
-func (r *MultiTRegistry) Gather() (mfs []*dto.MetricFamily, done func(), err error) {
- errs := MultiError{}
-
- dFns := make([]func(), 0, len(r.tGatherers))
- // TODO(bwplotka): Implement concurrency for those?
- for _, g := range r.tGatherers {
- // TODO(bwplotka): Check for duplicates?
- m, d, err := g.Gather()
- errs.Append(err)
-
- mfs = append(mfs, m...)
- dFns = append(dFns, d)
- }
-
- // TODO(bwplotka): Consider sort in place, given metric family in gather is sorted already.
- sort.Slice(mfs, func(i, j int) bool {
- return *mfs[i].Name < *mfs[j].Name
- })
- return mfs, func() {
- for _, d := range dFns {
- d()
- }
- }, errs.MaybeUnwrap()
-}
-
-// TransactionalGatherer represents transactional gatherer that can be triggered to notify gatherer that memory
-// used by metric family is no longer used by a caller. This allows implementations with cache.
-type TransactionalGatherer interface {
- // Gather returns metrics in a lexicographically sorted slice
- // of uniquely named MetricFamily protobufs. Gather ensures that the
- // returned slice is valid and self-consistent so that it can be used
- // for valid exposition. As an exception to the strict consistency
- // requirements described for metric.Desc, Gather will tolerate
- // different sets of label names for metrics of the same metric family.
- //
- // Even if an error occurs, Gather attempts to gather as many metrics as
- // possible. Hence, if a non-nil error is returned, the returned
- // MetricFamily slice could be nil (in case of a fatal error that
- // prevented any meaningful metric collection) or contain a number of
- // MetricFamily protobufs, some of which might be incomplete, and some
- // might be missing altogether. The returned error (which might be a
- // MultiError) explains the details. Note that this is mostly useful for
- // debugging purposes. If the gathered protobufs are to be used for
- // exposition in actual monitoring, it is almost always better to not
- // expose an incomplete result and instead disregard the returned
- // MetricFamily protobufs in case the returned error is non-nil.
- //
- // Important: done is expected to be triggered (even if the error occurs!)
- // once caller does not need returned slice of dto.MetricFamily.
- Gather() (_ []*dto.MetricFamily, done func(), err error)
-}
-
-// ToTransactionalGatherer transforms Gatherer to transactional one with noop as done function.
-func ToTransactionalGatherer(g Gatherer) TransactionalGatherer {
- return &noTransactionGatherer{g: g}
-}
-
-type noTransactionGatherer struct {
- g Gatherer
-}
-
-// Gather implements TransactionalGatherer interface.
-func (g *noTransactionGatherer) Gather() (_ []*dto.MetricFamily, done func(), err error) {
- mfs, err := g.g.Gather()
- return mfs, func() {}, err
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go
deleted file mode 100644
index 1462704..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go
+++ /dev/null
@@ -1,785 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "math"
- "runtime"
- "sort"
- "sync"
- "sync/atomic"
- "time"
-
- dto "github.com/prometheus/client_model/go"
-
- "github.com/beorn7/perks/quantile"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/types/known/timestamppb"
-)
-
-// quantileLabel is used for the label that defines the quantile in a
-// summary.
-const quantileLabel = "quantile"
-
-// A Summary captures individual observations from an event or sample stream and
-// summarizes them in a manner similar to traditional summary statistics: 1. sum
-// of observations, 2. observation count, 3. rank estimations.
-//
-// A typical use-case is the observation of request latencies. By default, a
-// Summary provides the median, the 90th and the 99th percentile of the latency
-// as rank estimations. However, the default behavior will change in the
-// upcoming v1.0.0 of the library. There will be no rank estimations at all by
-// default. For a sane transition, it is recommended to set the desired rank
-// estimations explicitly.
-//
-// Note that the rank estimations cannot be aggregated in a meaningful way with
-// the Prometheus query language (i.e. you cannot average or add them). If you
-// need aggregatable quantiles (e.g. you want the 99th percentile latency of all
-// queries served across all instances of a service), consider the Histogram
-// metric type. See the Prometheus documentation for more details.
-//
-// To create Summary instances, use NewSummary.
-type Summary interface {
- Metric
- Collector
-
- // Observe adds a single observation to the summary. Observations are
- // usually positive or zero. Negative observations are accepted but
- // prevent current versions of Prometheus from properly detecting
- // counter resets in the sum of observations. See
- // https://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations
- // for details.
- Observe(float64)
-}
-
-var errQuantileLabelNotAllowed = fmt.Errorf(
- "%q is not allowed as label name in summaries", quantileLabel,
-)
-
-// Default values for SummaryOpts.
-const (
- // DefMaxAge is the default duration for which observations stay
- // relevant.
- DefMaxAge time.Duration = 10 * time.Minute
- // DefAgeBuckets is the default number of buckets used to calculate the
- // age of observations.
- DefAgeBuckets = 5
- // DefBufCap is the standard buffer size for collecting Summary observations.
- DefBufCap = 500
-)
-
-// SummaryOpts bundles the options for creating a Summary metric. It is
-// mandatory to set Name to a non-empty string. While all other fields are
-// optional and can safely be left at their zero value, it is recommended to set
-// a help string and to explicitly set the Objectives field to the desired value
-// as the default value will change in the upcoming v1.0.0 of the library.
-type SummaryOpts struct {
- // Namespace, Subsystem, and Name are components of the fully-qualified
- // name of the Summary (created by joining these components with
- // "_"). Only Name is mandatory, the others merely help structuring the
- // name. Note that the fully-qualified name of the Summary must be a
- // valid Prometheus metric name.
- Namespace string
- Subsystem string
- Name string
-
- // Help provides information about this Summary.
- //
- // Metrics with the same fully-qualified name must have the same Help
- // string.
- Help string
-
- // ConstLabels are used to attach fixed labels to this metric. Metrics
- // with the same fully-qualified name must have the same label names in
- // their ConstLabels.
- //
- // Due to the way a Summary is represented in the Prometheus text format
- // and how it is handled by the Prometheus server internally, “quantile”
- // is an illegal label name. Construction of a Summary or SummaryVec
- // will panic if this label name is used in ConstLabels.
- //
- // ConstLabels are only used rarely. In particular, do not use them to
- // attach the same labels to all your metrics. Those use cases are
- // better covered by target labels set by the scraping Prometheus
- // server, or by one specific metric (e.g. a build_info or a
- // machine_role metric). See also
- // https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels
- ConstLabels Labels
-
- // Objectives defines the quantile rank estimates with their respective
- // absolute error. If Objectives[q] = e, then the value reported for q
- // will be the φ-quantile value for some φ between q-e and q+e. The
- // default value is an empty map, resulting in a summary without
- // quantiles.
- Objectives map[float64]float64
-
- // MaxAge defines the duration for which an observation stays relevant
- // for the summary. Only applies to pre-calculated quantiles, does not
- // apply to _sum and _count. Must be positive. The default value is
- // DefMaxAge.
- MaxAge time.Duration
-
- // AgeBuckets is the number of buckets used to exclude observations that
- // are older than MaxAge from the summary. A higher number has a
- // resource penalty, so only increase it if the higher resolution is
- // really required. For very high observation rates, you might want to
- // reduce the number of age buckets. With only one age bucket, you will
- // effectively see a complete reset of the summary each time MaxAge has
- // passed. The default value is DefAgeBuckets.
- AgeBuckets uint32
-
- // BufCap defines the default sample stream buffer size. The default
- // value of DefBufCap should suffice for most uses. If there is a need
- // to increase the value, a multiple of 500 is recommended (because that
- // is the internal buffer size of the underlying package
- // "github.com/bmizerany/perks/quantile").
- BufCap uint32
-
- // now is for testing purposes, by default it's time.Now.
- now func() time.Time
-}
-
-// SummaryVecOpts bundles the options to create a SummaryVec metric.
-// It is mandatory to set SummaryOpts, see there for mandatory fields. VariableLabels
-// is optional and can safely be left to its default value.
-type SummaryVecOpts struct {
- SummaryOpts
-
- // VariableLabels are used to partition the metric vector by the given set
- // of labels. Each label value will be constrained with the optional Constraint
- // function, if provided.
- VariableLabels ConstrainableLabels
-}
-
-// Problem with the sliding-window decay algorithm... The Merge method of
-// perk/quantile is actually not working as advertised - and it might be
-// unfixable, as the underlying algorithm is apparently not capable of merging
-// summaries in the first place. To avoid using Merge, we are currently adding
-// observations to _each_ age bucket, i.e. the effort to add a sample is
-// essentially multiplied by the number of age buckets. When rotating age
-// buckets, we empty the previous head stream. On scrape time, we simply take
-// the quantiles from the head stream (no merging required). Result: More effort
-// on observation time, less effort on scrape time, which is exactly the
-// opposite of what we try to accomplish, but at least the results are correct.
-//
-// The quite elegant previous contraption to merge the age buckets efficiently
-// on scrape time (see code up commit 6b9530d72ea715f0ba612c0120e6e09fbf1d49d0)
-// can't be used anymore.
-
-// NewSummary creates a new Summary based on the provided SummaryOpts.
-func NewSummary(opts SummaryOpts) Summary {
- return newSummary(
- NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ),
- opts,
- )
-}
-
-func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary {
- if len(desc.variableLabels.names) != len(labelValues) {
- panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels.names, labelValues))
- }
-
- for _, n := range desc.variableLabels.names {
- if n == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
- for _, lp := range desc.constLabelPairs {
- if lp.GetName() == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
-
- if opts.Objectives == nil {
- opts.Objectives = map[float64]float64{}
- }
-
- if opts.MaxAge < 0 {
- panic(fmt.Errorf("illegal max age MaxAge=%v", opts.MaxAge))
- }
- if opts.MaxAge == 0 {
- opts.MaxAge = DefMaxAge
- }
-
- if opts.AgeBuckets == 0 {
- opts.AgeBuckets = DefAgeBuckets
- }
-
- if opts.BufCap == 0 {
- opts.BufCap = DefBufCap
- }
-
- if opts.now == nil {
- opts.now = time.Now
- }
- if len(opts.Objectives) == 0 {
- // Use the lock-free implementation of a Summary without objectives.
- s := &noObjectivesSummary{
- desc: desc,
- labelPairs: MakeLabelPairs(desc, labelValues),
- counts: [2]*summaryCounts{{}, {}},
- }
- s.init(s) // Init self-collection.
- s.createdTs = timestamppb.New(opts.now())
- return s
- }
-
- s := &summary{
- desc: desc,
-
- objectives: opts.Objectives,
- sortedObjectives: make([]float64, 0, len(opts.Objectives)),
-
- labelPairs: MakeLabelPairs(desc, labelValues),
-
- hotBuf: make([]float64, 0, opts.BufCap),
- coldBuf: make([]float64, 0, opts.BufCap),
- streamDuration: opts.MaxAge / time.Duration(opts.AgeBuckets),
- }
- s.headStreamExpTime = opts.now().Add(s.streamDuration)
- s.hotBufExpTime = s.headStreamExpTime
-
- for i := uint32(0); i < opts.AgeBuckets; i++ {
- s.streams = append(s.streams, s.newStream())
- }
- s.headStream = s.streams[0]
-
- for qu := range s.objectives {
- s.sortedObjectives = append(s.sortedObjectives, qu)
- }
- sort.Float64s(s.sortedObjectives)
-
- s.init(s) // Init self-collection.
- s.createdTs = timestamppb.New(opts.now())
- return s
-}
-
-type summary struct {
- selfCollector
-
- bufMtx sync.Mutex // Protects hotBuf and hotBufExpTime.
- mtx sync.Mutex // Protects every other moving part.
- // Lock bufMtx before mtx if both are needed.
-
- desc *Desc
-
- objectives map[float64]float64
- sortedObjectives []float64
-
- labelPairs []*dto.LabelPair
-
- sum float64
- cnt uint64
-
- hotBuf, coldBuf []float64
-
- streams []*quantile.Stream
- streamDuration time.Duration
- headStream *quantile.Stream
- headStreamIdx int
- headStreamExpTime, hotBufExpTime time.Time
-
- createdTs *timestamppb.Timestamp
-}
-
-func (s *summary) Desc() *Desc {
- return s.desc
-}
-
-func (s *summary) Observe(v float64) {
- s.bufMtx.Lock()
- defer s.bufMtx.Unlock()
-
- now := time.Now()
- if now.After(s.hotBufExpTime) {
- s.asyncFlush(now)
- }
- s.hotBuf = append(s.hotBuf, v)
- if len(s.hotBuf) == cap(s.hotBuf) {
- s.asyncFlush(now)
- }
-}
-
-func (s *summary) Write(out *dto.Metric) error {
- sum := &dto.Summary{
- CreatedTimestamp: s.createdTs,
- }
- qs := make([]*dto.Quantile, 0, len(s.objectives))
-
- s.bufMtx.Lock()
- s.mtx.Lock()
- // Swap bufs even if hotBuf is empty to set new hotBufExpTime.
- s.swapBufs(time.Now())
- s.bufMtx.Unlock()
-
- s.flushColdBuf()
- sum.SampleCount = proto.Uint64(s.cnt)
- sum.SampleSum = proto.Float64(s.sum)
-
- for _, rank := range s.sortedObjectives {
- var q float64
- if s.headStream.Count() == 0 {
- q = math.NaN()
- } else {
- q = s.headStream.Query(rank)
- }
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- s.mtx.Unlock()
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
- return nil
-}
-
-func (s *summary) newStream() *quantile.Stream {
- return quantile.NewTargeted(s.objectives)
-}
-
-// asyncFlush needs bufMtx locked.
-func (s *summary) asyncFlush(now time.Time) {
- s.mtx.Lock()
- s.swapBufs(now)
-
- // Unblock the original goroutine that was responsible for the mutation
- // that triggered the compaction. But hold onto the global non-buffer
- // state mutex until the operation finishes.
- go func() {
- s.flushColdBuf()
- s.mtx.Unlock()
- }()
-}
-
-// rotateStreams needs mtx AND bufMtx locked.
-func (s *summary) maybeRotateStreams() {
- for !s.hotBufExpTime.Equal(s.headStreamExpTime) {
- s.headStream.Reset()
- s.headStreamIdx++
- if s.headStreamIdx >= len(s.streams) {
- s.headStreamIdx = 0
- }
- s.headStream = s.streams[s.headStreamIdx]
- s.headStreamExpTime = s.headStreamExpTime.Add(s.streamDuration)
- }
-}
-
-// flushColdBuf needs mtx locked.
-func (s *summary) flushColdBuf() {
- for _, v := range s.coldBuf {
- for _, stream := range s.streams {
- stream.Insert(v)
- }
- s.cnt++
- s.sum += v
- }
- s.coldBuf = s.coldBuf[0:0]
- s.maybeRotateStreams()
-}
-
-// swapBufs needs mtx AND bufMtx locked, coldBuf must be empty.
-func (s *summary) swapBufs(now time.Time) {
- if len(s.coldBuf) != 0 {
- panic("coldBuf is not empty")
- }
- s.hotBuf, s.coldBuf = s.coldBuf, s.hotBuf
- // hotBuf is now empty and gets new expiration set.
- for now.After(s.hotBufExpTime) {
- s.hotBufExpTime = s.hotBufExpTime.Add(s.streamDuration)
- }
-}
-
-type summaryCounts struct {
- // sumBits contains the bits of the float64 representing the sum of all
- // observations. sumBits and count have to go first in the struct to
- // guarantee alignment for atomic operations.
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- sumBits uint64
- count uint64
-}
-
-type noObjectivesSummary struct {
- // countAndHotIdx enables lock-free writes with use of atomic updates.
- // The most significant bit is the hot index [0 or 1] of the count field
- // below. Observe calls update the hot one. All remaining bits count the
- // number of Observe calls. Observe starts by incrementing this counter,
- // and finish by incrementing the count field in the respective
- // summaryCounts, as a marker for completion.
- //
- // Calls of the Write method (which are non-mutating reads from the
- // perspective of the summary) swap the hot–cold under the writeMtx
- // lock. A cooldown is awaited (while locked) by comparing the number of
- // observations with the initiation count. Once they match, then the
- // last observation on the now cool one has completed. All cool fields must
- // be merged into the new hot before releasing writeMtx.
-
- // Fields with atomic access first! See alignment constraint:
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG
- countAndHotIdx uint64
-
- selfCollector
- desc *Desc
- writeMtx sync.Mutex // Only used in the Write method.
-
- // Two counts, one is "hot" for lock-free observations, the other is
- // "cold" for writing out a dto.Metric. It has to be an array of
- // pointers to guarantee 64bit alignment of the histogramCounts, see
- // http://golang.org/pkg/sync/atomic/#pkg-note-BUG.
- counts [2]*summaryCounts
-
- labelPairs []*dto.LabelPair
-
- createdTs *timestamppb.Timestamp
-}
-
-func (s *noObjectivesSummary) Desc() *Desc {
- return s.desc
-}
-
-func (s *noObjectivesSummary) Observe(v float64) {
- // We increment h.countAndHotIdx so that the counter in the lower
- // 63 bits gets incremented. At the same time, we get the new value
- // back, which we can use to find the currently-hot counts.
- n := atomic.AddUint64(&s.countAndHotIdx, 1)
- hotCounts := s.counts[n>>63]
-
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + v)
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- break
- }
- }
- // Increment count last as we take it as a signal that the observation
- // is complete.
- atomic.AddUint64(&hotCounts.count, 1)
-}
-
-func (s *noObjectivesSummary) Write(out *dto.Metric) error {
- // For simplicity, we protect this whole method by a mutex. It is not in
- // the hot path, i.e. Observe is called much more often than Write. The
- // complication of making Write lock-free isn't worth it, if possible at
- // all.
- s.writeMtx.Lock()
- defer s.writeMtx.Unlock()
-
- // Adding 1<<63 switches the hot index (from 0 to 1 or from 1 to 0)
- // without touching the count bits. See the struct comments for a full
- // description of the algorithm.
- n := atomic.AddUint64(&s.countAndHotIdx, 1<<63)
- // count is contained unchanged in the lower 63 bits.
- count := n & ((1 << 63) - 1)
- // The most significant bit tells us which counts is hot. The complement
- // is thus the cold one.
- hotCounts := s.counts[n>>63]
- coldCounts := s.counts[(^n)>>63]
-
- // Await cooldown.
- for count != atomic.LoadUint64(&coldCounts.count) {
- runtime.Gosched() // Let observations get work done.
- }
-
- sum := &dto.Summary{
- SampleCount: proto.Uint64(count),
- SampleSum: proto.Float64(math.Float64frombits(atomic.LoadUint64(&coldCounts.sumBits))),
- CreatedTimestamp: s.createdTs,
- }
-
- out.Summary = sum
- out.Label = s.labelPairs
-
- // Finally add all the cold counts to the new hot counts and reset the cold counts.
- atomic.AddUint64(&hotCounts.count, count)
- atomic.StoreUint64(&coldCounts.count, 0)
- for {
- oldBits := atomic.LoadUint64(&hotCounts.sumBits)
- newBits := math.Float64bits(math.Float64frombits(oldBits) + sum.GetSampleSum())
- if atomic.CompareAndSwapUint64(&hotCounts.sumBits, oldBits, newBits) {
- atomic.StoreUint64(&coldCounts.sumBits, 0)
- break
- }
- }
- return nil
-}
-
-type quantSort []*dto.Quantile
-
-func (s quantSort) Len() int {
- return len(s)
-}
-
-func (s quantSort) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s quantSort) Less(i, j int) bool {
- return s[i].GetQuantile() < s[j].GetQuantile()
-}
-
-// SummaryVec is a Collector that bundles a set of Summaries that all share the
-// same Desc, but have different values for their variable labels. This is used
-// if you want to count the same thing partitioned by various dimensions
-// (e.g. HTTP request latencies, partitioned by status code and method). Create
-// instances with NewSummaryVec.
-type SummaryVec struct {
- *MetricVec
-}
-
-// NewSummaryVec creates a new SummaryVec based on the provided SummaryOpts and
-// partitioned by the given label names.
-//
-// Due to the way a Summary is represented in the Prometheus text format and how
-// it is handled by the Prometheus server internally, “quantile” is an illegal
-// label name. NewSummaryVec will panic if this label name is used.
-func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec {
- return V2.NewSummaryVec(SummaryVecOpts{
- SummaryOpts: opts,
- VariableLabels: UnconstrainedLabels(labelNames),
- })
-}
-
-// NewSummaryVec creates a new SummaryVec based on the provided SummaryVecOpts.
-func (v2) NewSummaryVec(opts SummaryVecOpts) *SummaryVec {
- for _, ln := range opts.VariableLabels.labelNames() {
- if ln == quantileLabel {
- panic(errQuantileLabelNotAllowed)
- }
- }
- desc := V2.NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- opts.VariableLabels,
- opts.ConstLabels,
- )
- return &SummaryVec{
- MetricVec: NewMetricVec(desc, func(lvs ...string) Metric {
- return newSummary(desc, opts.SummaryOpts, lvs...)
- }),
- }
-}
-
-// GetMetricWithLabelValues returns the Summary for the given slice of label
-// values (same order as the variable labels in Desc). If that combination of
-// label values is accessed for the first time, a new Summary is created.
-//
-// It is possible to call this method without using the returned Summary to only
-// create the new Summary but leave it at its starting value, a Summary without
-// any observations.
-//
-// Keeping the Summary for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Summary from the SummaryVec. In that case,
-// the Summary will still exist, but it will not be exported anymore, even if a
-// Summary with the same label values is created later. See also the CounterVec
-// example.
-//
-// An error is returned if the number of label values is not the same as the
-// number of variable labels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the GaugeVec example.
-func (v *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) {
- metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// GetMetricWith returns the Summary for the given Labels map (the label names
-// must match those of the variable labels in Desc). If that label map is
-// accessed for the first time, a new Summary is created. Implications of
-// creating a Summary without using it and keeping the Summary for later use are
-// the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the variable labels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) {
- metric, err := v.MetricVec.GetMetricWith(labels)
- if metric != nil {
- return metric.(Observer), err
- }
- return nil, err
-}
-
-// WithLabelValues works as GetMetricWithLabelValues, but panics where
-// GetMetricWithLabelValues would have returned an error. Not returning an
-// error allows shortcuts like
-//
-// myVec.WithLabelValues("404", "GET").Observe(42.21)
-func (v *SummaryVec) WithLabelValues(lvs ...string) Observer {
- s, err := v.GetMetricWithLabelValues(lvs...)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-// With works as GetMetricWith, but panics where GetMetricWithLabels would have
-// returned an error. Not returning an error allows shortcuts like
-//
-// myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Observe(42.21)
-func (v *SummaryVec) With(labels Labels) Observer {
- s, err := v.GetMetricWith(labels)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the SummaryVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) {
- vec, err := v.MetricVec.CurryWith(labels)
- if vec != nil {
- return &SummaryVec{vec}, err
- }
- return nil, err
-}
-
-// MustCurryWith works as CurryWith but panics where CurryWith would have
-// returned an error.
-func (v *SummaryVec) MustCurryWith(labels Labels) ObserverVec {
- vec, err := v.CurryWith(labels)
- if err != nil {
- panic(err)
- }
- return vec
-}
-
-type constSummary struct {
- desc *Desc
- count uint64
- sum float64
- quantiles map[float64]float64
- labelPairs []*dto.LabelPair
- createdTs *timestamppb.Timestamp
-}
-
-func (s *constSummary) Desc() *Desc {
- return s.desc
-}
-
-func (s *constSummary) Write(out *dto.Metric) error {
- sum := &dto.Summary{
- CreatedTimestamp: s.createdTs,
- }
- qs := make([]*dto.Quantile, 0, len(s.quantiles))
-
- sum.SampleCount = proto.Uint64(s.count)
- sum.SampleSum = proto.Float64(s.sum)
-
- for rank, q := range s.quantiles {
- qs = append(qs, &dto.Quantile{
- Quantile: proto.Float64(rank),
- Value: proto.Float64(q),
- })
- }
-
- if len(qs) > 0 {
- sort.Sort(quantSort(qs))
- }
- sum.Quantile = qs
-
- out.Summary = sum
- out.Label = s.labelPairs
-
- return nil
-}
-
-// NewConstSummary returns a metric representing a Prometheus summary with fixed
-// values for the count, sum, and quantiles. As those parameters cannot be
-// changed, the returned value does not implement the Summary interface (but
-// only the Metric interface). Users of this package will not have much use for
-// it in regular operations. However, when implementing custom Collectors, it is
-// useful as a throw-away metric that is generated on the fly to send it to
-// Prometheus in the Collect method.
-//
-// quantiles maps ranks to quantile values. For example, a median latency of
-// 0.23s and a 99th percentile latency of 0.56s would be expressed as:
-//
-// map[float64]float64{0.5: 0.23, 0.99: 0.56}
-//
-// NewConstSummary returns an error if the length of labelValues is not
-// consistent with the variable labels in Desc or if Desc is invalid.
-func NewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil {
- return nil, err
- }
- return &constSummary{
- desc: desc,
- count: count,
- sum: sum,
- quantiles: quantiles,
- labelPairs: MakeLabelPairs(desc, labelValues),
- }, nil
-}
-
-// MustNewConstSummary is a version of NewConstSummary that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstSummary(
- desc *Desc,
- count uint64,
- sum float64,
- quantiles map[float64]float64,
- labelValues ...string,
-) Metric {
- m, err := NewConstSummary(desc, count, sum, quantiles, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/timer.go b/vendor/github.com/prometheus/client_golang/prometheus/timer.go
deleted file mode 100644
index 52344fe..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/timer.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2016 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import "time"
-
-// Timer is a helper type to time functions. Use NewTimer to create new
-// instances.
-type Timer struct {
- begin time.Time
- observer Observer
-}
-
-// NewTimer creates a new Timer. The provided Observer is used to observe a
-// duration in seconds. If the Observer implements ExemplarObserver, passing exemplar
-// later on will be also supported.
-// Timer is usually used to time a function call in the
-// following way:
-//
-// func TimeMe() {
-// timer := NewTimer(myHistogram)
-// defer timer.ObserveDuration()
-// // Do actual work.
-// }
-//
-// or
-//
-// func TimeMeWithExemplar() {
-// timer := NewTimer(myHistogram)
-// defer timer.ObserveDurationWithExemplar(exemplar)
-// // Do actual work.
-// }
-func NewTimer(o Observer) *Timer {
- return &Timer{
- begin: time.Now(),
- observer: o,
- }
-}
-
-// ObserveDuration records the duration passed since the Timer was created with
-// NewTimer. It calls the Observe method of the Observer provided during
-// construction with the duration in seconds as an argument. The observed
-// duration is also returned. ObserveDuration is usually called with a defer
-// statement.
-//
-// Note that this method is only guaranteed to never observe negative durations
-// if used with Go1.9+.
-func (t *Timer) ObserveDuration() time.Duration {
- d := time.Since(t.begin)
- if t.observer != nil {
- t.observer.Observe(d.Seconds())
- }
- return d
-}
-
-// ObserveDurationWithExemplar is like ObserveDuration, but it will also
-// observe exemplar with the duration unless exemplar is nil or provided Observer can't
-// be casted to ExemplarObserver.
-func (t *Timer) ObserveDurationWithExemplar(exemplar Labels) time.Duration {
- d := time.Since(t.begin)
- eo, ok := t.observer.(ExemplarObserver)
- if ok && exemplar != nil {
- eo.ObserveWithExemplar(d.Seconds(), exemplar)
- return d
- }
- if t.observer != nil {
- t.observer.Observe(d.Seconds())
- }
- return d
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go b/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
deleted file mode 100644
index 0f9ce63..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/untyped.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-// UntypedOpts is an alias for Opts. See there for doc comments.
-type UntypedOpts Opts
-
-// UntypedFunc works like GaugeFunc but the collected metric is of type
-// "Untyped". UntypedFunc is useful to mirror an external metric of unknown
-// type.
-//
-// To create UntypedFunc instances, use NewUntypedFunc.
-type UntypedFunc interface {
- Metric
- Collector
-}
-
-// NewUntypedFunc creates a new UntypedFunc based on the provided
-// UntypedOpts. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where an UntypedFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func NewUntypedFunc(opts UntypedOpts, function func() float64) UntypedFunc {
- return newValueFunc(NewDesc(
- BuildFQName(opts.Namespace, opts.Subsystem, opts.Name),
- opts.Help,
- nil,
- opts.ConstLabels,
- ), UntypedValue, function)
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/value.go b/vendor/github.com/prometheus/client_golang/prometheus/value.go
deleted file mode 100644
index cc23011..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/value.go
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "errors"
- "fmt"
- "sort"
- "time"
- "unicode/utf8"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/types/known/timestamppb"
-)
-
-// ValueType is an enumeration of metric types that represent a simple value.
-type ValueType int
-
-// Possible values for the ValueType enum. Use UntypedValue to mark a metric
-// with an unknown type.
-const (
- _ ValueType = iota
- CounterValue
- GaugeValue
- UntypedValue
-)
-
-var (
- CounterMetricTypePtr = func() *dto.MetricType { d := dto.MetricType_COUNTER; return &d }()
- GaugeMetricTypePtr = func() *dto.MetricType { d := dto.MetricType_GAUGE; return &d }()
- UntypedMetricTypePtr = func() *dto.MetricType { d := dto.MetricType_UNTYPED; return &d }()
-)
-
-func (v ValueType) ToDTO() *dto.MetricType {
- switch v {
- case CounterValue:
- return CounterMetricTypePtr
- case GaugeValue:
- return GaugeMetricTypePtr
- default:
- return UntypedMetricTypePtr
- }
-}
-
-// valueFunc is a generic metric for simple values retrieved on collect time
-// from a function. It implements Metric and Collector. Its effective type is
-// determined by ValueType. This is a low-level building block used by the
-// library to back the implementations of CounterFunc, GaugeFunc, and
-// UntypedFunc.
-type valueFunc struct {
- selfCollector
-
- desc *Desc
- valType ValueType
- function func() float64
- labelPairs []*dto.LabelPair
-}
-
-// newValueFunc returns a newly allocated valueFunc with the given Desc and
-// ValueType. The value reported is determined by calling the given function
-// from within the Write method. Take into account that metric collection may
-// happen concurrently. If that results in concurrent calls to Write, like in
-// the case where a valueFunc is directly registered with Prometheus, the
-// provided function must be concurrency-safe.
-func newValueFunc(desc *Desc, valueType ValueType, function func() float64) *valueFunc {
- result := &valueFunc{
- desc: desc,
- valType: valueType,
- function: function,
- labelPairs: MakeLabelPairs(desc, nil),
- }
- result.init(result)
- return result
-}
-
-func (v *valueFunc) Desc() *Desc {
- return v.desc
-}
-
-func (v *valueFunc) Write(out *dto.Metric) error {
- return populateMetric(v.valType, v.function(), v.labelPairs, nil, out, nil)
-}
-
-// NewConstMetric returns a metric with one fixed value that cannot be
-// changed. Users of this package will not have much use for it in regular
-// operations. However, when implementing custom Collectors, it is useful as a
-// throw-away metric that is generated on the fly to send it to Prometheus in
-// the Collect method. NewConstMetric returns an error if the length of
-// labelValues is not consistent with the variable labels in Desc or if Desc is
-// invalid.
-func NewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil {
- return nil, err
- }
-
- metric := &dto.Metric{}
- if err := populateMetric(valueType, value, MakeLabelPairs(desc, labelValues), nil, metric, nil); err != nil {
- return nil, err
- }
-
- return &constMetric{
- desc: desc,
- metric: metric,
- }, nil
-}
-
-// MustNewConstMetric is a version of NewConstMetric that panics where
-// NewConstMetric would have returned an error.
-func MustNewConstMetric(desc *Desc, valueType ValueType, value float64, labelValues ...string) Metric {
- m, err := NewConstMetric(desc, valueType, value, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-// NewConstMetricWithCreatedTimestamp does the same thing as NewConstMetric, but generates Counters
-// with created timestamp set and returns an error for other metric types.
-func NewConstMetricWithCreatedTimestamp(desc *Desc, valueType ValueType, value float64, ct time.Time, labelValues ...string) (Metric, error) {
- if desc.err != nil {
- return nil, desc.err
- }
- if err := validateLabelValues(labelValues, len(desc.variableLabels.names)); err != nil {
- return nil, err
- }
- switch valueType {
- case CounterValue:
- break
- default:
- return nil, errors.New("created timestamps are only supported for counters")
- }
-
- metric := &dto.Metric{}
- if err := populateMetric(valueType, value, MakeLabelPairs(desc, labelValues), nil, metric, timestamppb.New(ct)); err != nil {
- return nil, err
- }
-
- return &constMetric{
- desc: desc,
- metric: metric,
- }, nil
-}
-
-// MustNewConstMetricWithCreatedTimestamp is a version of NewConstMetricWithCreatedTimestamp that panics where
-// NewConstMetricWithCreatedTimestamp would have returned an error.
-func MustNewConstMetricWithCreatedTimestamp(desc *Desc, valueType ValueType, value float64, ct time.Time, labelValues ...string) Metric {
- m, err := NewConstMetricWithCreatedTimestamp(desc, valueType, value, ct, labelValues...)
- if err != nil {
- panic(err)
- }
- return m
-}
-
-type constMetric struct {
- desc *Desc
- metric *dto.Metric
-}
-
-func (m *constMetric) Desc() *Desc {
- return m.desc
-}
-
-func (m *constMetric) Write(out *dto.Metric) error {
- out.Label = m.metric.Label
- out.Counter = m.metric.Counter
- out.Gauge = m.metric.Gauge
- out.Untyped = m.metric.Untyped
- return nil
-}
-
-func populateMetric(
- t ValueType,
- v float64,
- labelPairs []*dto.LabelPair,
- e *dto.Exemplar,
- m *dto.Metric,
- ct *timestamppb.Timestamp,
-) error {
- m.Label = labelPairs
- switch t {
- case CounterValue:
- m.Counter = &dto.Counter{Value: proto.Float64(v), Exemplar: e, CreatedTimestamp: ct}
- case GaugeValue:
- m.Gauge = &dto.Gauge{Value: proto.Float64(v)}
- case UntypedValue:
- m.Untyped = &dto.Untyped{Value: proto.Float64(v)}
- default:
- return fmt.Errorf("encountered unknown type %v", t)
- }
- return nil
-}
-
-// MakeLabelPairs is a helper function to create protobuf LabelPairs from the
-// variable and constant labels in the provided Desc. The values for the
-// variable labels are defined by the labelValues slice, which must be in the
-// same order as the corresponding variable labels in the Desc.
-//
-// This function is only needed for custom Metric implementations. See MetricVec
-// example.
-func MakeLabelPairs(desc *Desc, labelValues []string) []*dto.LabelPair {
- totalLen := len(desc.variableLabels.names) + len(desc.constLabelPairs)
- if totalLen == 0 {
- // Super fast path.
- return nil
- }
- if len(desc.variableLabels.names) == 0 {
- // Moderately fast path.
- return desc.constLabelPairs
- }
- labelPairs := make([]*dto.LabelPair, 0, totalLen)
- for i, l := range desc.variableLabels.names {
- labelPairs = append(labelPairs, &dto.LabelPair{
- Name: proto.String(l),
- Value: proto.String(labelValues[i]),
- })
- }
- labelPairs = append(labelPairs, desc.constLabelPairs...)
- sort.Sort(internal.LabelPairSorter(labelPairs))
- return labelPairs
-}
-
-// ExemplarMaxRunes is the max total number of runes allowed in exemplar labels.
-const ExemplarMaxRunes = 128
-
-// newExemplar creates a new dto.Exemplar from the provided values. An error is
-// returned if any of the label names or values are invalid or if the total
-// number of runes in the label names and values exceeds ExemplarMaxRunes.
-func newExemplar(value float64, ts time.Time, l Labels) (*dto.Exemplar, error) {
- e := &dto.Exemplar{}
- e.Value = proto.Float64(value)
- tsProto := timestamppb.New(ts)
- if err := tsProto.CheckValid(); err != nil {
- return nil, err
- }
- e.Timestamp = tsProto
- labelPairs := make([]*dto.LabelPair, 0, len(l))
- var runes int
- for name, value := range l {
- if !checkLabelName(name) {
- return nil, fmt.Errorf("exemplar label name %q is invalid", name)
- }
- runes += utf8.RuneCountInString(name)
- if !utf8.ValidString(value) {
- return nil, fmt.Errorf("exemplar label value %q is not valid UTF-8", value)
- }
- runes += utf8.RuneCountInString(value)
- labelPairs = append(labelPairs, &dto.LabelPair{
- Name: proto.String(name),
- Value: proto.String(value),
- })
- }
- if runes > ExemplarMaxRunes {
- return nil, fmt.Errorf("exemplar labels have %d runes, exceeding the limit of %d", runes, ExemplarMaxRunes)
- }
- e.Label = labelPairs
- return e, nil
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vec.go b/vendor/github.com/prometheus/client_golang/prometheus/vec.go
deleted file mode 100644
index 955cfd5..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/vec.go
+++ /dev/null
@@ -1,709 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sync"
-
- "github.com/prometheus/common/model"
-)
-
-// MetricVec is a Collector to bundle metrics of the same name that differ in
-// their label values. MetricVec is not used directly but as a building block
-// for implementations of vectors of a given metric type, like GaugeVec,
-// CounterVec, SummaryVec, and HistogramVec. It is exported so that it can be
-// used for custom Metric implementations.
-//
-// To create a FooVec for custom Metric Foo, embed a pointer to MetricVec in
-// FooVec and initialize it with NewMetricVec. Implement wrappers for
-// GetMetricWithLabelValues and GetMetricWith that return (Foo, error) rather
-// than (Metric, error). Similarly, create a wrapper for CurryWith that returns
-// (*FooVec, error) rather than (*MetricVec, error). It is recommended to also
-// add the convenience methods WithLabelValues, With, and MustCurryWith, which
-// panic instead of returning errors. See also the MetricVec example.
-type MetricVec struct {
- *metricMap
-
- curry []curriedLabelValue
-
- // hashAdd and hashAddByte can be replaced for testing collision handling.
- hashAdd func(h uint64, s string) uint64
- hashAddByte func(h uint64, b byte) uint64
-}
-
-// NewMetricVec returns an initialized metricVec.
-func NewMetricVec(desc *Desc, newMetric func(lvs ...string) Metric) *MetricVec {
- return &MetricVec{
- metricMap: &metricMap{
- metrics: map[uint64][]metricWithLabelValues{},
- desc: desc,
- newMetric: newMetric,
- },
- hashAdd: hashAdd,
- hashAddByte: hashAddByte,
- }
-}
-
-// DeleteLabelValues removes the metric where the variable labels are the same
-// as those passed in as labels (same order as the VariableLabels in Desc). It
-// returns true if a metric was deleted.
-//
-// It is not an error if the number of label values is not the same as the
-// number of VariableLabels in Desc. However, such inconsistent label count can
-// never match an actual metric, so the method will always return false in that
-// case.
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider Delete(Labels) as an
-// alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-// See also the CounterVec example.
-func (m *MetricVec) DeleteLabelValues(lvs ...string) bool {
- lvs = constrainLabelValues(m.desc, lvs, m.curry)
-
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return false
- }
-
- return m.metricMap.deleteByHashWithLabelValues(h, lvs, m.curry)
-}
-
-// Delete deletes the metric where the variable labels are the same as those
-// passed in as labels. It returns true if a metric was deleted.
-//
-// It is not an error if the number and names of the Labels are inconsistent
-// with those of the VariableLabels in Desc. However, such inconsistent Labels
-// can never match an actual metric, so the method will always return false in
-// that case.
-//
-// This method is used for the same purpose as DeleteLabelValues(...string). See
-// there for pros and cons of the two methods.
-func (m *MetricVec) Delete(labels Labels) bool {
- labels, closer := constrainLabels(m.desc, labels)
- defer closer()
-
- h, err := m.hashLabels(labels)
- if err != nil {
- return false
- }
-
- return m.metricMap.deleteByHashWithLabels(h, labels, m.curry)
-}
-
-// DeletePartialMatch deletes all metrics where the variable labels contain all of those
-// passed in as labels. The order of the labels does not matter.
-// It returns the number of metrics deleted.
-//
-// Note that curried labels will never be matched if deleting from the curried vector.
-// To match curried labels with DeletePartialMatch, it must be called on the base vector.
-func (m *MetricVec) DeletePartialMatch(labels Labels) int {
- labels, closer := constrainLabels(m.desc, labels)
- defer closer()
-
- return m.metricMap.deleteByLabels(labels, m.curry)
-}
-
-// Without explicit forwarding of Describe, Collect, Reset, those methods won't
-// show up in GoDoc.
-
-// Describe implements Collector.
-func (m *MetricVec) Describe(ch chan<- *Desc) { m.metricMap.Describe(ch) }
-
-// Collect implements Collector.
-func (m *MetricVec) Collect(ch chan<- Metric) { m.metricMap.Collect(ch) }
-
-// Reset deletes all metrics in this vector.
-func (m *MetricVec) Reset() { m.metricMap.Reset() }
-
-// CurryWith returns a vector curried with the provided labels, i.e. the
-// returned vector has those labels pre-set for all labeled operations performed
-// on it. The cardinality of the curried vector is reduced accordingly. The
-// order of the remaining labels stays the same (just with the curried labels
-// taken out of the sequence – which is relevant for the
-// (GetMetric)WithLabelValues methods). It is possible to curry a curried
-// vector, but only with labels not yet used for currying before.
-//
-// The metrics contained in the MetricVec are shared between the curried and
-// uncurried vectors. They are just accessed differently. Curried and uncurried
-// vectors behave identically in terms of collection. Only one must be
-// registered with a given registry (usually the uncurried version). The Reset
-// method deletes all metrics, even if called on a curried vector.
-//
-// Note that CurryWith is usually not called directly but through a wrapper
-// around MetricVec, implementing a vector for a specific Metric
-// implementation, for example GaugeVec.
-func (m *MetricVec) CurryWith(labels Labels) (*MetricVec, error) {
- var (
- newCurry []curriedLabelValue
- oldCurry = m.curry
- iCurry int
- )
- for i, labelName := range m.desc.variableLabels.names {
- val, ok := labels[labelName]
- if iCurry < len(oldCurry) && oldCurry[iCurry].index == i {
- if ok {
- return nil, fmt.Errorf("label name %q is already curried", labelName)
- }
- newCurry = append(newCurry, oldCurry[iCurry])
- iCurry++
- } else {
- if !ok {
- continue // Label stays uncurried.
- }
- newCurry = append(newCurry, curriedLabelValue{
- i,
- m.desc.variableLabels.constrain(labelName, val),
- })
- }
- }
- if l := len(oldCurry) + len(labels) - len(newCurry); l > 0 {
- return nil, fmt.Errorf("%d unknown label(s) found during currying", l)
- }
-
- return &MetricVec{
- metricMap: m.metricMap,
- curry: newCurry,
- hashAdd: m.hashAdd,
- hashAddByte: m.hashAddByte,
- }, nil
-}
-
-// GetMetricWithLabelValues returns the Metric for the given slice of label
-// values (same order as the variable labels in Desc). If that combination of
-// label values is accessed for the first time, a new Metric is created (by
-// calling the newMetric function provided during construction of the
-// MetricVec).
-//
-// It is possible to call this method without using the returned Metric to only
-// create the new Metric but leave it in its initial state.
-//
-// Keeping the Metric for later use is possible (and should be considered if
-// performance is critical), but keep in mind that Reset, DeleteLabelValues and
-// Delete can be used to delete the Metric from the MetricVec. In that case, the
-// Metric will still exist, but it will not be exported anymore, even if a
-// Metric with the same label values is created later.
-//
-// An error is returned if the number of label values is not the same as the
-// number of variable labels in Desc (minus any curried labels).
-//
-// Note that for more than one label value, this method is prone to mistakes
-// caused by an incorrect order of arguments. Consider GetMetricWith(Labels) as
-// an alternative to avoid that type of mistake. For higher label numbers, the
-// latter has a much more readable (albeit more verbose) syntax, but it comes
-// with a performance overhead (for creating and processing the Labels map).
-//
-// Note that GetMetricWithLabelValues is usually not called directly but through
-// a wrapper around MetricVec, implementing a vector for a specific Metric
-// implementation, for example GaugeVec.
-func (m *MetricVec) GetMetricWithLabelValues(lvs ...string) (Metric, error) {
- lvs = constrainLabelValues(m.desc, lvs, m.curry)
- h, err := m.hashLabelValues(lvs)
- if err != nil {
- return nil, err
- }
-
- return m.metricMap.getOrCreateMetricWithLabelValues(h, lvs, m.curry), nil
-}
-
-// GetMetricWith returns the Metric for the given Labels map (the label names
-// must match those of the variable labels in Desc). If that label map is
-// accessed for the first time, a new Metric is created. Implications of
-// creating a Metric without using it and keeping the Metric for later use
-// are the same as for GetMetricWithLabelValues.
-//
-// An error is returned if the number and names of the Labels are inconsistent
-// with those of the variable labels in Desc (minus any curried labels).
-//
-// This method is used for the same purpose as
-// GetMetricWithLabelValues(...string). See there for pros and cons of the two
-// methods.
-//
-// Note that GetMetricWith is usually not called directly but through a wrapper
-// around MetricVec, implementing a vector for a specific Metric implementation,
-// for example GaugeVec.
-func (m *MetricVec) GetMetricWith(labels Labels) (Metric, error) {
- labels, closer := constrainLabels(m.desc, labels)
- defer closer()
-
- h, err := m.hashLabels(labels)
- if err != nil {
- return nil, err
- }
-
- return m.metricMap.getOrCreateMetricWithLabels(h, labels, m.curry), nil
-}
-
-func (m *MetricVec) hashLabelValues(vals []string) (uint64, error) {
- if err := validateLabelValues(vals, len(m.desc.variableLabels.names)-len(m.curry)); err != nil {
- return 0, err
- }
-
- var (
- h = hashNew()
- curry = m.curry
- iVals, iCurry int
- )
- for i := 0; i < len(m.desc.variableLabels.names); i++ {
- if iCurry < len(curry) && curry[iCurry].index == i {
- h = m.hashAdd(h, curry[iCurry].value)
- iCurry++
- } else {
- h = m.hashAdd(h, vals[iVals])
- iVals++
- }
- h = m.hashAddByte(h, model.SeparatorByte)
- }
- return h, nil
-}
-
-func (m *MetricVec) hashLabels(labels Labels) (uint64, error) {
- if err := validateValuesInLabels(labels, len(m.desc.variableLabels.names)-len(m.curry)); err != nil {
- return 0, err
- }
-
- var (
- h = hashNew()
- curry = m.curry
- iCurry int
- )
- for i, labelName := range m.desc.variableLabels.names {
- val, ok := labels[labelName]
- if iCurry < len(curry) && curry[iCurry].index == i {
- if ok {
- return 0, fmt.Errorf("label name %q is already curried", labelName)
- }
- h = m.hashAdd(h, curry[iCurry].value)
- iCurry++
- } else {
- if !ok {
- return 0, fmt.Errorf("label name %q missing in label map", labelName)
- }
- h = m.hashAdd(h, val)
- }
- h = m.hashAddByte(h, model.SeparatorByte)
- }
- return h, nil
-}
-
-// metricWithLabelValues provides the metric and its label values for
-// disambiguation on hash collision.
-type metricWithLabelValues struct {
- values []string
- metric Metric
-}
-
-// curriedLabelValue sets the curried value for a label at the given index.
-type curriedLabelValue struct {
- index int
- value string
-}
-
-// metricMap is a helper for metricVec and shared between differently curried
-// metricVecs.
-type metricMap struct {
- mtx sync.RWMutex // Protects metrics.
- metrics map[uint64][]metricWithLabelValues
- desc *Desc
- newMetric func(labelValues ...string) Metric
-}
-
-// Describe implements Collector. It will send exactly one Desc to the provided
-// channel.
-func (m *metricMap) Describe(ch chan<- *Desc) {
- ch <- m.desc
-}
-
-// Collect implements Collector.
-func (m *metricMap) Collect(ch chan<- Metric) {
- m.mtx.RLock()
- defer m.mtx.RUnlock()
-
- for _, metrics := range m.metrics {
- for _, metric := range metrics {
- ch <- metric.metric
- }
- }
-}
-
-// Reset deletes all metrics in this vector.
-func (m *metricMap) Reset() {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- for h := range m.metrics {
- delete(m.metrics, h)
- }
-}
-
-// deleteByHashWithLabelValues removes the metric from the hash bucket h. If
-// there are multiple matches in the bucket, use lvs to select a metric and
-// remove only that metric.
-func (m *metricMap) deleteByHashWithLabelValues(
- h uint64, lvs []string, curry []curriedLabelValue,
-) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- metrics, ok := m.metrics[h]
- if !ok {
- return false
- }
-
- i := findMetricWithLabelValues(metrics, lvs, curry)
- if i >= len(metrics) {
- return false
- }
-
- if len(metrics) > 1 {
- old := metrics
- m.metrics[h] = append(metrics[:i], metrics[i+1:]...)
- old[len(old)-1] = metricWithLabelValues{}
- } else {
- delete(m.metrics, h)
- }
- return true
-}
-
-// deleteByHashWithLabels removes the metric from the hash bucket h. If there
-// are multiple matches in the bucket, use lvs to select a metric and remove
-// only that metric.
-func (m *metricMap) deleteByHashWithLabels(
- h uint64, labels Labels, curry []curriedLabelValue,
-) bool {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- metrics, ok := m.metrics[h]
- if !ok {
- return false
- }
- i := findMetricWithLabels(m.desc, metrics, labels, curry)
- if i >= len(metrics) {
- return false
- }
-
- if len(metrics) > 1 {
- old := metrics
- m.metrics[h] = append(metrics[:i], metrics[i+1:]...)
- old[len(old)-1] = metricWithLabelValues{}
- } else {
- delete(m.metrics, h)
- }
- return true
-}
-
-// deleteByLabels deletes a metric if the given labels are present in the metric.
-func (m *metricMap) deleteByLabels(labels Labels, curry []curriedLabelValue) int {
- m.mtx.Lock()
- defer m.mtx.Unlock()
-
- var numDeleted int
-
- for h, metrics := range m.metrics {
- i := findMetricWithPartialLabels(m.desc, metrics, labels, curry)
- if i >= len(metrics) {
- // Didn't find matching labels in this metric slice.
- continue
- }
- delete(m.metrics, h)
- numDeleted++
- }
-
- return numDeleted
-}
-
-// findMetricWithPartialLabel returns the index of the matching metric or
-// len(metrics) if not found.
-func findMetricWithPartialLabels(
- desc *Desc, metrics []metricWithLabelValues, labels Labels, curry []curriedLabelValue,
-) int {
- for i, metric := range metrics {
- if matchPartialLabels(desc, metric.values, labels, curry) {
- return i
- }
- }
- return len(metrics)
-}
-
-// indexOf searches the given slice of strings for the target string and returns
-// the index or len(items) as well as a boolean whether the search succeeded.
-func indexOf(target string, items []string) (int, bool) {
- for i, l := range items {
- if l == target {
- return i, true
- }
- }
- return len(items), false
-}
-
-// valueMatchesVariableOrCurriedValue determines if a value was previously curried,
-// and returns whether it matches either the "base" value or the curried value accordingly.
-// It also indicates whether the match is against a curried or uncurried value.
-func valueMatchesVariableOrCurriedValue(targetValue string, index int, values []string, curry []curriedLabelValue) (bool, bool) {
- for _, curriedValue := range curry {
- if curriedValue.index == index {
- // This label was curried. See if the curried value matches our target.
- return curriedValue.value == targetValue, true
- }
- }
- // This label was not curried. See if the current value matches our target label.
- return values[index] == targetValue, false
-}
-
-// matchPartialLabels searches the current metric and returns whether all of the target label:value pairs are present.
-func matchPartialLabels(desc *Desc, values []string, labels Labels, curry []curriedLabelValue) bool {
- for l, v := range labels {
- // Check if the target label exists in our metrics and get the index.
- varLabelIndex, validLabel := indexOf(l, desc.variableLabels.names)
- if validLabel {
- // Check the value of that label against the target value.
- // We don't consider curried values in partial matches.
- matches, curried := valueMatchesVariableOrCurriedValue(v, varLabelIndex, values, curry)
- if matches && !curried {
- continue
- }
- }
- return false
- }
- return true
-}
-
-// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value
-// or creates it and returns the new one.
-//
-// This function holds the mutex.
-func (m *metricMap) getOrCreateMetricWithLabelValues(
- hash uint64, lvs []string, curry []curriedLabelValue,
-) Metric {
- m.mtx.RLock()
- metric, ok := m.getMetricWithHashAndLabelValues(hash, lvs, curry)
- m.mtx.RUnlock()
- if ok {
- return metric
- }
-
- m.mtx.Lock()
- defer m.mtx.Unlock()
- metric, ok = m.getMetricWithHashAndLabelValues(hash, lvs, curry)
- if !ok {
- inlinedLVs := inlineLabelValues(lvs, curry)
- metric = m.newMetric(inlinedLVs...)
- m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: inlinedLVs, metric: metric})
- }
- return metric
-}
-
-// getOrCreateMetricWithLabelValues retrieves the metric by hash and label value
-// or creates it and returns the new one.
-//
-// This function holds the mutex.
-func (m *metricMap) getOrCreateMetricWithLabels(
- hash uint64, labels Labels, curry []curriedLabelValue,
-) Metric {
- m.mtx.RLock()
- metric, ok := m.getMetricWithHashAndLabels(hash, labels, curry)
- m.mtx.RUnlock()
- if ok {
- return metric
- }
-
- m.mtx.Lock()
- defer m.mtx.Unlock()
- metric, ok = m.getMetricWithHashAndLabels(hash, labels, curry)
- if !ok {
- lvs := extractLabelValues(m.desc, labels, curry)
- metric = m.newMetric(lvs...)
- m.metrics[hash] = append(m.metrics[hash], metricWithLabelValues{values: lvs, metric: metric})
- }
- return metric
-}
-
-// getMetricWithHashAndLabelValues gets a metric while handling possible
-// collisions in the hash space. Must be called while holding the read mutex.
-func (m *metricMap) getMetricWithHashAndLabelValues(
- h uint64, lvs []string, curry []curriedLabelValue,
-) (Metric, bool) {
- metrics, ok := m.metrics[h]
- if ok {
- if i := findMetricWithLabelValues(metrics, lvs, curry); i < len(metrics) {
- return metrics[i].metric, true
- }
- }
- return nil, false
-}
-
-// getMetricWithHashAndLabels gets a metric while handling possible collisions in
-// the hash space. Must be called while holding read mutex.
-func (m *metricMap) getMetricWithHashAndLabels(
- h uint64, labels Labels, curry []curriedLabelValue,
-) (Metric, bool) {
- metrics, ok := m.metrics[h]
- if ok {
- if i := findMetricWithLabels(m.desc, metrics, labels, curry); i < len(metrics) {
- return metrics[i].metric, true
- }
- }
- return nil, false
-}
-
-// findMetricWithLabelValues returns the index of the matching metric or
-// len(metrics) if not found.
-func findMetricWithLabelValues(
- metrics []metricWithLabelValues, lvs []string, curry []curriedLabelValue,
-) int {
- for i, metric := range metrics {
- if matchLabelValues(metric.values, lvs, curry) {
- return i
- }
- }
- return len(metrics)
-}
-
-// findMetricWithLabels returns the index of the matching metric or len(metrics)
-// if not found.
-func findMetricWithLabels(
- desc *Desc, metrics []metricWithLabelValues, labels Labels, curry []curriedLabelValue,
-) int {
- for i, metric := range metrics {
- if matchLabels(desc, metric.values, labels, curry) {
- return i
- }
- }
- return len(metrics)
-}
-
-func matchLabelValues(values, lvs []string, curry []curriedLabelValue) bool {
- if len(values) != len(lvs)+len(curry) {
- return false
- }
- var iLVs, iCurry int
- for i, v := range values {
- if iCurry < len(curry) && curry[iCurry].index == i {
- if v != curry[iCurry].value {
- return false
- }
- iCurry++
- continue
- }
- if v != lvs[iLVs] {
- return false
- }
- iLVs++
- }
- return true
-}
-
-func matchLabels(desc *Desc, values []string, labels Labels, curry []curriedLabelValue) bool {
- if len(values) != len(labels)+len(curry) {
- return false
- }
- iCurry := 0
- for i, k := range desc.variableLabels.names {
- if iCurry < len(curry) && curry[iCurry].index == i {
- if values[i] != curry[iCurry].value {
- return false
- }
- iCurry++
- continue
- }
- if values[i] != labels[k] {
- return false
- }
- }
- return true
-}
-
-func extractLabelValues(desc *Desc, labels Labels, curry []curriedLabelValue) []string {
- labelValues := make([]string, len(labels)+len(curry))
- iCurry := 0
- for i, k := range desc.variableLabels.names {
- if iCurry < len(curry) && curry[iCurry].index == i {
- labelValues[i] = curry[iCurry].value
- iCurry++
- continue
- }
- labelValues[i] = labels[k]
- }
- return labelValues
-}
-
-func inlineLabelValues(lvs []string, curry []curriedLabelValue) []string {
- labelValues := make([]string, len(lvs)+len(curry))
- var iCurry, iLVs int
- for i := range labelValues {
- if iCurry < len(curry) && curry[iCurry].index == i {
- labelValues[i] = curry[iCurry].value
- iCurry++
- continue
- }
- labelValues[i] = lvs[iLVs]
- iLVs++
- }
- return labelValues
-}
-
-var labelsPool = &sync.Pool{
- New: func() interface{} {
- return make(Labels)
- },
-}
-
-func constrainLabels(desc *Desc, labels Labels) (Labels, func()) {
- if len(desc.variableLabels.labelConstraints) == 0 {
- // Fast path when there's no constraints
- return labels, func() {}
- }
-
- constrainedLabels := labelsPool.Get().(Labels)
- for l, v := range labels {
- constrainedLabels[l] = desc.variableLabels.constrain(l, v)
- }
-
- return constrainedLabels, func() {
- for k := range constrainedLabels {
- delete(constrainedLabels, k)
- }
- labelsPool.Put(constrainedLabels)
- }
-}
-
-func constrainLabelValues(desc *Desc, lvs []string, curry []curriedLabelValue) []string {
- if len(desc.variableLabels.labelConstraints) == 0 {
- // Fast path when there's no constraints
- return lvs
- }
-
- constrainedValues := make([]string, len(lvs))
- var iCurry, iLVs int
- for i := 0; i < len(lvs)+len(curry); i++ {
- if iCurry < len(curry) && curry[iCurry].index == i {
- iCurry++
- continue
- }
-
- if i < len(desc.variableLabels.names) {
- constrainedValues[iLVs] = desc.variableLabels.constrain(
- desc.variableLabels.names[i],
- lvs[iLVs],
- )
- } else {
- constrainedValues[iLVs] = lvs[iLVs]
- }
- iLVs++
- }
- return constrainedValues
-}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/vnext.go b/vendor/github.com/prometheus/client_golang/prometheus/vnext.go
deleted file mode 100644
index 42bc3a8..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/vnext.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-type v2 struct{}
-
-// V2 is a struct that can be referenced to access experimental API that might
-// be present in v2 of client golang someday. It offers extended functionality
-// of v1 with slightly changed API. It is acceptable to use some pieces from v1
-// and e.g `prometheus.NewGauge` and some from v2 e.g. `prometheus.V2.NewDesc`
-// in the same codebase.
-var V2 = v2{}
diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
deleted file mode 100644
index 25da157..0000000
--- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package prometheus
-
-import (
- "fmt"
- "sort"
-
- "github.com/prometheus/client_golang/prometheus/internal"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/proto"
-)
-
-// WrapRegistererWith returns a Registerer wrapping the provided
-// Registerer. Collectors registered with the returned Registerer will be
-// registered with the wrapped Registerer in a modified way. The modified
-// Collector adds the provided Labels to all Metrics it collects (as
-// ConstLabels). The Metrics collected by the unmodified Collector must not
-// duplicate any of those labels. Wrapping a nil value is valid, resulting
-// in a no-op Registerer.
-//
-// WrapRegistererWith provides a way to add fixed labels to a subset of
-// Collectors. It should not be used to add fixed labels to all metrics
-// exposed. See also
-// https://prometheus.io/docs/instrumenting/writing_exporters/#target-labels-not-static-scraped-labels
-//
-// Conflicts between Collectors registered through the original Registerer with
-// Collectors registered through the wrapping Registerer will still be
-// detected. Any AlreadyRegisteredError returned by the Register method of
-// either Registerer will contain the ExistingCollector in the form it was
-// provided to the respective registry.
-//
-// The Collector example demonstrates a use of WrapRegistererWith.
-func WrapRegistererWith(labels Labels, reg Registerer) Registerer {
- return &wrappingRegisterer{
- wrappedRegisterer: reg,
- labels: labels,
- }
-}
-
-// WrapRegistererWithPrefix returns a Registerer wrapping the provided
-// Registerer. Collectors registered with the returned Registerer will be
-// registered with the wrapped Registerer in a modified way. The modified
-// Collector adds the provided prefix to the name of all Metrics it collects.
-// Wrapping a nil value is valid, resulting in a no-op Registerer.
-//
-// WrapRegistererWithPrefix is useful to have one place to prefix all metrics of
-// a sub-system. To make this work, register metrics of the sub-system with the
-// wrapping Registerer returned by WrapRegistererWithPrefix. It is rarely useful
-// to use the same prefix for all metrics exposed. In particular, do not prefix
-// metric names that are standardized across applications, as that would break
-// horizontal monitoring, for example the metrics provided by the Go collector
-// (see NewGoCollector) and the process collector (see NewProcessCollector). (In
-// fact, those metrics are already prefixed with “go_” or “process_”,
-// respectively.)
-//
-// Conflicts between Collectors registered through the original Registerer with
-// Collectors registered through the wrapping Registerer will still be
-// detected. Any AlreadyRegisteredError returned by the Register method of
-// either Registerer will contain the ExistingCollector in the form it was
-// provided to the respective registry.
-func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer {
- return &wrappingRegisterer{
- wrappedRegisterer: reg,
- prefix: prefix,
- }
-}
-
-type wrappingRegisterer struct {
- wrappedRegisterer Registerer
- prefix string
- labels Labels
-}
-
-func (r *wrappingRegisterer) Register(c Collector) error {
- if r.wrappedRegisterer == nil {
- return nil
- }
- return r.wrappedRegisterer.Register(&wrappingCollector{
- wrappedCollector: c,
- prefix: r.prefix,
- labels: r.labels,
- })
-}
-
-func (r *wrappingRegisterer) MustRegister(cs ...Collector) {
- if r.wrappedRegisterer == nil {
- return
- }
- for _, c := range cs {
- if err := r.Register(c); err != nil {
- panic(err)
- }
- }
-}
-
-func (r *wrappingRegisterer) Unregister(c Collector) bool {
- if r.wrappedRegisterer == nil {
- return false
- }
- return r.wrappedRegisterer.Unregister(&wrappingCollector{
- wrappedCollector: c,
- prefix: r.prefix,
- labels: r.labels,
- })
-}
-
-type wrappingCollector struct {
- wrappedCollector Collector
- prefix string
- labels Labels
-}
-
-func (c *wrappingCollector) Collect(ch chan<- Metric) {
- wrappedCh := make(chan Metric)
- go func() {
- c.wrappedCollector.Collect(wrappedCh)
- close(wrappedCh)
- }()
- for m := range wrappedCh {
- ch <- &wrappingMetric{
- wrappedMetric: m,
- prefix: c.prefix,
- labels: c.labels,
- }
- }
-}
-
-func (c *wrappingCollector) Describe(ch chan<- *Desc) {
- wrappedCh := make(chan *Desc)
- go func() {
- c.wrappedCollector.Describe(wrappedCh)
- close(wrappedCh)
- }()
- for desc := range wrappedCh {
- ch <- wrapDesc(desc, c.prefix, c.labels)
- }
-}
-
-func (c *wrappingCollector) unwrapRecursively() Collector {
- switch wc := c.wrappedCollector.(type) {
- case *wrappingCollector:
- return wc.unwrapRecursively()
- default:
- return wc
- }
-}
-
-type wrappingMetric struct {
- wrappedMetric Metric
- prefix string
- labels Labels
-}
-
-func (m *wrappingMetric) Desc() *Desc {
- return wrapDesc(m.wrappedMetric.Desc(), m.prefix, m.labels)
-}
-
-func (m *wrappingMetric) Write(out *dto.Metric) error {
- if err := m.wrappedMetric.Write(out); err != nil {
- return err
- }
- if len(m.labels) == 0 {
- // No wrapping labels.
- return nil
- }
- for ln, lv := range m.labels {
- out.Label = append(out.Label, &dto.LabelPair{
- Name: proto.String(ln),
- Value: proto.String(lv),
- })
- }
- sort.Sort(internal.LabelPairSorter(out.Label))
- return nil
-}
-
-func wrapDesc(desc *Desc, prefix string, labels Labels) *Desc {
- constLabels := Labels{}
- for _, lp := range desc.constLabelPairs {
- constLabels[*lp.Name] = *lp.Value
- }
- for ln, lv := range labels {
- if _, alreadyUsed := constLabels[ln]; alreadyUsed {
- return &Desc{
- fqName: desc.fqName,
- help: desc.help,
- variableLabels: desc.variableLabels,
- constLabelPairs: desc.constLabelPairs,
- err: fmt.Errorf("attempted wrapping with already existing label name %q", ln),
- }
- }
- constLabels[ln] = lv
- }
- // NewDesc will do remaining validations.
- newDesc := V2.NewDesc(prefix+desc.fqName, desc.help, desc.variableLabels, constLabels)
- // Propagate errors if there was any. This will override any errer
- // created by NewDesc above, i.e. earlier errors get precedence.
- if desc.err != nil {
- newDesc.err = desc.err
- }
- return newDesc
-}
diff --git a/vendor/github.com/prometheus/client_model/LICENSE b/vendor/github.com/prometheus/client_model/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/client_model/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/client_model/NOTICE b/vendor/github.com/prometheus/client_model/NOTICE
deleted file mode 100644
index 20110e4..0000000
--- a/vendor/github.com/prometheus/client_model/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Data model artifacts for Prometheus.
-Copyright 2012-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/vendor/github.com/prometheus/client_model/go/metrics.pb.go b/vendor/github.com/prometheus/client_model/go/metrics.pb.go
deleted file mode 100644
index 2f15490..0000000
--- a/vendor/github.com/prometheus/client_model/go/metrics.pb.go
+++ /dev/null
@@ -1,1399 +0,0 @@
-// Copyright 2013 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.30.0
-// protoc v3.20.3
-// source: io/prometheus/client/metrics.proto
-
-package io_prometheus_client
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- timestamppb "google.golang.org/protobuf/types/known/timestamppb"
- reflect "reflect"
- sync "sync"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type MetricType int32
-
-const (
- // COUNTER must use the Metric field "counter".
- MetricType_COUNTER MetricType = 0
- // GAUGE must use the Metric field "gauge".
- MetricType_GAUGE MetricType = 1
- // SUMMARY must use the Metric field "summary".
- MetricType_SUMMARY MetricType = 2
- // UNTYPED must use the Metric field "untyped".
- MetricType_UNTYPED MetricType = 3
- // HISTOGRAM must use the Metric field "histogram".
- MetricType_HISTOGRAM MetricType = 4
- // GAUGE_HISTOGRAM must use the Metric field "histogram".
- MetricType_GAUGE_HISTOGRAM MetricType = 5
-)
-
-// Enum value maps for MetricType.
-var (
- MetricType_name = map[int32]string{
- 0: "COUNTER",
- 1: "GAUGE",
- 2: "SUMMARY",
- 3: "UNTYPED",
- 4: "HISTOGRAM",
- 5: "GAUGE_HISTOGRAM",
- }
- MetricType_value = map[string]int32{
- "COUNTER": 0,
- "GAUGE": 1,
- "SUMMARY": 2,
- "UNTYPED": 3,
- "HISTOGRAM": 4,
- "GAUGE_HISTOGRAM": 5,
- }
-)
-
-func (x MetricType) Enum() *MetricType {
- p := new(MetricType)
- *p = x
- return p
-}
-
-func (x MetricType) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (MetricType) Descriptor() protoreflect.EnumDescriptor {
- return file_io_prometheus_client_metrics_proto_enumTypes[0].Descriptor()
-}
-
-func (MetricType) Type() protoreflect.EnumType {
- return &file_io_prometheus_client_metrics_proto_enumTypes[0]
-}
-
-func (x MetricType) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Do not use.
-func (x *MetricType) UnmarshalJSON(b []byte) error {
- num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
- if err != nil {
- return err
- }
- *x = MetricType(num)
- return nil
-}
-
-// Deprecated: Use MetricType.Descriptor instead.
-func (MetricType) EnumDescriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{0}
-}
-
-type LabelPair struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Value *string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (x *LabelPair) Reset() {
- *x = LabelPair{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *LabelPair) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*LabelPair) ProtoMessage() {}
-
-func (x *LabelPair) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use LabelPair.ProtoReflect.Descriptor instead.
-func (*LabelPair) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *LabelPair) GetName() string {
- if x != nil && x.Name != nil {
- return *x.Name
- }
- return ""
-}
-
-func (x *LabelPair) GetValue() string {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return ""
-}
-
-type Gauge struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
-}
-
-func (x *Gauge) Reset() {
- *x = Gauge{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Gauge) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Gauge) ProtoMessage() {}
-
-func (x *Gauge) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Gauge.ProtoReflect.Descriptor instead.
-func (*Gauge) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *Gauge) GetValue() float64 {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return 0
-}
-
-type Counter struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
- Exemplar *Exemplar `protobuf:"bytes,2,opt,name=exemplar" json:"exemplar,omitempty"`
- CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
-}
-
-func (x *Counter) Reset() {
- *x = Counter{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Counter) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Counter) ProtoMessage() {}
-
-func (x *Counter) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Counter.ProtoReflect.Descriptor instead.
-func (*Counter) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *Counter) GetValue() float64 {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return 0
-}
-
-func (x *Counter) GetExemplar() *Exemplar {
- if x != nil {
- return x.Exemplar
- }
- return nil
-}
-
-func (x *Counter) GetCreatedTimestamp() *timestamppb.Timestamp {
- if x != nil {
- return x.CreatedTimestamp
- }
- return nil
-}
-
-type Quantile struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Quantile *float64 `protobuf:"fixed64,1,opt,name=quantile" json:"quantile,omitempty"`
- Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (x *Quantile) Reset() {
- *x = Quantile{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Quantile) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Quantile) ProtoMessage() {}
-
-func (x *Quantile) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Quantile.ProtoReflect.Descriptor instead.
-func (*Quantile) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *Quantile) GetQuantile() float64 {
- if x != nil && x.Quantile != nil {
- return *x.Quantile
- }
- return 0
-}
-
-func (x *Quantile) GetValue() float64 {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return 0
-}
-
-type Summary struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
- Quantile []*Quantile `protobuf:"bytes,3,rep,name=quantile" json:"quantile,omitempty"`
- CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
-}
-
-func (x *Summary) Reset() {
- *x = Summary{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Summary) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Summary) ProtoMessage() {}
-
-func (x *Summary) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Summary.ProtoReflect.Descriptor instead.
-func (*Summary) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *Summary) GetSampleCount() uint64 {
- if x != nil && x.SampleCount != nil {
- return *x.SampleCount
- }
- return 0
-}
-
-func (x *Summary) GetSampleSum() float64 {
- if x != nil && x.SampleSum != nil {
- return *x.SampleSum
- }
- return 0
-}
-
-func (x *Summary) GetQuantile() []*Quantile {
- if x != nil {
- return x.Quantile
- }
- return nil
-}
-
-func (x *Summary) GetCreatedTimestamp() *timestamppb.Timestamp {
- if x != nil {
- return x.CreatedTimestamp
- }
- return nil
-}
-
-type Untyped struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Value *float64 `protobuf:"fixed64,1,opt,name=value" json:"value,omitempty"`
-}
-
-func (x *Untyped) Reset() {
- *x = Untyped{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Untyped) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Untyped) ProtoMessage() {}
-
-func (x *Untyped) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Untyped.ProtoReflect.Descriptor instead.
-func (*Untyped) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *Untyped) GetValue() float64 {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return 0
-}
-
-type Histogram struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- SampleCount *uint64 `protobuf:"varint,1,opt,name=sample_count,json=sampleCount" json:"sample_count,omitempty"`
- SampleCountFloat *float64 `protobuf:"fixed64,4,opt,name=sample_count_float,json=sampleCountFloat" json:"sample_count_float,omitempty"` // Overrides sample_count if > 0.
- SampleSum *float64 `protobuf:"fixed64,2,opt,name=sample_sum,json=sampleSum" json:"sample_sum,omitempty"`
- // Buckets for the conventional histogram.
- Bucket []*Bucket `protobuf:"bytes,3,rep,name=bucket" json:"bucket,omitempty"` // Ordered in increasing order of upper_bound, +Inf bucket is optional.
- CreatedTimestamp *timestamppb.Timestamp `protobuf:"bytes,15,opt,name=created_timestamp,json=createdTimestamp" json:"created_timestamp,omitempty"`
- // schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8.
- // They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and
- // then each power of two is divided into 2^n logarithmic buckets.
- // Or in other words, each bucket boundary is the previous boundary times 2^(2^-n).
- // In the future, more bucket schemas may be added using numbers < -4 or > 8.
- Schema *int32 `protobuf:"zigzag32,5,opt,name=schema" json:"schema,omitempty"`
- ZeroThreshold *float64 `protobuf:"fixed64,6,opt,name=zero_threshold,json=zeroThreshold" json:"zero_threshold,omitempty"` // Breadth of the zero bucket.
- ZeroCount *uint64 `protobuf:"varint,7,opt,name=zero_count,json=zeroCount" json:"zero_count,omitempty"` // Count in zero bucket.
- ZeroCountFloat *float64 `protobuf:"fixed64,8,opt,name=zero_count_float,json=zeroCountFloat" json:"zero_count_float,omitempty"` // Overrides sb_zero_count if > 0.
- // Negative buckets for the native histogram.
- NegativeSpan []*BucketSpan `protobuf:"bytes,9,rep,name=negative_span,json=negativeSpan" json:"negative_span,omitempty"`
- // Use either "negative_delta" or "negative_count", the former for
- // regular histograms with integer counts, the latter for float
- // histograms.
- NegativeDelta []int64 `protobuf:"zigzag64,10,rep,name=negative_delta,json=negativeDelta" json:"negative_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket).
- NegativeCount []float64 `protobuf:"fixed64,11,rep,name=negative_count,json=negativeCount" json:"negative_count,omitempty"` // Absolute count of each bucket.
- // Positive buckets for the native histogram.
- // Use a no-op span (offset 0, length 0) for a native histogram without any
- // observations yet and with a zero_threshold of 0. Otherwise, it would be
- // indistinguishable from a classic histogram.
- PositiveSpan []*BucketSpan `protobuf:"bytes,12,rep,name=positive_span,json=positiveSpan" json:"positive_span,omitempty"`
- // Use either "positive_delta" or "positive_count", the former for
- // regular histograms with integer counts, the latter for float
- // histograms.
- PositiveDelta []int64 `protobuf:"zigzag64,13,rep,name=positive_delta,json=positiveDelta" json:"positive_delta,omitempty"` // Count delta of each bucket compared to previous one (or to zero for 1st bucket).
- PositiveCount []float64 `protobuf:"fixed64,14,rep,name=positive_count,json=positiveCount" json:"positive_count,omitempty"` // Absolute count of each bucket.
- // Only used for native histograms. These exemplars MUST have a timestamp.
- Exemplars []*Exemplar `protobuf:"bytes,16,rep,name=exemplars" json:"exemplars,omitempty"`
-}
-
-func (x *Histogram) Reset() {
- *x = Histogram{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Histogram) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Histogram) ProtoMessage() {}
-
-func (x *Histogram) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Histogram.ProtoReflect.Descriptor instead.
-func (*Histogram) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *Histogram) GetSampleCount() uint64 {
- if x != nil && x.SampleCount != nil {
- return *x.SampleCount
- }
- return 0
-}
-
-func (x *Histogram) GetSampleCountFloat() float64 {
- if x != nil && x.SampleCountFloat != nil {
- return *x.SampleCountFloat
- }
- return 0
-}
-
-func (x *Histogram) GetSampleSum() float64 {
- if x != nil && x.SampleSum != nil {
- return *x.SampleSum
- }
- return 0
-}
-
-func (x *Histogram) GetBucket() []*Bucket {
- if x != nil {
- return x.Bucket
- }
- return nil
-}
-
-func (x *Histogram) GetCreatedTimestamp() *timestamppb.Timestamp {
- if x != nil {
- return x.CreatedTimestamp
- }
- return nil
-}
-
-func (x *Histogram) GetSchema() int32 {
- if x != nil && x.Schema != nil {
- return *x.Schema
- }
- return 0
-}
-
-func (x *Histogram) GetZeroThreshold() float64 {
- if x != nil && x.ZeroThreshold != nil {
- return *x.ZeroThreshold
- }
- return 0
-}
-
-func (x *Histogram) GetZeroCount() uint64 {
- if x != nil && x.ZeroCount != nil {
- return *x.ZeroCount
- }
- return 0
-}
-
-func (x *Histogram) GetZeroCountFloat() float64 {
- if x != nil && x.ZeroCountFloat != nil {
- return *x.ZeroCountFloat
- }
- return 0
-}
-
-func (x *Histogram) GetNegativeSpan() []*BucketSpan {
- if x != nil {
- return x.NegativeSpan
- }
- return nil
-}
-
-func (x *Histogram) GetNegativeDelta() []int64 {
- if x != nil {
- return x.NegativeDelta
- }
- return nil
-}
-
-func (x *Histogram) GetNegativeCount() []float64 {
- if x != nil {
- return x.NegativeCount
- }
- return nil
-}
-
-func (x *Histogram) GetPositiveSpan() []*BucketSpan {
- if x != nil {
- return x.PositiveSpan
- }
- return nil
-}
-
-func (x *Histogram) GetPositiveDelta() []int64 {
- if x != nil {
- return x.PositiveDelta
- }
- return nil
-}
-
-func (x *Histogram) GetPositiveCount() []float64 {
- if x != nil {
- return x.PositiveCount
- }
- return nil
-}
-
-func (x *Histogram) GetExemplars() []*Exemplar {
- if x != nil {
- return x.Exemplars
- }
- return nil
-}
-
-// A Bucket of a conventional histogram, each of which is treated as
-// an individual counter-like time series by Prometheus.
-type Bucket struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- CumulativeCount *uint64 `protobuf:"varint,1,opt,name=cumulative_count,json=cumulativeCount" json:"cumulative_count,omitempty"` // Cumulative in increasing order.
- CumulativeCountFloat *float64 `protobuf:"fixed64,4,opt,name=cumulative_count_float,json=cumulativeCountFloat" json:"cumulative_count_float,omitempty"` // Overrides cumulative_count if > 0.
- UpperBound *float64 `protobuf:"fixed64,2,opt,name=upper_bound,json=upperBound" json:"upper_bound,omitempty"` // Inclusive.
- Exemplar *Exemplar `protobuf:"bytes,3,opt,name=exemplar" json:"exemplar,omitempty"`
-}
-
-func (x *Bucket) Reset() {
- *x = Bucket{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Bucket) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Bucket) ProtoMessage() {}
-
-func (x *Bucket) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Bucket.ProtoReflect.Descriptor instead.
-func (*Bucket) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *Bucket) GetCumulativeCount() uint64 {
- if x != nil && x.CumulativeCount != nil {
- return *x.CumulativeCount
- }
- return 0
-}
-
-func (x *Bucket) GetCumulativeCountFloat() float64 {
- if x != nil && x.CumulativeCountFloat != nil {
- return *x.CumulativeCountFloat
- }
- return 0
-}
-
-func (x *Bucket) GetUpperBound() float64 {
- if x != nil && x.UpperBound != nil {
- return *x.UpperBound
- }
- return 0
-}
-
-func (x *Bucket) GetExemplar() *Exemplar {
- if x != nil {
- return x.Exemplar
- }
- return nil
-}
-
-// A BucketSpan defines a number of consecutive buckets in a native
-// histogram with their offset. Logically, it would be more
-// straightforward to include the bucket counts in the Span. However,
-// the protobuf representation is more compact in the way the data is
-// structured here (with all the buckets in a single array separate
-// from the Spans).
-type BucketSpan struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Offset *int32 `protobuf:"zigzag32,1,opt,name=offset" json:"offset,omitempty"` // Gap to previous span, or starting point for 1st span (which can be negative).
- Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"` // Length of consecutive buckets.
-}
-
-func (x *BucketSpan) Reset() {
- *x = BucketSpan{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *BucketSpan) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*BucketSpan) ProtoMessage() {}
-
-func (x *BucketSpan) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[8]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use BucketSpan.ProtoReflect.Descriptor instead.
-func (*BucketSpan) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{8}
-}
-
-func (x *BucketSpan) GetOffset() int32 {
- if x != nil && x.Offset != nil {
- return *x.Offset
- }
- return 0
-}
-
-func (x *BucketSpan) GetLength() uint32 {
- if x != nil && x.Length != nil {
- return *x.Length
- }
- return 0
-}
-
-type Exemplar struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
- Value *float64 `protobuf:"fixed64,2,opt,name=value" json:"value,omitempty"`
- Timestamp *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"` // OpenMetrics-style.
-}
-
-func (x *Exemplar) Reset() {
- *x = Exemplar{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Exemplar) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Exemplar) ProtoMessage() {}
-
-func (x *Exemplar) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[9]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Exemplar.ProtoReflect.Descriptor instead.
-func (*Exemplar) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *Exemplar) GetLabel() []*LabelPair {
- if x != nil {
- return x.Label
- }
- return nil
-}
-
-func (x *Exemplar) GetValue() float64 {
- if x != nil && x.Value != nil {
- return *x.Value
- }
- return 0
-}
-
-func (x *Exemplar) GetTimestamp() *timestamppb.Timestamp {
- if x != nil {
- return x.Timestamp
- }
- return nil
-}
-
-type Metric struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Label []*LabelPair `protobuf:"bytes,1,rep,name=label" json:"label,omitempty"`
- Gauge *Gauge `protobuf:"bytes,2,opt,name=gauge" json:"gauge,omitempty"`
- Counter *Counter `protobuf:"bytes,3,opt,name=counter" json:"counter,omitempty"`
- Summary *Summary `protobuf:"bytes,4,opt,name=summary" json:"summary,omitempty"`
- Untyped *Untyped `protobuf:"bytes,5,opt,name=untyped" json:"untyped,omitempty"`
- Histogram *Histogram `protobuf:"bytes,7,opt,name=histogram" json:"histogram,omitempty"`
- TimestampMs *int64 `protobuf:"varint,6,opt,name=timestamp_ms,json=timestampMs" json:"timestamp_ms,omitempty"`
-}
-
-func (x *Metric) Reset() {
- *x = Metric{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Metric) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Metric) ProtoMessage() {}
-
-func (x *Metric) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[10]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
-func (*Metric) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{10}
-}
-
-func (x *Metric) GetLabel() []*LabelPair {
- if x != nil {
- return x.Label
- }
- return nil
-}
-
-func (x *Metric) GetGauge() *Gauge {
- if x != nil {
- return x.Gauge
- }
- return nil
-}
-
-func (x *Metric) GetCounter() *Counter {
- if x != nil {
- return x.Counter
- }
- return nil
-}
-
-func (x *Metric) GetSummary() *Summary {
- if x != nil {
- return x.Summary
- }
- return nil
-}
-
-func (x *Metric) GetUntyped() *Untyped {
- if x != nil {
- return x.Untyped
- }
- return nil
-}
-
-func (x *Metric) GetHistogram() *Histogram {
- if x != nil {
- return x.Histogram
- }
- return nil
-}
-
-func (x *Metric) GetTimestampMs() int64 {
- if x != nil && x.TimestampMs != nil {
- return *x.TimestampMs
- }
- return 0
-}
-
-type MetricFamily struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Help *string `protobuf:"bytes,2,opt,name=help" json:"help,omitempty"`
- Type *MetricType `protobuf:"varint,3,opt,name=type,enum=io.prometheus.client.MetricType" json:"type,omitempty"`
- Metric []*Metric `protobuf:"bytes,4,rep,name=metric" json:"metric,omitempty"`
- Unit *string `protobuf:"bytes,5,opt,name=unit" json:"unit,omitempty"`
-}
-
-func (x *MetricFamily) Reset() {
- *x = MetricFamily{}
- if protoimpl.UnsafeEnabled {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *MetricFamily) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*MetricFamily) ProtoMessage() {}
-
-func (x *MetricFamily) ProtoReflect() protoreflect.Message {
- mi := &file_io_prometheus_client_metrics_proto_msgTypes[11]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use MetricFamily.ProtoReflect.Descriptor instead.
-func (*MetricFamily) Descriptor() ([]byte, []int) {
- return file_io_prometheus_client_metrics_proto_rawDescGZIP(), []int{11}
-}
-
-func (x *MetricFamily) GetName() string {
- if x != nil && x.Name != nil {
- return *x.Name
- }
- return ""
-}
-
-func (x *MetricFamily) GetHelp() string {
- if x != nil && x.Help != nil {
- return *x.Help
- }
- return ""
-}
-
-func (x *MetricFamily) GetType() MetricType {
- if x != nil && x.Type != nil {
- return *x.Type
- }
- return MetricType_COUNTER
-}
-
-func (x *MetricFamily) GetMetric() []*Metric {
- if x != nil {
- return x.Metric
- }
- return nil
-}
-
-func (x *MetricFamily) GetUnit() string {
- if x != nil && x.Unit != nil {
- return *x.Unit
- }
- return ""
-}
-
-var File_io_prometheus_client_metrics_proto protoreflect.FileDescriptor
-
-var file_io_prometheus_client_metrics_proto_rawDesc = []byte{
- 0x0a, 0x22, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2f,
- 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68,
- 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65,
- 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x09, 0x4c,
- 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
- 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65, 0x22, 0x1d, 0x0a, 0x05, 0x47, 0x61, 0x75, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
- 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a,
- 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61,
- 0x6c, 0x75, 0x65, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65,
- 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x65,
- 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12,
- 0x47, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73,
- 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f,
- 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d,
- 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54,
- 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x3c, 0x0a, 0x08, 0x51, 0x75, 0x61, 0x6e,
- 0x74, 0x69, 0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65,
- 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52,
- 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x07, 0x53, 0x75, 0x6d, 0x6d, 0x61,
- 0x72, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75,
- 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65,
- 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f,
- 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x73, 0x61, 0x6d, 0x70, 0x6c,
- 0x65, 0x53, 0x75, 0x6d, 0x12, 0x3a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65,
- 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d,
- 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x51, 0x75,
- 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x6c, 0x65,
- 0x12, 0x47, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65,
- 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64,
- 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x1f, 0x0a, 0x07, 0x55, 0x6e, 0x74,
- 0x79, 0x70, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xea, 0x05, 0x0a, 0x09, 0x48,
- 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x61, 0x6d, 0x70,
- 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b,
- 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x73,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61,
- 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x43,
- 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x61, 0x6d,
- 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x09, 0x73,
- 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x53, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b,
- 0x65, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72,
- 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e,
- 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x47,
- 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
- 0x61, 0x6d, 0x70, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
- 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
- 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d,
- 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12,
- 0x25, 0x0a, 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c,
- 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0d, 0x7a, 0x65, 0x72, 0x6f, 0x54, 0x68, 0x72,
- 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x63,
- 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x7a, 0x65, 0x72, 0x6f,
- 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x63, 0x6f,
- 0x75, 0x6e, 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x01, 0x52,
- 0x0e, 0x7a, 0x65, 0x72, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x12,
- 0x45, 0x0a, 0x0d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x70, 0x61, 0x6e,
- 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d,
- 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x42, 0x75,
- 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x0c, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69,
- 0x76, 0x65, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69,
- 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x12, 0x52, 0x0d,
- 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x25, 0x0a,
- 0x0e, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
- 0x0b, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0d, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43,
- 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65,
- 0x5f, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x69, 0x6f,
- 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65,
- 0x6e, 0x74, 0x2e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x0c, 0x70,
- 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x70,
- 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x18, 0x0d, 0x20,
- 0x03, 0x28, 0x12, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x44, 0x65, 0x6c,
- 0x74, 0x61, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63,
- 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x01, 0x52, 0x0d, 0x70, 0x6f, 0x73, 0x69,
- 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x65, 0x78, 0x65,
- 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x18, 0x10, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69,
- 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69,
- 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x09, 0x65, 0x78,
- 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x06, 0x42, 0x75, 0x63, 0x6b,
- 0x65, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65,
- 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x63, 0x75,
- 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a,
- 0x16, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e,
- 0x74, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x14, 0x63,
- 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x46, 0x6c,
- 0x6f, 0x61, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x70, 0x65, 0x72, 0x5f, 0x62, 0x6f, 0x75,
- 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x75, 0x70, 0x70, 0x65, 0x72, 0x42,
- 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72,
- 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d,
- 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x45, 0x78,
- 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x52, 0x08, 0x65, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72,
- 0x22, 0x3c, 0x0a, 0x0a, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x12, 0x16,
- 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x11, 0x52, 0x06,
- 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x91,
- 0x01, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x72, 0x12, 0x35, 0x0a, 0x05, 0x6c,
- 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e,
- 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e,
- 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c, 0x61, 0x62,
- 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
- 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65,
- 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
- 0x6d, 0x70, 0x22, 0xff, 0x02, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x35, 0x0a,
- 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69,
- 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69,
- 0x65, 0x6e, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x6c,
- 0x61, 0x62, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68,
- 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x61, 0x75, 0x67, 0x65,
- 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x37, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74,
- 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72,
- 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e,
- 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72,
- 0x12, 0x37, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75,
- 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79,
- 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x37, 0x0a, 0x07, 0x75, 0x6e, 0x74,
- 0x79, 0x70, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x69, 0x6f, 0x2e,
- 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e,
- 0x74, 0x2e, 0x55, 0x6e, 0x74, 0x79, 0x70, 0x65, 0x64, 0x52, 0x07, 0x75, 0x6e, 0x74, 0x79, 0x70,
- 0x65, 0x64, 0x12, 0x3d, 0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18,
- 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65,
- 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x48, 0x69, 0x73,
- 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61,
- 0x6d, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d,
- 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
- 0x6d, 0x70, 0x4d, 0x73, 0x22, 0xb6, 0x01, 0x0a, 0x0c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x46,
- 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x65, 0x6c,
- 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, 0x34, 0x0a,
- 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x69, 0x6f,
- 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65,
- 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74,
- 0x79, 0x70, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x04, 0x20,
- 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68,
- 0x65, 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69,
- 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x6e, 0x69,
- 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x2a, 0x62, 0x0a,
- 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x43,
- 0x4f, 0x55, 0x4e, 0x54, 0x45, 0x52, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x47, 0x41, 0x55, 0x47,
- 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x4d, 0x4d, 0x41, 0x52, 0x59, 0x10, 0x02,
- 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x54, 0x59, 0x50, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0d, 0x0a,
- 0x09, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f,
- 0x47, 0x41, 0x55, 0x47, 0x45, 0x5f, 0x48, 0x49, 0x53, 0x54, 0x4f, 0x47, 0x52, 0x41, 0x4d, 0x10,
- 0x05, 0x42, 0x52, 0x0a, 0x14, 0x69, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65,
- 0x75, 0x73, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75,
- 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73,
- 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x67, 0x6f,
- 0x3b, 0x69, 0x6f, 0x5f, 0x70, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x68, 0x65, 0x75, 0x73, 0x5f, 0x63,
- 0x6c, 0x69, 0x65, 0x6e, 0x74,
-}
-
-var (
- file_io_prometheus_client_metrics_proto_rawDescOnce sync.Once
- file_io_prometheus_client_metrics_proto_rawDescData = file_io_prometheus_client_metrics_proto_rawDesc
-)
-
-func file_io_prometheus_client_metrics_proto_rawDescGZIP() []byte {
- file_io_prometheus_client_metrics_proto_rawDescOnce.Do(func() {
- file_io_prometheus_client_metrics_proto_rawDescData = protoimpl.X.CompressGZIP(file_io_prometheus_client_metrics_proto_rawDescData)
- })
- return file_io_prometheus_client_metrics_proto_rawDescData
-}
-
-var file_io_prometheus_client_metrics_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_io_prometheus_client_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
-var file_io_prometheus_client_metrics_proto_goTypes = []interface{}{
- (MetricType)(0), // 0: io.prometheus.client.MetricType
- (*LabelPair)(nil), // 1: io.prometheus.client.LabelPair
- (*Gauge)(nil), // 2: io.prometheus.client.Gauge
- (*Counter)(nil), // 3: io.prometheus.client.Counter
- (*Quantile)(nil), // 4: io.prometheus.client.Quantile
- (*Summary)(nil), // 5: io.prometheus.client.Summary
- (*Untyped)(nil), // 6: io.prometheus.client.Untyped
- (*Histogram)(nil), // 7: io.prometheus.client.Histogram
- (*Bucket)(nil), // 8: io.prometheus.client.Bucket
- (*BucketSpan)(nil), // 9: io.prometheus.client.BucketSpan
- (*Exemplar)(nil), // 10: io.prometheus.client.Exemplar
- (*Metric)(nil), // 11: io.prometheus.client.Metric
- (*MetricFamily)(nil), // 12: io.prometheus.client.MetricFamily
- (*timestamppb.Timestamp)(nil), // 13: google.protobuf.Timestamp
-}
-var file_io_prometheus_client_metrics_proto_depIdxs = []int32{
- 10, // 0: io.prometheus.client.Counter.exemplar:type_name -> io.prometheus.client.Exemplar
- 13, // 1: io.prometheus.client.Counter.created_timestamp:type_name -> google.protobuf.Timestamp
- 4, // 2: io.prometheus.client.Summary.quantile:type_name -> io.prometheus.client.Quantile
- 13, // 3: io.prometheus.client.Summary.created_timestamp:type_name -> google.protobuf.Timestamp
- 8, // 4: io.prometheus.client.Histogram.bucket:type_name -> io.prometheus.client.Bucket
- 13, // 5: io.prometheus.client.Histogram.created_timestamp:type_name -> google.protobuf.Timestamp
- 9, // 6: io.prometheus.client.Histogram.negative_span:type_name -> io.prometheus.client.BucketSpan
- 9, // 7: io.prometheus.client.Histogram.positive_span:type_name -> io.prometheus.client.BucketSpan
- 10, // 8: io.prometheus.client.Histogram.exemplars:type_name -> io.prometheus.client.Exemplar
- 10, // 9: io.prometheus.client.Bucket.exemplar:type_name -> io.prometheus.client.Exemplar
- 1, // 10: io.prometheus.client.Exemplar.label:type_name -> io.prometheus.client.LabelPair
- 13, // 11: io.prometheus.client.Exemplar.timestamp:type_name -> google.protobuf.Timestamp
- 1, // 12: io.prometheus.client.Metric.label:type_name -> io.prometheus.client.LabelPair
- 2, // 13: io.prometheus.client.Metric.gauge:type_name -> io.prometheus.client.Gauge
- 3, // 14: io.prometheus.client.Metric.counter:type_name -> io.prometheus.client.Counter
- 5, // 15: io.prometheus.client.Metric.summary:type_name -> io.prometheus.client.Summary
- 6, // 16: io.prometheus.client.Metric.untyped:type_name -> io.prometheus.client.Untyped
- 7, // 17: io.prometheus.client.Metric.histogram:type_name -> io.prometheus.client.Histogram
- 0, // 18: io.prometheus.client.MetricFamily.type:type_name -> io.prometheus.client.MetricType
- 11, // 19: io.prometheus.client.MetricFamily.metric:type_name -> io.prometheus.client.Metric
- 20, // [20:20] is the sub-list for method output_type
- 20, // [20:20] is the sub-list for method input_type
- 20, // [20:20] is the sub-list for extension type_name
- 20, // [20:20] is the sub-list for extension extendee
- 0, // [0:20] is the sub-list for field type_name
-}
-
-func init() { file_io_prometheus_client_metrics_proto_init() }
-func file_io_prometheus_client_metrics_proto_init() {
- if File_io_prometheus_client_metrics_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_io_prometheus_client_metrics_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LabelPair); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Gauge); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Counter); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Quantile); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Summary); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Untyped); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Histogram); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Bucket); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*BucketSpan); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Exemplar); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Metric); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_io_prometheus_client_metrics_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*MetricFamily); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_io_prometheus_client_metrics_proto_rawDesc,
- NumEnums: 1,
- NumMessages: 12,
- NumExtensions: 0,
- NumServices: 0,
- },
- GoTypes: file_io_prometheus_client_metrics_proto_goTypes,
- DependencyIndexes: file_io_prometheus_client_metrics_proto_depIdxs,
- EnumInfos: file_io_prometheus_client_metrics_proto_enumTypes,
- MessageInfos: file_io_prometheus_client_metrics_proto_msgTypes,
- }.Build()
- File_io_prometheus_client_metrics_proto = out.File
- file_io_prometheus_client_metrics_proto_rawDesc = nil
- file_io_prometheus_client_metrics_proto_goTypes = nil
- file_io_prometheus_client_metrics_proto_depIdxs = nil
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go
deleted file mode 100644
index b2b89b0..0000000
--- a/vendor/github.com/prometheus/common/expfmt/decode.go
+++ /dev/null
@@ -1,431 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "fmt"
- "io"
- "math"
- "mime"
- "net/http"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/encoding/protodelim"
-
- "github.com/prometheus/common/model"
-)
-
-// Decoder types decode an input stream into metric families.
-type Decoder interface {
- Decode(*dto.MetricFamily) error
-}
-
-// DecodeOptions contains options used by the Decoder and in sample extraction.
-type DecodeOptions struct {
- // Timestamp is added to each value from the stream that has no explicit timestamp set.
- Timestamp model.Time
-}
-
-// ResponseFormat extracts the correct format from a HTTP response header.
-// If no matching format can be found FormatUnknown is returned.
-func ResponseFormat(h http.Header) Format {
- ct := h.Get(hdrContentType)
-
- mediatype, params, err := mime.ParseMediaType(ct)
- if err != nil {
- return fmtUnknown
- }
-
- const textType = "text/plain"
-
- switch mediatype {
- case ProtoType:
- if p, ok := params["proto"]; ok && p != ProtoProtocol {
- return fmtUnknown
- }
- if e, ok := params["encoding"]; ok && e != "delimited" {
- return fmtUnknown
- }
- return fmtProtoDelim
-
- case textType:
- if v, ok := params["version"]; ok && v != TextVersion {
- return fmtUnknown
- }
- return fmtText
- }
-
- return fmtUnknown
-}
-
-// NewDecoder returns a new decoder based on the given input format.
-// If the input format does not imply otherwise, a text format decoder is returned.
-func NewDecoder(r io.Reader, format Format) Decoder {
- switch format.FormatType() {
- case TypeProtoDelim:
- return &protoDecoder{r: r}
- }
- return &textDecoder{r: r}
-}
-
-// protoDecoder implements the Decoder interface for protocol buffers.
-type protoDecoder struct {
- r io.Reader
-}
-
-// Decode implements the Decoder interface.
-func (d *protoDecoder) Decode(v *dto.MetricFamily) error {
- opts := protodelim.UnmarshalOptions{
- MaxSize: -1,
- }
- if err := opts.UnmarshalFrom(bufio.NewReader(d.r), v); err != nil {
- return err
- }
- if !model.IsValidMetricName(model.LabelValue(v.GetName())) {
- return fmt.Errorf("invalid metric name %q", v.GetName())
- }
- for _, m := range v.GetMetric() {
- if m == nil {
- continue
- }
- for _, l := range m.GetLabel() {
- if l == nil {
- continue
- }
- if !model.LabelValue(l.GetValue()).IsValid() {
- return fmt.Errorf("invalid label value %q", l.GetValue())
- }
- if !model.LabelName(l.GetName()).IsValid() {
- return fmt.Errorf("invalid label name %q", l.GetName())
- }
- }
- }
- return nil
-}
-
-// textDecoder implements the Decoder interface for the text protocol.
-type textDecoder struct {
- r io.Reader
- fams map[string]*dto.MetricFamily
- err error
-}
-
-// Decode implements the Decoder interface.
-func (d *textDecoder) Decode(v *dto.MetricFamily) error {
- if d.err == nil {
- // Read all metrics in one shot.
- var p TextParser
- d.fams, d.err = p.TextToMetricFamilies(d.r)
- // If we don't get an error, store io.EOF for the end.
- if d.err == nil {
- d.err = io.EOF
- }
- }
- // Pick off one MetricFamily per Decode until there's nothing left.
- for key, fam := range d.fams {
- v.Name = fam.Name
- v.Help = fam.Help
- v.Type = fam.Type
- v.Metric = fam.Metric
- delete(d.fams, key)
- return nil
- }
- return d.err
-}
-
-// SampleDecoder wraps a Decoder to extract samples from the metric families
-// decoded by the wrapped Decoder.
-type SampleDecoder struct {
- Dec Decoder
- Opts *DecodeOptions
-
- f dto.MetricFamily
-}
-
-// Decode calls the Decode method of the wrapped Decoder and then extracts the
-// samples from the decoded MetricFamily into the provided model.Vector.
-func (sd *SampleDecoder) Decode(s *model.Vector) error {
- err := sd.Dec.Decode(&sd.f)
- if err != nil {
- return err
- }
- *s, err = extractSamples(&sd.f, sd.Opts)
- return err
-}
-
-// ExtractSamples builds a slice of samples from the provided metric
-// families. If an error occurs during sample extraction, it continues to
-// extract from the remaining metric families. The returned error is the last
-// error that has occurred.
-func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
- var (
- all model.Vector
- lastErr error
- )
- for _, f := range fams {
- some, err := extractSamples(f, o)
- if err != nil {
- lastErr = err
- continue
- }
- all = append(all, some...)
- }
- return all, lastErr
-}
-
-func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) {
- switch f.GetType() {
- case dto.MetricType_COUNTER:
- return extractCounter(o, f), nil
- case dto.MetricType_GAUGE:
- return extractGauge(o, f), nil
- case dto.MetricType_SUMMARY:
- return extractSummary(o, f), nil
- case dto.MetricType_UNTYPED:
- return extractUntyped(o, f), nil
- case dto.MetricType_HISTOGRAM:
- return extractHistogram(o, f), nil
- }
- return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType())
-}
-
-func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Counter == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Counter.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractGauge(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Gauge == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Gauge.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractUntyped(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Untyped == nil {
- continue
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- smpl := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Untyped.GetValue()),
- }
-
- if m.TimestampMs != nil {
- smpl.Timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- } else {
- smpl.Timestamp = o.Timestamp
- }
-
- samples = append(samples, smpl)
- }
-
- return samples
-}
-
-func extractSummary(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Summary == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- for _, q := range m.Summary.Quantile {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- // BUG(matt): Update other names to "quantile".
- lset[model.LabelName(model.QuantileLabel)] = model.LabelValue(fmt.Sprint(q.GetQuantile()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName())
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetValue()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Summary.GetSampleCount()),
- Timestamp: timestamp,
- })
- }
-
- return samples
-}
-
-func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
- samples := make(model.Vector, 0, len(f.Metric))
-
- for _, m := range f.Metric {
- if m.Histogram == nil {
- continue
- }
-
- timestamp := o.Timestamp
- if m.TimestampMs != nil {
- timestamp = model.TimeFromUnixNano(*m.TimestampMs * 1000000)
- }
-
- infSeen := false
-
- for _, q := range m.Histogram.Bucket {
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue(fmt.Sprint(q.GetUpperBound()))
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- if math.IsInf(q.GetUpperBound(), +1) {
- infSeen = true
- }
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(q.GetCumulativeCount()),
- Timestamp: timestamp,
- })
- }
-
- lset := make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_sum")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleSum()),
- Timestamp: timestamp,
- })
-
- lset = make(model.LabelSet, len(m.Label)+1)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count")
-
- count := &model.Sample{
- Metric: model.Metric(lset),
- Value: model.SampleValue(m.Histogram.GetSampleCount()),
- Timestamp: timestamp,
- }
- samples = append(samples, count)
-
- if !infSeen {
- // Append an infinity bucket sample.
- lset := make(model.LabelSet, len(m.Label)+2)
- for _, p := range m.Label {
- lset[model.LabelName(p.GetName())] = model.LabelValue(p.GetValue())
- }
- lset[model.LabelName(model.BucketLabel)] = model.LabelValue("+Inf")
- lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_bucket")
-
- samples = append(samples, &model.Sample{
- Metric: model.Metric(lset),
- Value: count.Value,
- Timestamp: timestamp,
- })
- }
- }
-
- return samples
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/encode.go b/vendor/github.com/prometheus/common/expfmt/encode.go
deleted file mode 100644
index 7f6cbe7..0000000
--- a/vendor/github.com/prometheus/common/expfmt/encode.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "fmt"
- "io"
- "net/http"
-
- "google.golang.org/protobuf/encoding/protodelim"
- "google.golang.org/protobuf/encoding/prototext"
-
- "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg"
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// Encoder types encode metric families into an underlying wire protocol.
-type Encoder interface {
- Encode(*dto.MetricFamily) error
-}
-
-// Closer is implemented by Encoders that need to be closed to finalize
-// encoding. (For example, OpenMetrics needs a final `# EOF` line.)
-//
-// Note that all Encoder implementations returned from this package implement
-// Closer, too, even if the Close call is a no-op. This happens in preparation
-// for adding a Close method to the Encoder interface directly in a (mildly
-// breaking) release in the future.
-type Closer interface {
- Close() error
-}
-
-type encoderCloser struct {
- encode func(*dto.MetricFamily) error
- close func() error
-}
-
-func (ec encoderCloser) Encode(v *dto.MetricFamily) error {
- return ec.encode(v)
-}
-
-func (ec encoderCloser) Close() error {
- return ec.close()
-}
-
-// Negotiate returns the Content-Type based on the given Accept header. If no
-// appropriate accepted type is found, FmtText is returned (which is the
-// Prometheus text format). This function will never negotiate FmtOpenMetrics,
-// as the support is still experimental. To include the option to negotiate
-// FmtOpenMetrics, use NegotiateOpenMetrics.
-func Negotiate(h http.Header) Format {
- escapingScheme := Format(fmt.Sprintf("; escaping=%s", Format(model.NameEscapingScheme.String())))
- for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) {
- if escapeParam := ac.Params[model.EscapingKey]; escapeParam != "" {
- switch Format(escapeParam) {
- case model.AllowUTF8, model.EscapeUnderscores, model.EscapeDots, model.EscapeValues:
- escapingScheme = Format(fmt.Sprintf("; escaping=%s", escapeParam))
- default:
- // If the escaping parameter is unknown, ignore it.
- }
- }
- ver := ac.Params["version"]
- if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
- switch ac.Params["encoding"] {
- case "delimited":
- return fmtProtoDelim + escapingScheme
- case "text":
- return fmtProtoText + escapingScheme
- case "compact-text":
- return fmtProtoCompact + escapingScheme
- }
- }
- if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
- return fmtText + escapingScheme
- }
- }
- return fmtText + escapingScheme
-}
-
-// NegotiateIncludingOpenMetrics works like Negotiate but includes
-// FmtOpenMetrics as an option for the result. Note that this function is
-// temporary and will disappear once FmtOpenMetrics is fully supported and as
-// such may be negotiated by the normal Negotiate function.
-func NegotiateIncludingOpenMetrics(h http.Header) Format {
- escapingScheme := Format(fmt.Sprintf("; escaping=%s", Format(model.NameEscapingScheme.String())))
- for _, ac := range goautoneg.ParseAccept(h.Get(hdrAccept)) {
- if escapeParam := ac.Params[model.EscapingKey]; escapeParam != "" {
- switch Format(escapeParam) {
- case model.AllowUTF8, model.EscapeUnderscores, model.EscapeDots, model.EscapeValues:
- escapingScheme = Format(fmt.Sprintf("; escaping=%s", escapeParam))
- default:
- // If the escaping parameter is unknown, ignore it.
- }
- }
- ver := ac.Params["version"]
- if ac.Type+"/"+ac.SubType == ProtoType && ac.Params["proto"] == ProtoProtocol {
- switch ac.Params["encoding"] {
- case "delimited":
- return fmtProtoDelim + escapingScheme
- case "text":
- return fmtProtoText + escapingScheme
- case "compact-text":
- return fmtProtoCompact + escapingScheme
- }
- }
- if ac.Type == "text" && ac.SubType == "plain" && (ver == TextVersion || ver == "") {
- return fmtText + escapingScheme
- }
- if ac.Type+"/"+ac.SubType == OpenMetricsType && (ver == OpenMetricsVersion_0_0_1 || ver == OpenMetricsVersion_1_0_0 || ver == "") {
- switch ver {
- case OpenMetricsVersion_1_0_0:
- return fmtOpenMetrics_1_0_0 + escapingScheme
- default:
- return fmtOpenMetrics_0_0_1 + escapingScheme
- }
- }
- }
- return fmtText + escapingScheme
-}
-
-// NewEncoder returns a new encoder based on content type negotiation. All
-// Encoder implementations returned by NewEncoder also implement Closer, and
-// callers should always call the Close method. It is currently only required
-// for FmtOpenMetrics, but a future (breaking) release will add the Close method
-// to the Encoder interface directly. The current version of the Encoder
-// interface is kept for backwards compatibility.
-// In cases where the Format does not allow for UTF-8 names, the global
-// NameEscapingScheme will be applied.
-//
-// NewEncoder can be called with additional options to customize the OpenMetrics text output.
-// For example:
-// NewEncoder(w, FmtOpenMetrics_1_0_0, WithCreatedLines())
-//
-// Extra options are ignored for all other formats.
-func NewEncoder(w io.Writer, format Format, options ...EncoderOption) Encoder {
- escapingScheme := format.ToEscapingScheme()
-
- switch format.FormatType() {
- case TypeProtoDelim:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := protodelim.MarshalTo(w, v)
- return err
- },
- close: func() error { return nil },
- }
- case TypeProtoCompact:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, model.EscapeMetricFamily(v, escapingScheme).String())
- return err
- },
- close: func() error { return nil },
- }
- case TypeProtoText:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := fmt.Fprintln(w, prototext.Format(model.EscapeMetricFamily(v, escapingScheme)))
- return err
- },
- close: func() error { return nil },
- }
- case TypeTextPlain:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := MetricFamilyToText(w, model.EscapeMetricFamily(v, escapingScheme))
- return err
- },
- close: func() error { return nil },
- }
- case TypeOpenMetrics:
- return encoderCloser{
- encode: func(v *dto.MetricFamily) error {
- _, err := MetricFamilyToOpenMetrics(w, model.EscapeMetricFamily(v, escapingScheme), options...)
- return err
- },
- close: func() error {
- _, err := FinalizeOpenMetrics(w)
- return err
- },
- }
- }
- panic(fmt.Errorf("expfmt.NewEncoder: unknown format %q", format))
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go
deleted file mode 100644
index 6fc9555..0000000
--- a/vendor/github.com/prometheus/common/expfmt/expfmt.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package expfmt contains tools for reading and writing Prometheus metrics.
-package expfmt
-
-import (
- "strings"
-
- "github.com/prometheus/common/model"
-)
-
-// Format specifies the HTTP content type of the different wire protocols.
-type Format string
-
-// Constants to assemble the Content-Type values for the different wire
-// protocols. The Content-Type strings here are all for the legacy exposition
-// formats, where valid characters for metric names and label names are limited.
-// Support for arbitrary UTF-8 characters in those names is already partially
-// implemented in this module (see model.ValidationScheme), but to actually use
-// it on the wire, new content-type strings will have to be agreed upon and
-// added here.
-const (
- TextVersion = "0.0.4"
- ProtoType = `application/vnd.google.protobuf`
- ProtoProtocol = `io.prometheus.client.MetricFamily`
- protoFmt = ProtoType + "; proto=" + ProtoProtocol + ";"
- OpenMetricsType = `application/openmetrics-text`
- OpenMetricsVersion_0_0_1 = "0.0.1"
- OpenMetricsVersion_1_0_0 = "1.0.0"
-
- // The Content-Type values for the different wire protocols. Note that these
- // values are now unexported. If code was relying on comparisons to these
- // constants, instead use FormatType().
- fmtUnknown Format = ``
- fmtText Format = `text/plain; version=` + TextVersion + `; charset=utf-8`
- fmtProtoDelim Format = protoFmt + ` encoding=delimited`
- fmtProtoText Format = protoFmt + ` encoding=text`
- fmtProtoCompact Format = protoFmt + ` encoding=compact-text`
- fmtOpenMetrics_1_0_0 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_1_0_0 + `; charset=utf-8`
- fmtOpenMetrics_0_0_1 Format = OpenMetricsType + `; version=` + OpenMetricsVersion_0_0_1 + `; charset=utf-8`
-)
-
-const (
- hdrContentType = "Content-Type"
- hdrAccept = "Accept"
-)
-
-// FormatType is a Go enum representing the overall category for the given
-// Format. As the number of Format permutations increases, doing basic string
-// comparisons are not feasible, so this enum captures the most useful
-// high-level attribute of the Format string.
-type FormatType int
-
-const (
- TypeUnknown = iota
- TypeProtoCompact
- TypeProtoDelim
- TypeProtoText
- TypeTextPlain
- TypeOpenMetrics
-)
-
-// NewFormat generates a new Format from the type provided. Mostly used for
-// tests, most Formats should be generated as part of content negotiation in
-// encode.go.
-func NewFormat(t FormatType) Format {
- switch t {
- case TypeProtoCompact:
- return fmtProtoCompact
- case TypeProtoDelim:
- return fmtProtoDelim
- case TypeProtoText:
- return fmtProtoText
- case TypeTextPlain:
- return fmtText
- case TypeOpenMetrics:
- return fmtOpenMetrics_1_0_0
- default:
- return fmtUnknown
- }
-}
-
-// FormatType deduces an overall FormatType for the given format.
-func (f Format) FormatType() FormatType {
- toks := strings.Split(string(f), ";")
- if len(toks) < 2 {
- return TypeUnknown
- }
-
- params := make(map[string]string)
- for i, t := range toks {
- if i == 0 {
- continue
- }
- args := strings.Split(t, "=")
- if len(args) != 2 {
- continue
- }
- params[strings.TrimSpace(args[0])] = strings.TrimSpace(args[1])
- }
-
- switch strings.TrimSpace(toks[0]) {
- case ProtoType:
- if params["proto"] != ProtoProtocol {
- return TypeUnknown
- }
- switch params["encoding"] {
- case "delimited":
- return TypeProtoDelim
- case "text":
- return TypeProtoText
- case "compact-text":
- return TypeProtoCompact
- default:
- return TypeUnknown
- }
- case OpenMetricsType:
- if params["charset"] != "utf-8" {
- return TypeUnknown
- }
- return TypeOpenMetrics
- case "text/plain":
- v, ok := params["version"]
- if !ok {
- return TypeTextPlain
- }
- if v == TextVersion {
- return TypeTextPlain
- }
- return TypeUnknown
- default:
- return TypeUnknown
- }
-}
-
-// ToEscapingScheme returns an EscapingScheme depending on the Format. Iff the
-// Format contains a escaping=allow-utf-8 term, it will select NoEscaping. If a valid
-// "escaping" term exists, that will be used. Otherwise, the global default will
-// be returned.
-func (format Format) ToEscapingScheme() model.EscapingScheme {
- for _, p := range strings.Split(string(format), ";") {
- toks := strings.Split(p, "=")
- if len(toks) != 2 {
- continue
- }
- key, value := strings.TrimSpace(toks[0]), strings.TrimSpace(toks[1])
- if key == model.EscapingKey {
- scheme, err := model.ToEscapingScheme(value)
- if err != nil {
- return model.NameEscapingScheme
- }
- return scheme
- }
- }
- return model.NameEscapingScheme
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz.go b/vendor/github.com/prometheus/common/expfmt/fuzz.go
deleted file mode 100644
index dfac962..0000000
--- a/vendor/github.com/prometheus/common/expfmt/fuzz.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Build only when actually fuzzing
-//go:build gofuzz
-// +build gofuzz
-
-package expfmt
-
-import "bytes"
-
-// Fuzz text metric parser with with github.com/dvyukov/go-fuzz:
-//
-// go-fuzz-build github.com/prometheus/common/expfmt
-// go-fuzz -bin expfmt-fuzz.zip -workdir fuzz
-//
-// Further input samples should go in the folder fuzz/corpus.
-func Fuzz(in []byte) int {
- parser := TextParser{}
- _, err := parser.TextToMetricFamilies(bytes.NewReader(in))
-
- if err != nil {
- return 0
- }
-
- return 1
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
deleted file mode 100644
index 63fc1f4..0000000
--- a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go
+++ /dev/null
@@ -1,643 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
-
- "google.golang.org/protobuf/types/known/timestamppb"
-
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-type encoderOption struct {
- withCreatedLines bool
-}
-
-type EncoderOption func(*encoderOption)
-
-// WithCreatedLines is an EncoderOption that configures the OpenMetrics encoder
-// to include _created lines (See
-// https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#counter-1).
-// Created timestamps can improve the accuracy of series reset detection, but
-// come with a bandwidth cost.
-//
-// At the time of writing, created timestamp ingestion is still experimental in
-// Prometheus and need to be enabled with the feature-flag
-// `--feature-flag=created-timestamp-zero-ingestion`, and breaking changes are
-// still possible. Therefore, it is recommended to use this feature with caution.
-func WithCreatedLines() EncoderOption {
- return func(t *encoderOption) {
- t.withCreatedLines = true
- }
-}
-
-// MetricFamilyToOpenMetrics converts a MetricFamily proto message into the
-// OpenMetrics text format and writes the resulting lines to 'out'. It returns
-// the number of bytes written and any error encountered. The output will have
-// the same order as the input, no further sorting is performed. Furthermore,
-// this function assumes the input is already sanitized and does not perform any
-// sanity checks. If the input contains duplicate metrics or invalid metric or
-// label names, the conversion will result in invalid text format output.
-//
-// If metric names conform to the legacy validation pattern, they will be placed
-// outside the brackets in the traditional way, like `foo{}`. If the metric name
-// fails the legacy validation check, it will be placed quoted inside the
-// brackets: `{"foo"}`. As stated above, the input is assumed to be santized and
-// no error will be thrown in this case.
-//
-// Similar to metric names, if label names conform to the legacy validation
-// pattern, they will be unquoted as normal, like `foo{bar="baz"}`. If the label
-// name fails the legacy validation check, it will be quoted:
-// `foo{"bar"="baz"}`. As stated above, the input is assumed to be santized and
-// no error will be thrown in this case.
-//
-// This function fulfills the type 'expfmt.encoder'.
-//
-// Note that OpenMetrics requires a final `# EOF` line. Since this function acts
-// on individual metric families, it is the responsibility of the caller to
-// append this line to 'out' once all metric families have been written.
-// Conveniently, this can be done by calling FinalizeOpenMetrics.
-//
-// The output should be fully OpenMetrics compliant. However, there are a few
-// missing features and peculiarities to avoid complications when switching from
-// Prometheus to OpenMetrics or vice versa:
-//
-// - Counters are expected to have the `_total` suffix in their metric name. In
-// the output, the suffix will be truncated from the `# TYPE` and `# HELP`
-// line. A counter with a missing `_total` suffix is not an error. However,
-// its type will be set to `unknown` in that case to avoid invalid OpenMetrics
-// output.
-//
-// - No support for the following (optional) features: `# UNIT` line, info type,
-// stateset type, gaugehistogram type.
-//
-// - The size of exemplar labels is not checked (i.e. it's possible to create
-// exemplars that are larger than allowed by the OpenMetrics specification).
-//
-// - The value of Counters is not checked. (OpenMetrics doesn't allow counters
-// with a `NaN` value.)
-func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...EncoderOption) (written int, err error) {
- toOM := encoderOption{}
- for _, option := range options {
- option(&toOM)
- }
-
- name := in.GetName()
- if name == "" {
- return 0, fmt.Errorf("MetricFamily has no name: %s", in)
- }
-
- // Try the interface upgrade. If it doesn't work, we'll use a
- // bufio.Writer from the sync.Pool.
- w, ok := out.(enhancedWriter)
- if !ok {
- b := bufPool.Get().(*bufio.Writer)
- b.Reset(out)
- w = b
- defer func() {
- bErr := b.Flush()
- if err == nil {
- err = bErr
- }
- bufPool.Put(b)
- }()
- }
-
- var (
- n int
- metricType = in.GetType()
- shortName = name
- )
- if metricType == dto.MetricType_COUNTER && strings.HasSuffix(shortName, "_total") {
- shortName = name[:len(name)-6]
- }
-
- // Comments, first HELP, then TYPE.
- if in.Help != nil {
- n, err = w.WriteString("# HELP ")
- written += n
- if err != nil {
- return
- }
- n, err = writeName(w, shortName)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return
- }
- n, err = writeEscapedString(w, *in.Help, true)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return
- }
- }
- n, err = w.WriteString("# TYPE ")
- written += n
- if err != nil {
- return
- }
- n, err = writeName(w, shortName)
- written += n
- if err != nil {
- return
- }
- switch metricType {
- case dto.MetricType_COUNTER:
- if strings.HasSuffix(name, "_total") {
- n, err = w.WriteString(" counter\n")
- } else {
- n, err = w.WriteString(" unknown\n")
- }
- case dto.MetricType_GAUGE:
- n, err = w.WriteString(" gauge\n")
- case dto.MetricType_SUMMARY:
- n, err = w.WriteString(" summary\n")
- case dto.MetricType_UNTYPED:
- n, err = w.WriteString(" unknown\n")
- case dto.MetricType_HISTOGRAM:
- n, err = w.WriteString(" histogram\n")
- default:
- return written, fmt.Errorf("unknown metric type %s", metricType.String())
- }
- written += n
- if err != nil {
- return
- }
-
- var createdTsBytesWritten int
- // Finally the samples, one line for each.
- for _, metric := range in.Metric {
- switch metricType {
- case dto.MetricType_COUNTER:
- if metric.Counter == nil {
- return written, fmt.Errorf(
- "expected counter in metric %s %s", name, metric,
- )
- }
- // Note that we have ensured above that either the name
- // ends on `_total` or that the rendered type is
- // `unknown`. Therefore, no `_total` must be added here.
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Counter.GetValue(), 0, false,
- metric.Counter.Exemplar,
- )
- if toOM.withCreatedLines && metric.Counter.CreatedTimestamp != nil {
- createdTsBytesWritten, err = writeOpenMetricsCreated(w, name, "_total", metric, "", 0, metric.Counter.GetCreatedTimestamp())
- n += createdTsBytesWritten
- }
- case dto.MetricType_GAUGE:
- if metric.Gauge == nil {
- return written, fmt.Errorf(
- "expected gauge in metric %s %s", name, metric,
- )
- }
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Gauge.GetValue(), 0, false,
- nil,
- )
- case dto.MetricType_UNTYPED:
- if metric.Untyped == nil {
- return written, fmt.Errorf(
- "expected untyped in metric %s %s", name, metric,
- )
- }
- n, err = writeOpenMetricsSample(
- w, name, "", metric, "", 0,
- metric.Untyped.GetValue(), 0, false,
- nil,
- )
- case dto.MetricType_SUMMARY:
- if metric.Summary == nil {
- return written, fmt.Errorf(
- "expected summary in metric %s %s", name, metric,
- )
- }
- for _, q := range metric.Summary.Quantile {
- n, err = writeOpenMetricsSample(
- w, name, "", metric,
- model.QuantileLabel, q.GetQuantile(),
- q.GetValue(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeOpenMetricsSample(
- w, name, "_sum", metric, "", 0,
- metric.Summary.GetSampleSum(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeOpenMetricsSample(
- w, name, "_count", metric, "", 0,
- 0, metric.Summary.GetSampleCount(), true,
- nil,
- )
- if toOM.withCreatedLines && metric.Summary.CreatedTimestamp != nil {
- createdTsBytesWritten, err = writeOpenMetricsCreated(w, name, "", metric, "", 0, metric.Summary.GetCreatedTimestamp())
- n += createdTsBytesWritten
- }
- case dto.MetricType_HISTOGRAM:
- if metric.Histogram == nil {
- return written, fmt.Errorf(
- "expected histogram in metric %s %s", name, metric,
- )
- }
- infSeen := false
- for _, b := range metric.Histogram.Bucket {
- n, err = writeOpenMetricsSample(
- w, name, "_bucket", metric,
- model.BucketLabel, b.GetUpperBound(),
- 0, b.GetCumulativeCount(), true,
- b.Exemplar,
- )
- written += n
- if err != nil {
- return
- }
- if math.IsInf(b.GetUpperBound(), +1) {
- infSeen = true
- }
- }
- if !infSeen {
- n, err = writeOpenMetricsSample(
- w, name, "_bucket", metric,
- model.BucketLabel, math.Inf(+1),
- 0, metric.Histogram.GetSampleCount(), true,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeOpenMetricsSample(
- w, name, "_sum", metric, "", 0,
- metric.Histogram.GetSampleSum(), 0, false,
- nil,
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeOpenMetricsSample(
- w, name, "_count", metric, "", 0,
- 0, metric.Histogram.GetSampleCount(), true,
- nil,
- )
- if toOM.withCreatedLines && metric.Histogram.CreatedTimestamp != nil {
- createdTsBytesWritten, err = writeOpenMetricsCreated(w, name, "", metric, "", 0, metric.Histogram.GetCreatedTimestamp())
- n += createdTsBytesWritten
- }
- default:
- return written, fmt.Errorf(
- "unexpected type in metric %s %s", name, metric,
- )
- }
- written += n
- if err != nil {
- return
- }
- }
- return
-}
-
-// FinalizeOpenMetrics writes the final `# EOF\n` line required by OpenMetrics.
-func FinalizeOpenMetrics(w io.Writer) (written int, err error) {
- return w.Write([]byte("# EOF\n"))
-}
-
-// writeOpenMetricsSample writes a single sample in OpenMetrics text format to
-// w, given the metric name, the metric proto message itself, optionally an
-// additional label name with a float64 value (use empty string as label name if
-// not required), the value (optionally as float64 or uint64, determined by
-// useIntValue), and optionally an exemplar (use nil if not required). The
-// function returns the number of bytes written and any error encountered.
-func writeOpenMetricsSample(
- w enhancedWriter,
- name, suffix string,
- metric *dto.Metric,
- additionalLabelName string, additionalLabelValue float64,
- floatValue float64, intValue uint64, useIntValue bool,
- exemplar *dto.Exemplar,
-) (int, error) {
- written := 0
- n, err := writeOpenMetricsNameAndLabelPairs(
- w, name+suffix, metric.Label, additionalLabelName, additionalLabelValue,
- )
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- if useIntValue {
- n, err = writeUint(w, intValue)
- } else {
- n, err = writeOpenMetricsFloat(w, floatValue)
- }
- written += n
- if err != nil {
- return written, err
- }
- if metric.TimestampMs != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- // TODO(beorn7): Format this directly without converting to a float first.
- n, err = writeOpenMetricsFloat(w, float64(*metric.TimestampMs)/1000)
- written += n
- if err != nil {
- return written, err
- }
- }
- if exemplar != nil && len(exemplar.Label) > 0 {
- n, err = writeExemplar(w, exemplar)
- written += n
- if err != nil {
- return written, err
- }
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeOpenMetricsNameAndLabelPairs works like writeOpenMetricsSample but
-// formats the float in OpenMetrics style.
-func writeOpenMetricsNameAndLabelPairs(
- w enhancedWriter,
- name string,
- in []*dto.LabelPair,
- additionalLabelName string, additionalLabelValue float64,
-) (int, error) {
- var (
- written int
- separator byte = '{'
- metricInsideBraces = false
- )
-
- if name != "" {
- // If the name does not pass the legacy validity check, we must put the
- // metric name inside the braces, quoted.
- if !model.IsValidLegacyMetricName(model.LabelValue(name)) {
- metricInsideBraces = true
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
-
- n, err := writeName(w, name)
- written += n
- if err != nil {
- return written, err
- }
- }
-
- if len(in) == 0 && additionalLabelName == "" {
- if metricInsideBraces {
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- }
- return written, nil
- }
-
- for _, lp := range in {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := writeName(w, lp.GetName())
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeEscapedString(w, lp.GetValue(), true)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
- if additionalLabelName != "" {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(additionalLabelName)
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsFloat(w, additionalLabelValue)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- }
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeOpenMetricsCreated writes the created timestamp for a single time series
-// following OpenMetrics text format to w, given the metric name, the metric proto
-// message itself, optionally a suffix to be removed, e.g. '_total' for counters,
-// an additional label name with a float64 value (use empty string as label name if
-// not required) and the timestamp that represents the created timestamp.
-// The function returns the number of bytes written and any error encountered.
-func writeOpenMetricsCreated(w enhancedWriter,
- name, suffixToTrim string, metric *dto.Metric,
- additionalLabelName string, additionalLabelValue float64,
- createdTimestamp *timestamppb.Timestamp,
-) (int, error) {
- written := 0
- n, err := writeOpenMetricsNameAndLabelPairs(
- w, strings.TrimSuffix(name, suffixToTrim)+"_created", metric.Label, additionalLabelName, additionalLabelValue,
- )
- written += n
- if err != nil {
- return written, err
- }
-
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
-
- // TODO(beorn7): Format this directly from components of ts to
- // avoid overflow/underflow and precision issues of the float
- // conversion.
- n, err = writeOpenMetricsFloat(w, float64(createdTimestamp.AsTime().UnixNano())/1e9)
- written += n
- if err != nil {
- return written, err
- }
-
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeExemplar writes the provided exemplar in OpenMetrics format to w. The
-// function returns the number of bytes written and any error encountered.
-func writeExemplar(w enhancedWriter, e *dto.Exemplar) (int, error) {
- written := 0
- n, err := w.WriteString(" # ")
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsNameAndLabelPairs(w, "", e.Label, "", 0)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeOpenMetricsFloat(w, e.GetValue())
- written += n
- if err != nil {
- return written, err
- }
- if e.Timestamp != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- err = (*e).Timestamp.CheckValid()
- if err != nil {
- return written, err
- }
- ts := (*e).Timestamp.AsTime()
- // TODO(beorn7): Format this directly from components of ts to
- // avoid overflow/underflow and precision issues of the float
- // conversion.
- n, err = writeOpenMetricsFloat(w, float64(ts.UnixNano())/1e9)
- written += n
- if err != nil {
- return written, err
- }
- }
- return written, nil
-}
-
-// writeOpenMetricsFloat works like writeFloat but appends ".0" if the resulting
-// number would otherwise contain neither a "." nor an "e".
-func writeOpenMetricsFloat(w enhancedWriter, f float64) (int, error) {
- switch {
- case f == 1:
- return w.WriteString("1.0")
- case f == 0:
- return w.WriteString("0.0")
- case f == -1:
- return w.WriteString("-1.0")
- case math.IsNaN(f):
- return w.WriteString("NaN")
- case math.IsInf(f, +1):
- return w.WriteString("+Inf")
- case math.IsInf(f, -1):
- return w.WriteString("-Inf")
- default:
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
- if !bytes.ContainsAny(*bp, "e.") {
- *bp = append(*bp, '.', '0')
- }
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
- }
-}
-
-// writeUint is like writeInt just for uint64.
-func writeUint(w enhancedWriter, u uint64) (int, error) {
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendUint((*bp)[:0], u, 10)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go
deleted file mode 100644
index f9b8265..0000000
--- a/vendor/github.com/prometheus/common/expfmt/text_create.go
+++ /dev/null
@@ -1,520 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
- "sync"
-
- "github.com/prometheus/common/model"
-
- dto "github.com/prometheus/client_model/go"
-)
-
-// enhancedWriter has all the enhanced write functions needed here. bufio.Writer
-// implements it.
-type enhancedWriter interface {
- io.Writer
- WriteRune(r rune) (n int, err error)
- WriteString(s string) (n int, err error)
- WriteByte(c byte) error
-}
-
-const (
- initialNumBufSize = 24
-)
-
-var (
- bufPool = sync.Pool{
- New: func() interface{} {
- return bufio.NewWriter(io.Discard)
- },
- }
- numBufPool = sync.Pool{
- New: func() interface{} {
- b := make([]byte, 0, initialNumBufSize)
- return &b
- },
- }
-)
-
-// MetricFamilyToText converts a MetricFamily proto message into text format and
-// writes the resulting lines to 'out'. It returns the number of bytes written
-// and any error encountered. The output will have the same order as the input,
-// no further sorting is performed. Furthermore, this function assumes the input
-// is already sanitized and does not perform any sanity checks. If the input
-// contains duplicate metrics or invalid metric or label names, the conversion
-// will result in invalid text format output.
-//
-// If metric names conform to the legacy validation pattern, they will be placed
-// outside the brackets in the traditional way, like `foo{}`. If the metric name
-// fails the legacy validation check, it will be placed quoted inside the
-// brackets: `{"foo"}`. As stated above, the input is assumed to be santized and
-// no error will be thrown in this case.
-//
-// Similar to metric names, if label names conform to the legacy validation
-// pattern, they will be unquoted as normal, like `foo{bar="baz"}`. If the label
-// name fails the legacy validation check, it will be quoted:
-// `foo{"bar"="baz"}`. As stated above, the input is assumed to be santized and
-// no error will be thrown in this case.
-//
-// This method fulfills the type 'prometheus.encoder'.
-func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) {
- // Fail-fast checks.
- if len(in.Metric) == 0 {
- return 0, fmt.Errorf("MetricFamily has no metrics: %s", in)
- }
- name := in.GetName()
- if name == "" {
- return 0, fmt.Errorf("MetricFamily has no name: %s", in)
- }
-
- // Try the interface upgrade. If it doesn't work, we'll use a
- // bufio.Writer from the sync.Pool.
- w, ok := out.(enhancedWriter)
- if !ok {
- b := bufPool.Get().(*bufio.Writer)
- b.Reset(out)
- w = b
- defer func() {
- bErr := b.Flush()
- if err == nil {
- err = bErr
- }
- bufPool.Put(b)
- }()
- }
-
- var n int
-
- // Comments, first HELP, then TYPE.
- if in.Help != nil {
- n, err = w.WriteString("# HELP ")
- written += n
- if err != nil {
- return
- }
- n, err = writeName(w, name)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return
- }
- n, err = writeEscapedString(w, *in.Help, false)
- written += n
- if err != nil {
- return
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return
- }
- }
- n, err = w.WriteString("# TYPE ")
- written += n
- if err != nil {
- return
- }
- n, err = writeName(w, name)
- written += n
- if err != nil {
- return
- }
- metricType := in.GetType()
- switch metricType {
- case dto.MetricType_COUNTER:
- n, err = w.WriteString(" counter\n")
- case dto.MetricType_GAUGE:
- n, err = w.WriteString(" gauge\n")
- case dto.MetricType_SUMMARY:
- n, err = w.WriteString(" summary\n")
- case dto.MetricType_UNTYPED:
- n, err = w.WriteString(" untyped\n")
- case dto.MetricType_HISTOGRAM:
- n, err = w.WriteString(" histogram\n")
- default:
- return written, fmt.Errorf("unknown metric type %s", metricType.String())
- }
- written += n
- if err != nil {
- return
- }
-
- // Finally the samples, one line for each.
- for _, metric := range in.Metric {
- switch metricType {
- case dto.MetricType_COUNTER:
- if metric.Counter == nil {
- return written, fmt.Errorf(
- "expected counter in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Counter.GetValue(),
- )
- case dto.MetricType_GAUGE:
- if metric.Gauge == nil {
- return written, fmt.Errorf(
- "expected gauge in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Gauge.GetValue(),
- )
- case dto.MetricType_UNTYPED:
- if metric.Untyped == nil {
- return written, fmt.Errorf(
- "expected untyped in metric %s %s", name, metric,
- )
- }
- n, err = writeSample(
- w, name, "", metric, "", 0,
- metric.Untyped.GetValue(),
- )
- case dto.MetricType_SUMMARY:
- if metric.Summary == nil {
- return written, fmt.Errorf(
- "expected summary in metric %s %s", name, metric,
- )
- }
- for _, q := range metric.Summary.Quantile {
- n, err = writeSample(
- w, name, "", metric,
- model.QuantileLabel, q.GetQuantile(),
- q.GetValue(),
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeSample(
- w, name, "_sum", metric, "", 0,
- metric.Summary.GetSampleSum(),
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeSample(
- w, name, "_count", metric, "", 0,
- float64(metric.Summary.GetSampleCount()),
- )
- case dto.MetricType_HISTOGRAM:
- if metric.Histogram == nil {
- return written, fmt.Errorf(
- "expected histogram in metric %s %s", name, metric,
- )
- }
- infSeen := false
- for _, b := range metric.Histogram.Bucket {
- n, err = writeSample(
- w, name, "_bucket", metric,
- model.BucketLabel, b.GetUpperBound(),
- float64(b.GetCumulativeCount()),
- )
- written += n
- if err != nil {
- return
- }
- if math.IsInf(b.GetUpperBound(), +1) {
- infSeen = true
- }
- }
- if !infSeen {
- n, err = writeSample(
- w, name, "_bucket", metric,
- model.BucketLabel, math.Inf(+1),
- float64(metric.Histogram.GetSampleCount()),
- )
- written += n
- if err != nil {
- return
- }
- }
- n, err = writeSample(
- w, name, "_sum", metric, "", 0,
- metric.Histogram.GetSampleSum(),
- )
- written += n
- if err != nil {
- return
- }
- n, err = writeSample(
- w, name, "_count", metric, "", 0,
- float64(metric.Histogram.GetSampleCount()),
- )
- default:
- return written, fmt.Errorf(
- "unexpected type in metric %s %s", name, metric,
- )
- }
- written += n
- if err != nil {
- return
- }
- }
- return
-}
-
-// writeSample writes a single sample in text format to w, given the metric
-// name, the metric proto message itself, optionally an additional label name
-// with a float64 value (use empty string as label name if not required), and
-// the value. The function returns the number of bytes written and any error
-// encountered.
-func writeSample(
- w enhancedWriter,
- name, suffix string,
- metric *dto.Metric,
- additionalLabelName string, additionalLabelValue float64,
- value float64,
-) (int, error) {
- written := 0
- n, err := writeNameAndLabelPairs(
- w, name+suffix, metric.Label, additionalLabelName, additionalLabelValue,
- )
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeFloat(w, value)
- written += n
- if err != nil {
- return written, err
- }
- if metric.TimestampMs != nil {
- err = w.WriteByte(' ')
- written++
- if err != nil {
- return written, err
- }
- n, err = writeInt(w, *metric.TimestampMs)
- written += n
- if err != nil {
- return written, err
- }
- }
- err = w.WriteByte('\n')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeNameAndLabelPairs converts a slice of LabelPair proto messages plus the
-// explicitly given metric name and additional label pair into text formatted as
-// required by the text format and writes it to 'w'. An empty slice in
-// combination with an empty string 'additionalLabelName' results in nothing
-// being written. Otherwise, the label pairs are written, escaped as required by
-// the text format, and enclosed in '{...}'. The function returns the number of
-// bytes written and any error encountered. If the metric name is not
-// legacy-valid, it will be put inside the brackets as well. Legacy-invalid
-// label names will also be quoted.
-func writeNameAndLabelPairs(
- w enhancedWriter,
- name string,
- in []*dto.LabelPair,
- additionalLabelName string, additionalLabelValue float64,
-) (int, error) {
- var (
- written int
- separator byte = '{'
- metricInsideBraces = false
- )
-
- if name != "" {
- // If the name does not pass the legacy validity check, we must put the
- // metric name inside the braces.
- if !model.IsValidLegacyMetricName(model.LabelValue(name)) {
- metricInsideBraces = true
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
- n, err := writeName(w, name)
- written += n
- if err != nil {
- return written, err
- }
- }
-
- if len(in) == 0 && additionalLabelName == "" {
- if metricInsideBraces {
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- }
- return written, nil
- }
-
- for _, lp := range in {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := writeName(w, lp.GetName())
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeEscapedString(w, lp.GetValue(), true)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- separator = ','
- }
- if additionalLabelName != "" {
- err := w.WriteByte(separator)
- written++
- if err != nil {
- return written, err
- }
- n, err := w.WriteString(additionalLabelName)
- written += n
- if err != nil {
- return written, err
- }
- n, err = w.WriteString(`="`)
- written += n
- if err != nil {
- return written, err
- }
- n, err = writeFloat(w, additionalLabelValue)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- }
- err := w.WriteByte('}')
- written++
- if err != nil {
- return written, err
- }
- return written, nil
-}
-
-// writeEscapedString replaces '\' by '\\', new line character by '\n', and - if
-// includeDoubleQuote is true - '"' by '\"'.
-var (
- escaper = strings.NewReplacer("\\", `\\`, "\n", `\n`)
- quotedEscaper = strings.NewReplacer("\\", `\\`, "\n", `\n`, "\"", `\"`)
-)
-
-func writeEscapedString(w enhancedWriter, v string, includeDoubleQuote bool) (int, error) {
- if includeDoubleQuote {
- return quotedEscaper.WriteString(w, v)
- }
- return escaper.WriteString(w, v)
-}
-
-// writeFloat is equivalent to fmt.Fprint with a float64 argument but hardcodes
-// a few common cases for increased efficiency. For non-hardcoded cases, it uses
-// strconv.AppendFloat to avoid allocations, similar to writeInt.
-func writeFloat(w enhancedWriter, f float64) (int, error) {
- switch {
- case f == 1:
- return 1, w.WriteByte('1')
- case f == 0:
- return 1, w.WriteByte('0')
- case f == -1:
- return w.WriteString("-1")
- case math.IsNaN(f):
- return w.WriteString("NaN")
- case math.IsInf(f, +1):
- return w.WriteString("+Inf")
- case math.IsInf(f, -1):
- return w.WriteString("-Inf")
- default:
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendFloat((*bp)[:0], f, 'g', -1, 64)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
- }
-}
-
-// writeInt is equivalent to fmt.Fprint with an int64 argument but uses
-// strconv.AppendInt with a byte slice taken from a sync.Pool to avoid
-// allocations.
-func writeInt(w enhancedWriter, i int64) (int, error) {
- bp := numBufPool.Get().(*[]byte)
- *bp = strconv.AppendInt((*bp)[:0], i, 10)
- written, err := w.Write(*bp)
- numBufPool.Put(bp)
- return written, err
-}
-
-// writeName writes a string as-is if it complies with the legacy naming
-// scheme, or escapes it in double quotes if not.
-func writeName(w enhancedWriter, name string) (int, error) {
- if model.IsValidLegacyMetricName(model.LabelValue(name)) {
- return w.WriteString(name)
- }
- var written int
- var err error
- err = w.WriteByte('"')
- written++
- if err != nil {
- return written, err
- }
- var n int
- n, err = writeEscapedString(w, name, true)
- written += n
- if err != nil {
- return written, err
- }
- err = w.WriteByte('"')
- written++
- return written, err
-}
diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go
deleted file mode 100644
index 2649021..0000000
--- a/vendor/github.com/prometheus/common/expfmt/text_parse.go
+++ /dev/null
@@ -1,781 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package expfmt
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "io"
- "math"
- "strconv"
- "strings"
-
- dto "github.com/prometheus/client_model/go"
-
- "google.golang.org/protobuf/proto"
-
- "github.com/prometheus/common/model"
-)
-
-// A stateFn is a function that represents a state in a state machine. By
-// executing it, the state is progressed to the next state. The stateFn returns
-// another stateFn, which represents the new state. The end state is represented
-// by nil.
-type stateFn func() stateFn
-
-// ParseError signals errors while parsing the simple and flat text-based
-// exchange format.
-type ParseError struct {
- Line int
- Msg string
-}
-
-// Error implements the error interface.
-func (e ParseError) Error() string {
- return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg)
-}
-
-// TextParser is used to parse the simple and flat text-based exchange format. Its
-// zero value is ready to use.
-type TextParser struct {
- metricFamiliesByName map[string]*dto.MetricFamily
- buf *bufio.Reader // Where the parsed input is read through.
- err error // Most recent error.
- lineCount int // Tracks the line count for error messages.
- currentByte byte // The most recent byte read.
- currentToken bytes.Buffer // Re-used each time a token has to be gathered from multiple bytes.
- currentMF *dto.MetricFamily
- currentMetric *dto.Metric
- currentLabelPair *dto.LabelPair
-
- // The remaining member variables are only used for summaries/histograms.
- currentLabels map[string]string // All labels including '__name__' but excluding 'quantile'/'le'
- // Summary specific.
- summaries map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentQuantile float64
- // Histogram specific.
- histograms map[uint64]*dto.Metric // Key is created with LabelsToSignature.
- currentBucket float64
- // These tell us if the currently processed line ends on '_count' or
- // '_sum' respectively and belong to a summary/histogram, representing the sample
- // count and sum of that summary/histogram.
- currentIsSummaryCount, currentIsSummarySum bool
- currentIsHistogramCount, currentIsHistogramSum bool
-}
-
-// TextToMetricFamilies reads 'in' as the simple and flat text-based exchange
-// format and creates MetricFamily proto messages. It returns the MetricFamily
-// proto messages in a map where the metric names are the keys, along with any
-// error encountered.
-//
-// If the input contains duplicate metrics (i.e. lines with the same metric name
-// and exactly the same label set), the resulting MetricFamily will contain
-// duplicate Metric proto messages. Similar is true for duplicate label
-// names. Checks for duplicates have to be performed separately, if required.
-// Also note that neither the metrics within each MetricFamily are sorted nor
-// the label pairs within each Metric. Sorting is not required for the most
-// frequent use of this method, which is sample ingestion in the Prometheus
-// server. However, for presentation purposes, you might want to sort the
-// metrics, and in some cases, you must sort the labels, e.g. for consumption by
-// the metric family injection hook of the Prometheus registry.
-//
-// Summaries and histograms are rather special beasts. You would probably not
-// use them in the simple text format anyway. This method can deal with
-// summaries and histograms if they are presented in exactly the way the
-// text.Create function creates them.
-//
-// This method must not be called concurrently. If you want to parse different
-// input concurrently, instantiate a separate Parser for each goroutine.
-func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) {
- p.reset(in)
- for nextState := p.startOfLine; nextState != nil; nextState = nextState() {
- // Magic happens here...
- }
- // Get rid of empty metric families.
- for k, mf := range p.metricFamiliesByName {
- if len(mf.GetMetric()) == 0 {
- delete(p.metricFamiliesByName, k)
- }
- }
- // If p.err is io.EOF now, we have run into a premature end of the input
- // stream. Turn this error into something nicer and more
- // meaningful. (io.EOF is often used as a signal for the legitimate end
- // of an input stream.)
- if p.err != nil && errors.Is(p.err, io.EOF) {
- p.parseError("unexpected end of input stream")
- }
- return p.metricFamiliesByName, p.err
-}
-
-func (p *TextParser) reset(in io.Reader) {
- p.metricFamiliesByName = map[string]*dto.MetricFamily{}
- if p.buf == nil {
- p.buf = bufio.NewReader(in)
- } else {
- p.buf.Reset(in)
- }
- p.err = nil
- p.lineCount = 0
- if p.summaries == nil || len(p.summaries) > 0 {
- p.summaries = map[uint64]*dto.Metric{}
- }
- if p.histograms == nil || len(p.histograms) > 0 {
- p.histograms = map[uint64]*dto.Metric{}
- }
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
-}
-
-// startOfLine represents the state where the next byte read from p.buf is the
-// start of a line (or whitespace leading up to it).
-func (p *TextParser) startOfLine() stateFn {
- p.lineCount++
- if p.skipBlankTab(); p.err != nil {
- // This is the only place that we expect to see io.EOF,
- // which is not an error but the signal that we are done.
- // Any other error that happens to align with the start of
- // a line is still an error.
- if errors.Is(p.err, io.EOF) {
- p.err = nil
- }
- return nil
- }
- switch p.currentByte {
- case '#':
- return p.startComment
- case '\n':
- return p.startOfLine // Empty line, start the next one.
- }
- return p.readingMetricName
-}
-
-// startComment represents the state where the next byte read from p.buf is the
-// start of a comment (or whitespace leading up to it).
-func (p *TextParser) startComment() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- // If we have hit the end of line already, there is nothing left
- // to do. This is not considered a syntax error.
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- keyword := p.currentToken.String()
- if keyword != "HELP" && keyword != "TYPE" {
- // Generic comment, ignore by fast forwarding to end of line.
- for p.currentByte != '\n' {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return nil // Unexpected end of input.
- }
- }
- return p.startOfLine
- }
- // There is something. Next has to be a metric name.
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenAsMetricName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- if !isBlankOrTab(p.currentByte) {
- p.parseError("invalid metric name in comment")
- return nil
- }
- p.setOrCreateCurrentMF()
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '\n' {
- // At the end of the line already.
- // Again, this is not considered a syntax error.
- return p.startOfLine
- }
- switch keyword {
- case "HELP":
- return p.readingHelp
- case "TYPE":
- return p.readingType
- }
- panic(fmt.Sprintf("code error: unexpected keyword %q", keyword))
-}
-
-// readingMetricName represents the state where the last byte read (now in
-// p.currentByte) is the first byte of a metric name.
-func (p *TextParser) readingMetricName() stateFn {
- if p.readTokenAsMetricName(); p.err != nil {
- return nil
- }
- if p.currentToken.Len() == 0 {
- p.parseError("invalid metric name")
- return nil
- }
- p.setOrCreateCurrentMF()
- // Now is the time to fix the type if it hasn't happened yet.
- if p.currentMF.Type == nil {
- p.currentMF.Type = dto.MetricType_UNTYPED.Enum()
- }
- p.currentMetric = &dto.Metric{}
- // Do not append the newly created currentMetric to
- // currentMF.Metric right now. First wait if this is a summary,
- // and the metric exists already, which we can only know after
- // having read all the labels.
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingLabels
-}
-
-// readingLabels represents the state where the last byte read (now in
-// p.currentByte) is either the first byte of the label set (i.e. a '{'), or the
-// first byte of the value (otherwise).
-func (p *TextParser) readingLabels() stateFn {
- // Summaries/histograms are special. We have to reset the
- // currentLabels map, currentQuantile and currentBucket before starting to
- // read labels.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- p.currentLabels = map[string]string{}
- p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName()
- p.currentQuantile = math.NaN()
- p.currentBucket = math.NaN()
- }
- if p.currentByte != '{' {
- return p.readingValue
- }
- return p.startLabelName
-}
-
-// startLabelName represents the state where the next byte read from p.buf is
-// the start of a label name (or whitespace leading up to it).
-func (p *TextParser) startLabelName() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte == '}' {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- }
- if p.readTokenAsLabelName(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() == 0 {
- p.parseError(fmt.Sprintf("invalid label name for metric %q", p.currentMF.GetName()))
- return nil
- }
- p.currentLabelPair = &dto.LabelPair{Name: proto.String(p.currentToken.String())}
- if p.currentLabelPair.GetName() == string(model.MetricNameLabel) {
- p.parseError(fmt.Sprintf("label name %q is reserved", model.MetricNameLabel))
- return nil
- }
- // Special summary/histogram treatment. Don't add 'quantile' and 'le'
- // labels to 'real' labels.
- if !(p.currentMF.GetType() == dto.MetricType_SUMMARY && p.currentLabelPair.GetName() == model.QuantileLabel) &&
- !(p.currentMF.GetType() == dto.MetricType_HISTOGRAM && p.currentLabelPair.GetName() == model.BucketLabel) {
- p.currentMetric.Label = append(p.currentMetric.Label, p.currentLabelPair)
- }
- if p.skipBlankTabIfCurrentBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '=' {
- p.parseError(fmt.Sprintf("expected '=' after label name, found %q", p.currentByte))
- return nil
- }
- // Check for duplicate label names.
- labels := make(map[string]struct{})
- for _, l := range p.currentMetric.Label {
- lName := l.GetName()
- if _, exists := labels[lName]; !exists {
- labels[lName] = struct{}{}
- } else {
- p.parseError(fmt.Sprintf("duplicate label names for metric %q", p.currentMF.GetName()))
- return nil
- }
- }
- return p.startLabelValue
-}
-
-// startLabelValue represents the state where the next byte read from p.buf is
-// the start of a (quoted) label value (or whitespace leading up to it).
-func (p *TextParser) startLabelValue() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentByte != '"' {
- p.parseError(fmt.Sprintf("expected '\"' at start of label value, found %q", p.currentByte))
- return nil
- }
- if p.readTokenAsLabelValue(); p.err != nil {
- return nil
- }
- if !model.LabelValue(p.currentToken.String()).IsValid() {
- p.parseError(fmt.Sprintf("invalid label value %q", p.currentToken.String()))
- return nil
- }
- p.currentLabelPair.Value = proto.String(p.currentToken.String())
- // Special treatment of summaries:
- // - Quantile labels are special, will result in dto.Quantile later.
- // - Other labels have to be added to currentLabels for signature calculation.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if p.currentLabelPair.GetName() == model.QuantileLabel {
- if p.currentQuantile, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'quantile' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- // Similar special treatment of histograms.
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if p.currentLabelPair.GetName() == model.BucketLabel {
- if p.currentBucket, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value for 'le' label, got %q", p.currentLabelPair.GetValue()))
- return nil
- }
- } else {
- p.currentLabels[p.currentLabelPair.GetName()] = p.currentLabelPair.GetValue()
- }
- }
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- switch p.currentByte {
- case ',':
- return p.startLabelName
-
- case '}':
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- return p.readingValue
- default:
- p.parseError(fmt.Sprintf("unexpected end of label value %q", p.currentLabelPair.GetValue()))
- return nil
- }
-}
-
-// readingValue represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the sample value (i.e. a float).
-func (p *TextParser) readingValue() stateFn {
- // When we are here, we have read all the labels, so for the
- // special case of a summary/histogram, we can finally find out
- // if the metric already exists.
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- signature := model.LabelsToSignature(p.currentLabels)
- if summary := p.summaries[signature]; summary != nil {
- p.currentMetric = summary
- } else {
- p.summaries[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- signature := model.LabelsToSignature(p.currentLabels)
- if histogram := p.histograms[signature]; histogram != nil {
- p.currentMetric = histogram
- } else {
- p.histograms[signature] = p.currentMetric
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- } else {
- p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric)
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- value, err := parseFloat(p.currentToken.String())
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected float as value, got %q", p.currentToken.String()))
- return nil
- }
- switch p.currentMF.GetType() {
- case dto.MetricType_COUNTER:
- p.currentMetric.Counter = &dto.Counter{Value: proto.Float64(value)}
- case dto.MetricType_GAUGE:
- p.currentMetric.Gauge = &dto.Gauge{Value: proto.Float64(value)}
- case dto.MetricType_UNTYPED:
- p.currentMetric.Untyped = &dto.Untyped{Value: proto.Float64(value)}
- case dto.MetricType_SUMMARY:
- // *sigh*
- if p.currentMetric.Summary == nil {
- p.currentMetric.Summary = &dto.Summary{}
- }
- switch {
- case p.currentIsSummaryCount:
- p.currentMetric.Summary.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsSummarySum:
- p.currentMetric.Summary.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentQuantile):
- p.currentMetric.Summary.Quantile = append(
- p.currentMetric.Summary.Quantile,
- &dto.Quantile{
- Quantile: proto.Float64(p.currentQuantile),
- Value: proto.Float64(value),
- },
- )
- }
- case dto.MetricType_HISTOGRAM:
- // *sigh*
- if p.currentMetric.Histogram == nil {
- p.currentMetric.Histogram = &dto.Histogram{}
- }
- switch {
- case p.currentIsHistogramCount:
- p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value))
- case p.currentIsHistogramSum:
- p.currentMetric.Histogram.SampleSum = proto.Float64(value)
- case !math.IsNaN(p.currentBucket):
- p.currentMetric.Histogram.Bucket = append(
- p.currentMetric.Histogram.Bucket,
- &dto.Bucket{
- UpperBound: proto.Float64(p.currentBucket),
- CumulativeCount: proto.Uint64(uint64(value)),
- },
- )
- }
- default:
- p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName())
- }
- if p.currentByte == '\n' {
- return p.startOfLine
- }
- return p.startTimestamp
-}
-
-// startTimestamp represents the state where the next byte read from p.buf is
-// the start of the timestamp (or whitespace leading up to it).
-func (p *TextParser) startTimestamp() stateFn {
- if p.skipBlankTab(); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.readTokenUntilWhitespace(); p.err != nil {
- return nil // Unexpected end of input.
- }
- timestamp, err := strconv.ParseInt(p.currentToken.String(), 10, 64)
- if err != nil {
- // Create a more helpful error message.
- p.parseError(fmt.Sprintf("expected integer as timestamp, got %q", p.currentToken.String()))
- return nil
- }
- p.currentMetric.TimestampMs = proto.Int64(timestamp)
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- if p.currentToken.Len() > 0 {
- p.parseError(fmt.Sprintf("spurious string after timestamp: %q", p.currentToken.String()))
- return nil
- }
- return p.startOfLine
-}
-
-// readingHelp represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the docstring after 'HELP'.
-func (p *TextParser) readingHelp() stateFn {
- if p.currentMF.Help != nil {
- p.parseError(fmt.Sprintf("second HELP line for metric name %q", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the docstring.
- if p.readTokenUntilNewline(true); p.err != nil {
- return nil // Unexpected end of input.
- }
- p.currentMF.Help = proto.String(p.currentToken.String())
- return p.startOfLine
-}
-
-// readingType represents the state where the last byte read (now in
-// p.currentByte) is the first byte of the type hint after 'HELP'.
-func (p *TextParser) readingType() stateFn {
- if p.currentMF.Type != nil {
- p.parseError(fmt.Sprintf("second TYPE line for metric name %q, or TYPE reported after samples", p.currentMF.GetName()))
- return nil
- }
- // Rest of line is the type.
- if p.readTokenUntilNewline(false); p.err != nil {
- return nil // Unexpected end of input.
- }
- metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())]
- if !ok {
- p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String()))
- return nil
- }
- p.currentMF.Type = dto.MetricType(metricType).Enum()
- return p.startOfLine
-}
-
-// parseError sets p.err to a ParseError at the current line with the given
-// message.
-func (p *TextParser) parseError(msg string) {
- p.err = ParseError{
- Line: p.lineCount,
- Msg: msg,
- }
-}
-
-// skipBlankTab reads (and discards) bytes from p.buf until it encounters a byte
-// that is neither ' ' nor '\t'. That byte is left in p.currentByte.
-func (p *TextParser) skipBlankTab() {
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil || !isBlankOrTab(p.currentByte) {
- return
- }
- }
-}
-
-// skipBlankTabIfCurrentBlankTab works exactly as skipBlankTab but doesn't do
-// anything if p.currentByte is neither ' ' nor '\t'.
-func (p *TextParser) skipBlankTabIfCurrentBlankTab() {
- if isBlankOrTab(p.currentByte) {
- p.skipBlankTab()
- }
-}
-
-// readTokenUntilWhitespace copies bytes from p.buf into p.currentToken. The
-// first byte considered is the byte already read (now in p.currentByte). The
-// first whitespace byte encountered is still copied into p.currentByte, but not
-// into p.currentToken.
-func (p *TextParser) readTokenUntilWhitespace() {
- p.currentToken.Reset()
- for p.err == nil && !isBlankOrTab(p.currentByte) && p.currentByte != '\n' {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenUntilNewline copies bytes from p.buf into p.currentToken. The first
-// byte considered is the byte already read (now in p.currentByte). The first
-// newline byte encountered is still copied into p.currentByte, but not into
-// p.currentToken. If recognizeEscapeSequence is true, two escape sequences are
-// recognized: '\\' translates into '\', and '\n' into a line-feed character.
-// All other escape sequences are invalid and cause an error.
-func (p *TextParser) readTokenUntilNewline(recognizeEscapeSequence bool) {
- p.currentToken.Reset()
- escaped := false
- for p.err == nil {
- if recognizeEscapeSequence && escaped {
- switch p.currentByte {
- case '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- } else {
- switch p.currentByte {
- case '\n':
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
- p.currentByte, p.err = p.buf.ReadByte()
- }
-}
-
-// readTokenAsMetricName copies a metric name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a metric name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsMetricName() {
- p.currentToken.Reset()
- if !isValidMetricNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidMetricNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelName copies a label name from p.buf into p.currentToken.
-// The first byte considered is the byte already read (now in p.currentByte).
-// The first byte not part of a label name is still copied into p.currentByte,
-// but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelName() {
- p.currentToken.Reset()
- if !isValidLabelNameStart(p.currentByte) {
- return
- }
- for {
- p.currentToken.WriteByte(p.currentByte)
- p.currentByte, p.err = p.buf.ReadByte()
- if p.err != nil || !isValidLabelNameContinuation(p.currentByte) {
- return
- }
- }
-}
-
-// readTokenAsLabelValue copies a label value from p.buf into p.currentToken.
-// In contrast to the other 'readTokenAs...' functions, which start with the
-// last read byte in p.currentByte, this method ignores p.currentByte and starts
-// with reading a new byte from p.buf. The first byte not part of a label value
-// is still copied into p.currentByte, but not into p.currentToken.
-func (p *TextParser) readTokenAsLabelValue() {
- p.currentToken.Reset()
- escaped := false
- for {
- if p.currentByte, p.err = p.buf.ReadByte(); p.err != nil {
- return
- }
- if escaped {
- switch p.currentByte {
- case '"', '\\':
- p.currentToken.WriteByte(p.currentByte)
- case 'n':
- p.currentToken.WriteByte('\n')
- default:
- p.parseError(fmt.Sprintf("invalid escape sequence '\\%c'", p.currentByte))
- return
- }
- escaped = false
- continue
- }
- switch p.currentByte {
- case '"':
- return
- case '\n':
- p.parseError(fmt.Sprintf("label value %q contains unescaped new-line", p.currentToken.String()))
- return
- case '\\':
- escaped = true
- default:
- p.currentToken.WriteByte(p.currentByte)
- }
- }
-}
-
-func (p *TextParser) setOrCreateCurrentMF() {
- p.currentIsSummaryCount = false
- p.currentIsSummarySum = false
- p.currentIsHistogramCount = false
- p.currentIsHistogramSum = false
- name := p.currentToken.String()
- if p.currentMF = p.metricFamiliesByName[name]; p.currentMF != nil {
- return
- }
- // Try out if this is a _sum or _count for a summary/histogram.
- summaryName := summaryMetricName(name)
- if p.currentMF = p.metricFamiliesByName[summaryName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_SUMMARY {
- if isCount(name) {
- p.currentIsSummaryCount = true
- }
- if isSum(name) {
- p.currentIsSummarySum = true
- }
- return
- }
- }
- histogramName := histogramMetricName(name)
- if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil {
- if p.currentMF.GetType() == dto.MetricType_HISTOGRAM {
- if isCount(name) {
- p.currentIsHistogramCount = true
- }
- if isSum(name) {
- p.currentIsHistogramSum = true
- }
- return
- }
- }
- p.currentMF = &dto.MetricFamily{Name: proto.String(name)}
- p.metricFamiliesByName[name] = p.currentMF
-}
-
-func isValidLabelNameStart(b byte) bool {
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_'
-}
-
-func isValidLabelNameContinuation(b byte) bool {
- return isValidLabelNameStart(b) || (b >= '0' && b <= '9')
-}
-
-func isValidMetricNameStart(b byte) bool {
- return isValidLabelNameStart(b) || b == ':'
-}
-
-func isValidMetricNameContinuation(b byte) bool {
- return isValidLabelNameContinuation(b) || b == ':'
-}
-
-func isBlankOrTab(b byte) bool {
- return b == ' ' || b == '\t'
-}
-
-func isCount(name string) bool {
- return len(name) > 6 && name[len(name)-6:] == "_count"
-}
-
-func isSum(name string) bool {
- return len(name) > 4 && name[len(name)-4:] == "_sum"
-}
-
-func isBucket(name string) bool {
- return len(name) > 7 && name[len(name)-7:] == "_bucket"
-}
-
-func summaryMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- default:
- return name
- }
-}
-
-func histogramMetricName(name string) string {
- switch {
- case isCount(name):
- return name[:len(name)-6]
- case isSum(name):
- return name[:len(name)-4]
- case isBucket(name):
- return name[:len(name)-7]
- default:
- return name
- }
-}
-
-func parseFloat(s string) (float64, error) {
- if strings.ContainsAny(s, "pP_") {
- return 0, fmt.Errorf("unsupported character in float")
- }
- return strconv.ParseFloat(s, 64)
-}
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt
deleted file mode 100644
index 7723656..0000000
--- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-PACKAGE
-
-package goautoneg
-import "bitbucket.org/ww/goautoneg"
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-FUNCTIONS
-
-func Negotiate(header string, alternatives []string) (content_type string)
-Negotiate the most appropriate content_type given the accept header
-and a list of alternatives.
-
-func ParseAccept(header string) (accept []Accept)
-Parse an Accept Header string returning a sorted list
-of clauses
-
-
-TYPES
-
-type Accept struct {
- Type, SubType string
- Q float32
- Params map[string]string
-}
-Structure to represent a clause in an HTTP Accept Header
-
-
-SUBDIRECTORIES
-
- .hg
diff --git a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go b/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
deleted file mode 100644
index a21b9d1..0000000
--- a/vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
-Copyright (c) 2011, Open Knowledge Foundation Ltd.
-All rights reserved.
-
-HTTP Content-Type Autonegotiation.
-
-The functions in this package implement the behaviour specified in
-http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Open Knowledge Foundation Ltd. nor the
- names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-package goautoneg
-
-import (
- "sort"
- "strconv"
- "strings"
-)
-
-// Structure to represent a clause in an HTTP Accept Header
-type Accept struct {
- Type, SubType string
- Q float64
- Params map[string]string
-}
-
-// For internal use, so that we can use the sort interface
-type accept_slice []Accept
-
-func (accept accept_slice) Len() int {
- slice := []Accept(accept)
- return len(slice)
-}
-
-func (accept accept_slice) Less(i, j int) bool {
- slice := []Accept(accept)
- ai, aj := slice[i], slice[j]
- if ai.Q > aj.Q {
- return true
- }
- if ai.Type != "*" && aj.Type == "*" {
- return true
- }
- if ai.SubType != "*" && aj.SubType == "*" {
- return true
- }
- return false
-}
-
-func (accept accept_slice) Swap(i, j int) {
- slice := []Accept(accept)
- slice[i], slice[j] = slice[j], slice[i]
-}
-
-// Parse an Accept Header string returning a sorted list
-// of clauses
-func ParseAccept(header string) (accept []Accept) {
- parts := strings.Split(header, ",")
- accept = make([]Accept, 0, len(parts))
- for _, part := range parts {
- part := strings.Trim(part, " ")
-
- a := Accept{}
- a.Params = make(map[string]string)
- a.Q = 1.0
-
- mrp := strings.Split(part, ";")
-
- media_range := mrp[0]
- sp := strings.Split(media_range, "/")
- a.Type = strings.Trim(sp[0], " ")
-
- switch {
- case len(sp) == 1 && a.Type == "*":
- a.SubType = "*"
- case len(sp) == 2:
- a.SubType = strings.Trim(sp[1], " ")
- default:
- continue
- }
-
- if len(mrp) == 1 {
- accept = append(accept, a)
- continue
- }
-
- for _, param := range mrp[1:] {
- sp := strings.SplitN(param, "=", 2)
- if len(sp) != 2 {
- continue
- }
- token := strings.Trim(sp[0], " ")
- if token == "q" {
- a.Q, _ = strconv.ParseFloat(sp[1], 32)
- } else {
- a.Params[token] = strings.Trim(sp[1], " ")
- }
- }
-
- accept = append(accept, a)
- }
-
- slice := accept_slice(accept)
- sort.Sort(slice)
-
- return
-}
-
-// Negotiate the most appropriate content_type given the accept header
-// and a list of alternatives.
-func Negotiate(header string, alternatives []string) (content_type string) {
- asp := make([][]string, 0, len(alternatives))
- for _, ctype := range alternatives {
- asp = append(asp, strings.SplitN(ctype, "/", 2))
- }
- for _, clause := range ParseAccept(header) {
- for i, ctsp := range asp {
- if clause.Type == ctsp[0] && clause.SubType == ctsp[1] {
- content_type = alternatives[i]
- return
- }
- if clause.Type == ctsp[0] && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- if clause.Type == "*" && clause.SubType == "*" {
- content_type = alternatives[i]
- return
- }
- }
- }
- return
-}
diff --git a/vendor/github.com/prometheus/common/model/alert.go b/vendor/github.com/prometheus/common/model/alert.go
deleted file mode 100644
index 178fdba..0000000
--- a/vendor/github.com/prometheus/common/model/alert.go
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "time"
-)
-
-type AlertStatus string
-
-const (
- AlertFiring AlertStatus = "firing"
- AlertResolved AlertStatus = "resolved"
-)
-
-// Alert is a generic representation of an alert in the Prometheus eco-system.
-type Alert struct {
- // Label value pairs for purpose of aggregation, matching, and disposition
- // dispatching. This must minimally include an "alertname" label.
- Labels LabelSet `json:"labels"`
-
- // Extra key/value information which does not define alert identity.
- Annotations LabelSet `json:"annotations"`
-
- // The known time range for this alert. Both ends are optional.
- StartsAt time.Time `json:"startsAt,omitempty"`
- EndsAt time.Time `json:"endsAt,omitempty"`
- GeneratorURL string `json:"generatorURL"`
-}
-
-// Name returns the name of the alert. It is equivalent to the "alertname" label.
-func (a *Alert) Name() string {
- return string(a.Labels[AlertNameLabel])
-}
-
-// Fingerprint returns a unique hash for the alert. It is equivalent to
-// the fingerprint of the alert's label set.
-func (a *Alert) Fingerprint() Fingerprint {
- return a.Labels.Fingerprint()
-}
-
-func (a *Alert) String() string {
- s := fmt.Sprintf("%s[%s]", a.Name(), a.Fingerprint().String()[:7])
- if a.Resolved() {
- return s + "[resolved]"
- }
- return s + "[active]"
-}
-
-// Resolved returns true iff the activity interval ended in the past.
-func (a *Alert) Resolved() bool {
- return a.ResolvedAt(time.Now())
-}
-
-// ResolvedAt returns true off the activity interval ended before
-// the given timestamp.
-func (a *Alert) ResolvedAt(ts time.Time) bool {
- if a.EndsAt.IsZero() {
- return false
- }
- return !a.EndsAt.After(ts)
-}
-
-// Status returns the status of the alert.
-func (a *Alert) Status() AlertStatus {
- if a.Resolved() {
- return AlertResolved
- }
- return AlertFiring
-}
-
-// Validate checks whether the alert data is inconsistent.
-func (a *Alert) Validate() error {
- if a.StartsAt.IsZero() {
- return fmt.Errorf("start time missing")
- }
- if !a.EndsAt.IsZero() && a.EndsAt.Before(a.StartsAt) {
- return fmt.Errorf("start time must be before end time")
- }
- if err := a.Labels.Validate(); err != nil {
- return fmt.Errorf("invalid label set: %w", err)
- }
- if len(a.Labels) == 0 {
- return fmt.Errorf("at least one label pair required")
- }
- if err := a.Annotations.Validate(); err != nil {
- return fmt.Errorf("invalid annotations: %w", err)
- }
- return nil
-}
-
-// Alert is a list of alerts that can be sorted in chronological order.
-type Alerts []*Alert
-
-func (as Alerts) Len() int { return len(as) }
-func (as Alerts) Swap(i, j int) { as[i], as[j] = as[j], as[i] }
-
-func (as Alerts) Less(i, j int) bool {
- if as[i].StartsAt.Before(as[j].StartsAt) {
- return true
- }
- if as[i].EndsAt.Before(as[j].EndsAt) {
- return true
- }
- return as[i].Fingerprint() < as[j].Fingerprint()
-}
-
-// HasFiring returns true iff one of the alerts is not resolved.
-func (as Alerts) HasFiring() bool {
- for _, a := range as {
- if !a.Resolved() {
- return true
- }
- }
- return false
-}
-
-// Status returns StatusFiring iff at least one of the alerts is firing.
-func (as Alerts) Status() AlertStatus {
- if as.HasFiring() {
- return AlertFiring
- }
- return AlertResolved
-}
diff --git a/vendor/github.com/prometheus/common/model/fingerprinting.go b/vendor/github.com/prometheus/common/model/fingerprinting.go
deleted file mode 100644
index fc4de41..0000000
--- a/vendor/github.com/prometheus/common/model/fingerprinting.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "strconv"
-)
-
-// Fingerprint provides a hash-capable representation of a Metric.
-// For our purposes, FNV-1A 64-bit is used.
-type Fingerprint uint64
-
-// FingerprintFromString transforms a string representation into a Fingerprint.
-func FingerprintFromString(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- return Fingerprint(num), err
-}
-
-// ParseFingerprint parses the input string into a fingerprint.
-func ParseFingerprint(s string) (Fingerprint, error) {
- num, err := strconv.ParseUint(s, 16, 64)
- if err != nil {
- return 0, err
- }
- return Fingerprint(num), nil
-}
-
-func (f Fingerprint) String() string {
- return fmt.Sprintf("%016x", uint64(f))
-}
-
-// Fingerprints represents a collection of Fingerprint subject to a given
-// natural sorting scheme. It implements sort.Interface.
-type Fingerprints []Fingerprint
-
-// Len implements sort.Interface.
-func (f Fingerprints) Len() int {
- return len(f)
-}
-
-// Less implements sort.Interface.
-func (f Fingerprints) Less(i, j int) bool {
- return f[i] < f[j]
-}
-
-// Swap implements sort.Interface.
-func (f Fingerprints) Swap(i, j int) {
- f[i], f[j] = f[j], f[i]
-}
-
-// FingerprintSet is a set of Fingerprints.
-type FingerprintSet map[Fingerprint]struct{}
-
-// Equal returns true if both sets contain the same elements (and not more).
-func (s FingerprintSet) Equal(o FingerprintSet) bool {
- if len(s) != len(o) {
- return false
- }
-
- for k := range s {
- if _, ok := o[k]; !ok {
- return false
- }
- }
-
- return true
-}
-
-// Intersection returns the elements contained in both sets.
-func (s FingerprintSet) Intersection(o FingerprintSet) FingerprintSet {
- myLength, otherLength := len(s), len(o)
- if myLength == 0 || otherLength == 0 {
- return FingerprintSet{}
- }
-
- subSet := s
- superSet := o
-
- if otherLength < myLength {
- subSet = o
- superSet = s
- }
-
- out := FingerprintSet{}
-
- for k := range subSet {
- if _, ok := superSet[k]; ok {
- out[k] = struct{}{}
- }
- }
-
- return out
-}
diff --git a/vendor/github.com/prometheus/common/model/fnv.go b/vendor/github.com/prometheus/common/model/fnv.go
deleted file mode 100644
index 367afec..0000000
--- a/vendor/github.com/prometheus/common/model/fnv.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-// Inline and byte-free variant of hash/fnv's fnv64a.
-
-const (
- offset64 = 14695981039346656037
- prime64 = 1099511628211
-)
-
-// hashNew initializes a new fnv64a hash value.
-func hashNew() uint64 {
- return offset64
-}
-
-// hashAdd adds a string to a fnv64a hash value, returning the updated hash.
-func hashAdd(h uint64, s string) uint64 {
- for i := 0; i < len(s); i++ {
- h ^= uint64(s[i])
- h *= prime64
- }
- return h
-}
-
-// hashAddByte adds a byte to a fnv64a hash value, returning the updated hash.
-func hashAddByte(h uint64, b byte) uint64 {
- h ^= uint64(b)
- h *= prime64
- return h
-}
diff --git a/vendor/github.com/prometheus/common/model/labels.go b/vendor/github.com/prometheus/common/model/labels.go
deleted file mode 100644
index 3317ce2..0000000
--- a/vendor/github.com/prometheus/common/model/labels.go
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "strings"
- "unicode/utf8"
-)
-
-const (
- // AlertNameLabel is the name of the label containing the an alert's name.
- AlertNameLabel = "alertname"
-
- // ExportedLabelPrefix is the prefix to prepend to the label names present in
- // exported metrics if a label of the same name is added by the server.
- ExportedLabelPrefix = "exported_"
-
- // MetricNameLabel is the label name indicating the metric name of a
- // timeseries.
- MetricNameLabel = "__name__"
-
- // SchemeLabel is the name of the label that holds the scheme on which to
- // scrape a target.
- SchemeLabel = "__scheme__"
-
- // AddressLabel is the name of the label that holds the address of
- // a scrape target.
- AddressLabel = "__address__"
-
- // MetricsPathLabel is the name of the label that holds the path on which to
- // scrape a target.
- MetricsPathLabel = "__metrics_path__"
-
- // ScrapeIntervalLabel is the name of the label that holds the scrape interval
- // used to scrape a target.
- ScrapeIntervalLabel = "__scrape_interval__"
-
- // ScrapeTimeoutLabel is the name of the label that holds the scrape
- // timeout used to scrape a target.
- ScrapeTimeoutLabel = "__scrape_timeout__"
-
- // ReservedLabelPrefix is a prefix which is not legal in user-supplied
- // label names.
- ReservedLabelPrefix = "__"
-
- // MetaLabelPrefix is a prefix for labels that provide meta information.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series.
- MetaLabelPrefix = "__meta_"
-
- // TmpLabelPrefix is a prefix for temporary labels as part of relabelling.
- // Labels with this prefix are used for intermediate label processing and
- // will not be attached to time series. This is reserved for use in
- // Prometheus configuration files by users.
- TmpLabelPrefix = "__tmp_"
-
- // ParamLabelPrefix is a prefix for labels that provide URL parameters
- // used to scrape a target.
- ParamLabelPrefix = "__param_"
-
- // JobLabel is the label name indicating the job from which a timeseries
- // was scraped.
- JobLabel = "job"
-
- // InstanceLabel is the label name used for the instance label.
- InstanceLabel = "instance"
-
- // BucketLabel is used for the label that defines the upper bound of a
- // bucket of a histogram ("le" -> "less or equal").
- BucketLabel = "le"
-
- // QuantileLabel is used for the label that defines the quantile in a
- // summary.
- QuantileLabel = "quantile"
-)
-
-// LabelNameRE is a regular expression matching valid label names. Note that the
-// IsValid method of LabelName performs the same check but faster than a match
-// with this regular expression.
-var LabelNameRE = regexp.MustCompile("^[a-zA-Z_][a-zA-Z0-9_]*$")
-
-// A LabelName is a key for a LabelSet or Metric. It has a value associated
-// therewith.
-type LabelName string
-
-// IsValid returns true iff name matches the pattern of LabelNameRE for legacy
-// names, and iff it's valid UTF-8 if NameValidationScheme is set to
-// UTF8Validation. For the legacy matching, it does not use LabelNameRE for the
-// check but a much faster hardcoded implementation.
-func (ln LabelName) IsValid() bool {
- if len(ln) == 0 {
- return false
- }
- switch NameValidationScheme {
- case LegacyValidation:
- for i, b := range ln {
- if !((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || (b >= '0' && b <= '9' && i > 0)) {
- return false
- }
- }
- case UTF8Validation:
- return utf8.ValidString(string(ln))
- default:
- panic(fmt.Sprintf("Invalid name validation scheme requested: %d", NameValidationScheme))
- }
- return true
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (ln *LabelName) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- if !LabelName(s).IsValid() {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (ln *LabelName) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- if !LabelName(s).IsValid() {
- return fmt.Errorf("%q is not a valid label name", s)
- }
- *ln = LabelName(s)
- return nil
-}
-
-// LabelNames is a sortable LabelName slice. In implements sort.Interface.
-type LabelNames []LabelName
-
-func (l LabelNames) Len() int {
- return len(l)
-}
-
-func (l LabelNames) Less(i, j int) bool {
- return l[i] < l[j]
-}
-
-func (l LabelNames) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-func (l LabelNames) String() string {
- labelStrings := make([]string, 0, len(l))
- for _, label := range l {
- labelStrings = append(labelStrings, string(label))
- }
- return strings.Join(labelStrings, ", ")
-}
-
-// A LabelValue is an associated value for a LabelName.
-type LabelValue string
-
-// IsValid returns true iff the string is a valid UTF-8.
-func (lv LabelValue) IsValid() bool {
- return utf8.ValidString(string(lv))
-}
-
-// LabelValues is a sortable LabelValue slice. It implements sort.Interface.
-type LabelValues []LabelValue
-
-func (l LabelValues) Len() int {
- return len(l)
-}
-
-func (l LabelValues) Less(i, j int) bool {
- return string(l[i]) < string(l[j])
-}
-
-func (l LabelValues) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
-
-// LabelPair pairs a name with a value.
-type LabelPair struct {
- Name LabelName
- Value LabelValue
-}
-
-// LabelPairs is a sortable slice of LabelPair pointers. It implements
-// sort.Interface.
-type LabelPairs []*LabelPair
-
-func (l LabelPairs) Len() int {
- return len(l)
-}
-
-func (l LabelPairs) Less(i, j int) bool {
- switch {
- case l[i].Name > l[j].Name:
- return false
- case l[i].Name < l[j].Name:
- return true
- case l[i].Value > l[j].Value:
- return false
- case l[i].Value < l[j].Value:
- return true
- default:
- return false
- }
-}
-
-func (l LabelPairs) Swap(i, j int) {
- l[i], l[j] = l[j], l[i]
-}
diff --git a/vendor/github.com/prometheus/common/model/labelset.go b/vendor/github.com/prometheus/common/model/labelset.go
deleted file mode 100644
index ec738e6..0000000
--- a/vendor/github.com/prometheus/common/model/labelset.go
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "slices"
- "sort"
- "strconv"
-)
-
-// A LabelSet is a collection of LabelName and LabelValue pairs. The LabelSet
-// may be fully-qualified down to the point where it may resolve to a single
-// Metric in the data store or not. All operations that occur within the realm
-// of a LabelSet can emit a vector of Metric entities to which the LabelSet may
-// match.
-type LabelSet map[LabelName]LabelValue
-
-// Validate checks whether all names and values in the label set
-// are valid.
-func (ls LabelSet) Validate() error {
- for ln, lv := range ls {
- if !ln.IsValid() {
- return fmt.Errorf("invalid name %q", ln)
- }
- if !lv.IsValid() {
- return fmt.Errorf("invalid value %q", lv)
- }
- }
- return nil
-}
-
-// Equal returns true iff both label sets have exactly the same key/value pairs.
-func (ls LabelSet) Equal(o LabelSet) bool {
- if len(ls) != len(o) {
- return false
- }
- for ln, lv := range ls {
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if olv != lv {
- return false
- }
- }
- return true
-}
-
-// Before compares the metrics, using the following criteria:
-//
-// If m has fewer labels than o, it is before o. If it has more, it is not.
-//
-// If the number of labels is the same, the superset of all label names is
-// sorted alphanumerically. The first differing label pair found in that order
-// determines the outcome: If the label does not exist at all in m, then m is
-// before o, and vice versa. Otherwise the label value is compared
-// alphanumerically.
-//
-// If m and o are equal, the method returns false.
-func (ls LabelSet) Before(o LabelSet) bool {
- if len(ls) < len(o) {
- return true
- }
- if len(ls) > len(o) {
- return false
- }
-
- lns := make(LabelNames, 0, len(ls)+len(o))
- for ln := range ls {
- lns = append(lns, ln)
- }
- for ln := range o {
- lns = append(lns, ln)
- }
- // It's probably not worth it to de-dup lns.
- sort.Sort(lns)
- for _, ln := range lns {
- mlv, ok := ls[ln]
- if !ok {
- return true
- }
- olv, ok := o[ln]
- if !ok {
- return false
- }
- if mlv < olv {
- return true
- }
- if mlv > olv {
- return false
- }
- }
- return false
-}
-
-// Clone returns a copy of the label set.
-func (ls LabelSet) Clone() LabelSet {
- lsn := make(LabelSet, len(ls))
- for ln, lv := range ls {
- lsn[ln] = lv
- }
- return lsn
-}
-
-// Merge is a helper function to non-destructively merge two label sets.
-func (l LabelSet) Merge(other LabelSet) LabelSet {
- result := make(LabelSet, len(l))
-
- for k, v := range l {
- result[k] = v
- }
-
- for k, v := range other {
- result[k] = v
- }
-
- return result
-}
-
-// String will look like `{foo="bar", more="less"}`. Names are sorted alphabetically.
-func (l LabelSet) String() string {
- var lna [32]LabelName // On stack to avoid memory allocation for sorting names.
- labelNames := lna[:0]
- for name := range l {
- labelNames = append(labelNames, name)
- }
- slices.Sort(labelNames)
- var bytea [1024]byte // On stack to avoid memory allocation while building the output.
- b := bytes.NewBuffer(bytea[:0])
- b.WriteByte('{')
- for i, name := range labelNames {
- if i > 0 {
- b.WriteString(", ")
- }
- b.WriteString(string(name))
- b.WriteByte('=')
- b.Write(strconv.AppendQuote(b.AvailableBuffer(), string(l[name])))
- }
- b.WriteByte('}')
- return b.String()
-}
-
-// Fingerprint returns the LabelSet's fingerprint.
-func (ls LabelSet) Fingerprint() Fingerprint {
- return labelSetToFingerprint(ls)
-}
-
-// FastFingerprint returns the LabelSet's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (ls LabelSet) FastFingerprint() Fingerprint {
- return labelSetToFastFingerprint(ls)
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *LabelSet) UnmarshalJSON(b []byte) error {
- var m map[LabelName]LabelValue
- if err := json.Unmarshal(b, &m); err != nil {
- return err
- }
- // encoding/json only unmarshals maps of the form map[string]T. It treats
- // LabelName as a string and does not call its UnmarshalJSON method.
- // Thus, we have to replicate the behavior here.
- for ln := range m {
- if !ln.IsValid() {
- return fmt.Errorf("%q is not a valid label name", ln)
- }
- }
- *l = LabelSet(m)
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/metadata.go b/vendor/github.com/prometheus/common/model/metadata.go
deleted file mode 100644
index 447ab8a..0000000
--- a/vendor/github.com/prometheus/common/model/metadata.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2023 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-// MetricType represents metric type values.
-type MetricType string
-
-const (
- MetricTypeCounter = MetricType("counter")
- MetricTypeGauge = MetricType("gauge")
- MetricTypeHistogram = MetricType("histogram")
- MetricTypeGaugeHistogram = MetricType("gaugehistogram")
- MetricTypeSummary = MetricType("summary")
- MetricTypeInfo = MetricType("info")
- MetricTypeStateset = MetricType("stateset")
- MetricTypeUnknown = MetricType("unknown")
-)
diff --git a/vendor/github.com/prometheus/common/model/metric.go b/vendor/github.com/prometheus/common/model/metric.go
deleted file mode 100644
index 0bd29b3..0000000
--- a/vendor/github.com/prometheus/common/model/metric.go
+++ /dev/null
@@ -1,456 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "fmt"
- "regexp"
- "sort"
- "strings"
- "unicode/utf8"
-
- dto "github.com/prometheus/client_model/go"
- "google.golang.org/protobuf/proto"
-)
-
-var (
- // NameValidationScheme determines the method of name validation to be used by
- // all calls to IsValidMetricName() and LabelName IsValid(). Setting UTF-8 mode
- // in isolation from other components that don't support UTF-8 may result in
- // bugs or other undefined behavior. This value is intended to be set by
- // UTF-8-aware binaries as part of their startup. To avoid need for locking,
- // this value should be set once, ideally in an init(), before multiple
- // goroutines are started.
- NameValidationScheme = LegacyValidation
-
- // NameEscapingScheme defines the default way that names will be
- // escaped when presented to systems that do not support UTF-8 names. If the
- // Content-Type "escaping" term is specified, that will override this value.
- NameEscapingScheme = ValueEncodingEscaping
-)
-
-// ValidationScheme is a Go enum for determining how metric and label names will
-// be validated by this library.
-type ValidationScheme int
-
-const (
- // LegacyValidation is a setting that requirets that metric and label names
- // conform to the original Prometheus character requirements described by
- // MetricNameRE and LabelNameRE.
- LegacyValidation ValidationScheme = iota
-
- // UTF8Validation only requires that metric and label names be valid UTF-8
- // strings.
- UTF8Validation
-)
-
-type EscapingScheme int
-
-const (
- // NoEscaping indicates that a name will not be escaped. Unescaped names that
- // do not conform to the legacy validity check will use a new exposition
- // format syntax that will be officially standardized in future versions.
- NoEscaping EscapingScheme = iota
-
- // UnderscoreEscaping replaces all legacy-invalid characters with underscores.
- UnderscoreEscaping
-
- // DotsEscaping is similar to UnderscoreEscaping, except that dots are
- // converted to `_dot_` and pre-existing underscores are converted to `__`.
- DotsEscaping
-
- // ValueEncodingEscaping prepends the name with `U__` and replaces all invalid
- // characters with the unicode value, surrounded by underscores. Single
- // underscores are replaced with double underscores.
- ValueEncodingEscaping
-)
-
-const (
- // EscapingKey is the key in an Accept or Content-Type header that defines how
- // metric and label names that do not conform to the legacy character
- // requirements should be escaped when being scraped by a legacy prometheus
- // system. If a system does not explicitly pass an escaping parameter in the
- // Accept header, the default NameEscapingScheme will be used.
- EscapingKey = "escaping"
-
- // Possible values for Escaping Key:
- AllowUTF8 = "allow-utf-8" // No escaping required.
- EscapeUnderscores = "underscores"
- EscapeDots = "dots"
- EscapeValues = "values"
-)
-
-// MetricNameRE is a regular expression matching valid metric
-// names. Note that the IsValidMetricName function performs the same
-// check but faster than a match with this regular expression.
-var MetricNameRE = regexp.MustCompile(`^[a-zA-Z_:][a-zA-Z0-9_:]*$`)
-
-// A Metric is similar to a LabelSet, but the key difference is that a Metric is
-// a singleton and refers to one and only one stream of samples.
-type Metric LabelSet
-
-// Equal compares the metrics.
-func (m Metric) Equal(o Metric) bool {
- return LabelSet(m).Equal(LabelSet(o))
-}
-
-// Before compares the metrics' underlying label sets.
-func (m Metric) Before(o Metric) bool {
- return LabelSet(m).Before(LabelSet(o))
-}
-
-// Clone returns a copy of the Metric.
-func (m Metric) Clone() Metric {
- clone := make(Metric, len(m))
- for k, v := range m {
- clone[k] = v
- }
- return clone
-}
-
-func (m Metric) String() string {
- metricName, hasName := m[MetricNameLabel]
- numLabels := len(m) - 1
- if !hasName {
- numLabels = len(m)
- }
- labelStrings := make([]string, 0, numLabels)
- for label, value := range m {
- if label != MetricNameLabel {
- labelStrings = append(labelStrings, fmt.Sprintf("%s=%q", label, value))
- }
- }
-
- switch numLabels {
- case 0:
- if hasName {
- return string(metricName)
- }
- return "{}"
- default:
- sort.Strings(labelStrings)
- return fmt.Sprintf("%s{%s}", metricName, strings.Join(labelStrings, ", "))
- }
-}
-
-// Fingerprint returns a Metric's Fingerprint.
-func (m Metric) Fingerprint() Fingerprint {
- return LabelSet(m).Fingerprint()
-}
-
-// FastFingerprint returns a Metric's Fingerprint calculated by a faster hashing
-// algorithm, which is, however, more susceptible to hash collisions.
-func (m Metric) FastFingerprint() Fingerprint {
- return LabelSet(m).FastFingerprint()
-}
-
-// IsValidMetricName returns true iff name matches the pattern of MetricNameRE
-// for legacy names, and iff it's valid UTF-8 if the UTF8Validation scheme is
-// selected.
-func IsValidMetricName(n LabelValue) bool {
- switch NameValidationScheme {
- case LegacyValidation:
- return IsValidLegacyMetricName(n)
- case UTF8Validation:
- if len(n) == 0 {
- return false
- }
- return utf8.ValidString(string(n))
- default:
- panic(fmt.Sprintf("Invalid name validation scheme requested: %d", NameValidationScheme))
- }
-}
-
-// IsValidLegacyMetricName is similar to IsValidMetricName but always uses the
-// legacy validation scheme regardless of the value of NameValidationScheme.
-// This function, however, does not use MetricNameRE for the check but a much
-// faster hardcoded implementation.
-func IsValidLegacyMetricName(n LabelValue) bool {
- if len(n) == 0 {
- return false
- }
- for i, b := range n {
- if !isValidLegacyRune(b, i) {
- return false
- }
- }
- return true
-}
-
-// EscapeMetricFamily escapes the given metric names and labels with the given
-// escaping scheme. Returns a new object that uses the same pointers to fields
-// when possible and creates new escaped versions so as not to mutate the
-// input.
-func EscapeMetricFamily(v *dto.MetricFamily, scheme EscapingScheme) *dto.MetricFamily {
- if v == nil {
- return nil
- }
-
- if scheme == NoEscaping {
- return v
- }
-
- out := &dto.MetricFamily{
- Help: v.Help,
- Type: v.Type,
- }
-
- // If the name is nil, copy as-is, don't try to escape.
- if v.Name == nil || IsValidLegacyMetricName(LabelValue(v.GetName())) {
- out.Name = v.Name
- } else {
- out.Name = proto.String(EscapeName(v.GetName(), scheme))
- }
- for _, m := range v.Metric {
- if !metricNeedsEscaping(m) {
- out.Metric = append(out.Metric, m)
- continue
- }
-
- escaped := &dto.Metric{
- Gauge: m.Gauge,
- Counter: m.Counter,
- Summary: m.Summary,
- Untyped: m.Untyped,
- Histogram: m.Histogram,
- TimestampMs: m.TimestampMs,
- }
-
- for _, l := range m.Label {
- if l.GetName() == MetricNameLabel {
- if l.Value == nil || IsValidLegacyMetricName(LabelValue(l.GetValue())) {
- escaped.Label = append(escaped.Label, l)
- continue
- }
- escaped.Label = append(escaped.Label, &dto.LabelPair{
- Name: proto.String(MetricNameLabel),
- Value: proto.String(EscapeName(l.GetValue(), scheme)),
- })
- continue
- }
- if l.Name == nil || IsValidLegacyMetricName(LabelValue(l.GetName())) {
- escaped.Label = append(escaped.Label, l)
- continue
- }
- escaped.Label = append(escaped.Label, &dto.LabelPair{
- Name: proto.String(EscapeName(l.GetName(), scheme)),
- Value: l.Value,
- })
- }
- out.Metric = append(out.Metric, escaped)
- }
- return out
-}
-
-func metricNeedsEscaping(m *dto.Metric) bool {
- for _, l := range m.Label {
- if l.GetName() == MetricNameLabel && !IsValidLegacyMetricName(LabelValue(l.GetValue())) {
- return true
- }
- if !IsValidLegacyMetricName(LabelValue(l.GetName())) {
- return true
- }
- }
- return false
-}
-
-const (
- lowerhex = "0123456789abcdef"
-)
-
-// EscapeName escapes the incoming name according to the provided escaping
-// scheme. Depending on the rules of escaping, this may cause no change in the
-// string that is returned. (Especially NoEscaping, which by definition is a
-// noop). This function does not do any validation of the name.
-func EscapeName(name string, scheme EscapingScheme) string {
- if len(name) == 0 {
- return name
- }
- var escaped strings.Builder
- switch scheme {
- case NoEscaping:
- return name
- case UnderscoreEscaping:
- if IsValidLegacyMetricName(LabelValue(name)) {
- return name
- }
- for i, b := range name {
- if isValidLegacyRune(b, i) {
- escaped.WriteRune(b)
- } else {
- escaped.WriteRune('_')
- }
- }
- return escaped.String()
- case DotsEscaping:
- // Do not early return for legacy valid names, we still escape underscores.
- for i, b := range name {
- if b == '_' {
- escaped.WriteString("__")
- } else if b == '.' {
- escaped.WriteString("_dot_")
- } else if isValidLegacyRune(b, i) {
- escaped.WriteRune(b)
- } else {
- escaped.WriteRune('_')
- }
- }
- return escaped.String()
- case ValueEncodingEscaping:
- if IsValidLegacyMetricName(LabelValue(name)) {
- return name
- }
- escaped.WriteString("U__")
- for i, b := range name {
- if isValidLegacyRune(b, i) {
- escaped.WriteRune(b)
- } else if !utf8.ValidRune(b) {
- escaped.WriteString("_FFFD_")
- } else if b < 0x100 {
- escaped.WriteRune('_')
- for s := 4; s >= 0; s -= 4 {
- escaped.WriteByte(lowerhex[b>>uint(s)&0xF])
- }
- escaped.WriteRune('_')
- } else if b < 0x10000 {
- escaped.WriteRune('_')
- for s := 12; s >= 0; s -= 4 {
- escaped.WriteByte(lowerhex[b>>uint(s)&0xF])
- }
- escaped.WriteRune('_')
- }
- }
- return escaped.String()
- default:
- panic(fmt.Sprintf("invalid escaping scheme %d", scheme))
- }
-}
-
-// lower function taken from strconv.atoi
-func lower(c byte) byte {
- return c | ('x' - 'X')
-}
-
-// UnescapeName unescapes the incoming name according to the provided escaping
-// scheme if possible. Some schemes are partially or totally non-roundtripable.
-// If any error is enountered, returns the original input.
-func UnescapeName(name string, scheme EscapingScheme) string {
- if len(name) == 0 {
- return name
- }
- switch scheme {
- case NoEscaping:
- return name
- case UnderscoreEscaping:
- // It is not possible to unescape from underscore replacement.
- return name
- case DotsEscaping:
- name = strings.ReplaceAll(name, "_dot_", ".")
- name = strings.ReplaceAll(name, "__", "_")
- return name
- case ValueEncodingEscaping:
- escapedName, found := strings.CutPrefix(name, "U__")
- if !found {
- return name
- }
-
- var unescaped strings.Builder
- TOP:
- for i := 0; i < len(escapedName); i++ {
- // All non-underscores are treated normally.
- if escapedName[i] != '_' {
- unescaped.WriteByte(escapedName[i])
- continue
- }
- i++
- if i >= len(escapedName) {
- return name
- }
- // A double underscore is a single underscore.
- if escapedName[i] == '_' {
- unescaped.WriteByte('_')
- continue
- }
- // We think we are in a UTF-8 code, process it.
- var utf8Val uint
- for j := 0; i < len(escapedName); j++ {
- // This is too many characters for a utf8 value.
- if j > 4 {
- return name
- }
- // Found a closing underscore, convert to a rune, check validity, and append.
- if escapedName[i] == '_' {
- utf8Rune := rune(utf8Val)
- if !utf8.ValidRune(utf8Rune) {
- return name
- }
- unescaped.WriteRune(utf8Rune)
- continue TOP
- }
- r := lower(escapedName[i])
- utf8Val *= 16
- if r >= '0' && r <= '9' {
- utf8Val += uint(r) - '0'
- } else if r >= 'a' && r <= 'f' {
- utf8Val += uint(r) - 'a' + 10
- } else {
- return name
- }
- i++
- }
- // Didn't find closing underscore, invalid.
- return name
- }
- return unescaped.String()
- default:
- panic(fmt.Sprintf("invalid escaping scheme %d", scheme))
- }
-}
-
-func isValidLegacyRune(b rune, i int) bool {
- return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_' || b == ':' || (b >= '0' && b <= '9' && i > 0)
-}
-
-func (e EscapingScheme) String() string {
- switch e {
- case NoEscaping:
- return AllowUTF8
- case UnderscoreEscaping:
- return EscapeUnderscores
- case DotsEscaping:
- return EscapeDots
- case ValueEncodingEscaping:
- return EscapeValues
- default:
- panic(fmt.Sprintf("unknown format scheme %d", e))
- }
-}
-
-func ToEscapingScheme(s string) (EscapingScheme, error) {
- if s == "" {
- return NoEscaping, fmt.Errorf("got empty string instead of escaping scheme")
- }
- switch s {
- case AllowUTF8:
- return NoEscaping, nil
- case EscapeUnderscores:
- return UnderscoreEscaping, nil
- case EscapeDots:
- return DotsEscaping, nil
- case EscapeValues:
- return ValueEncodingEscaping, nil
- default:
- return NoEscaping, fmt.Errorf("unknown format scheme " + s)
- }
-}
diff --git a/vendor/github.com/prometheus/common/model/model.go b/vendor/github.com/prometheus/common/model/model.go
deleted file mode 100644
index a7b9691..0000000
--- a/vendor/github.com/prometheus/common/model/model.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package model contains common data structures that are shared across
-// Prometheus components and libraries.
-package model
diff --git a/vendor/github.com/prometheus/common/model/signature.go b/vendor/github.com/prometheus/common/model/signature.go
deleted file mode 100644
index dc8a002..0000000
--- a/vendor/github.com/prometheus/common/model/signature.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2014 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "sort"
-)
-
-// SeparatorByte is a byte that cannot occur in valid UTF-8 sequences and is
-// used to separate label names, label values, and other strings from each other
-// when calculating their combined hash value (aka signature aka fingerprint).
-const SeparatorByte byte = 255
-
-// cache the signature of an empty label set.
-var emptyLabelSignature = hashNew()
-
-// LabelsToSignature returns a quasi-unique signature (i.e., fingerprint) for a
-// given label set. (Collisions are possible but unlikely if the number of label
-// sets the function is applied to is small.)
-func LabelsToSignature(labels map[string]string) uint64 {
- if len(labels) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make([]string, 0, len(labels))
- for labelName := range labels {
- labelNames = append(labelNames, labelName)
- }
- sort.Strings(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, labelName)
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, labels[labelName])
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
-
-// labelSetToFingerprint works exactly as LabelsToSignature but takes a LabelSet as
-// parameter (rather than a label map) and returns a Fingerprint.
-func labelSetToFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- labelNames := make(LabelNames, 0, len(ls))
- for labelName := range ls {
- labelNames = append(labelNames, labelName)
- }
- sort.Sort(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(ls[labelName]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return Fingerprint(sum)
-}
-
-// labelSetToFastFingerprint works similar to labelSetToFingerprint but uses a
-// faster and less allocation-heavy hash function, which is more susceptible to
-// create hash collisions. Therefore, collision detection should be applied.
-func labelSetToFastFingerprint(ls LabelSet) Fingerprint {
- if len(ls) == 0 {
- return Fingerprint(emptyLabelSignature)
- }
-
- var result uint64
- for labelName, labelValue := range ls {
- sum := hashNew()
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(labelValue))
- result ^= sum
- }
- return Fingerprint(result)
-}
-
-// SignatureForLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and only includes the labels with the
-// specified LabelNames into the signature calculation. The labels passed in
-// will be sorted by this function.
-func SignatureForLabels(m Metric, labels ...LabelName) uint64 {
- if len(labels) == 0 {
- return emptyLabelSignature
- }
-
- sort.Sort(LabelNames(labels))
-
- sum := hashNew()
- for _, label := range labels {
- sum = hashAdd(sum, string(label))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(m[label]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
-
-// SignatureWithoutLabels works like LabelsToSignature but takes a Metric as
-// parameter (rather than a label map) and excludes the labels with any of the
-// specified LabelNames from the signature calculation.
-func SignatureWithoutLabels(m Metric, labels map[LabelName]struct{}) uint64 {
- if len(m) == 0 {
- return emptyLabelSignature
- }
-
- labelNames := make(LabelNames, 0, len(m))
- for labelName := range m {
- if _, exclude := labels[labelName]; !exclude {
- labelNames = append(labelNames, labelName)
- }
- }
- if len(labelNames) == 0 {
- return emptyLabelSignature
- }
- sort.Sort(labelNames)
-
- sum := hashNew()
- for _, labelName := range labelNames {
- sum = hashAdd(sum, string(labelName))
- sum = hashAddByte(sum, SeparatorByte)
- sum = hashAdd(sum, string(m[labelName]))
- sum = hashAddByte(sum, SeparatorByte)
- }
- return sum
-}
diff --git a/vendor/github.com/prometheus/common/model/silence.go b/vendor/github.com/prometheus/common/model/silence.go
deleted file mode 100644
index 910b0b7..0000000
--- a/vendor/github.com/prometheus/common/model/silence.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2015 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "regexp"
- "time"
-)
-
-// Matcher describes a matches the value of a given label.
-type Matcher struct {
- Name LabelName `json:"name"`
- Value string `json:"value"`
- IsRegex bool `json:"isRegex"`
-}
-
-func (m *Matcher) UnmarshalJSON(b []byte) error {
- type plain Matcher
- if err := json.Unmarshal(b, (*plain)(m)); err != nil {
- return err
- }
-
- if len(m.Name) == 0 {
- return fmt.Errorf("label name in matcher must not be empty")
- }
- if m.IsRegex {
- if _, err := regexp.Compile(m.Value); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Validate returns true iff all fields of the matcher have valid values.
-func (m *Matcher) Validate() error {
- if !m.Name.IsValid() {
- return fmt.Errorf("invalid name %q", m.Name)
- }
- if m.IsRegex {
- if _, err := regexp.Compile(m.Value); err != nil {
- return fmt.Errorf("invalid regular expression %q", m.Value)
- }
- } else if !LabelValue(m.Value).IsValid() || len(m.Value) == 0 {
- return fmt.Errorf("invalid value %q", m.Value)
- }
- return nil
-}
-
-// Silence defines the representation of a silence definition in the Prometheus
-// eco-system.
-type Silence struct {
- ID uint64 `json:"id,omitempty"`
-
- Matchers []*Matcher `json:"matchers"`
-
- StartsAt time.Time `json:"startsAt"`
- EndsAt time.Time `json:"endsAt"`
-
- CreatedAt time.Time `json:"createdAt,omitempty"`
- CreatedBy string `json:"createdBy"`
- Comment string `json:"comment,omitempty"`
-}
-
-// Validate returns true iff all fields of the silence have valid values.
-func (s *Silence) Validate() error {
- if len(s.Matchers) == 0 {
- return fmt.Errorf("at least one matcher required")
- }
- for _, m := range s.Matchers {
- if err := m.Validate(); err != nil {
- return fmt.Errorf("invalid matcher: %w", err)
- }
- }
- if s.StartsAt.IsZero() {
- return fmt.Errorf("start time missing")
- }
- if s.EndsAt.IsZero() {
- return fmt.Errorf("end time missing")
- }
- if s.EndsAt.Before(s.StartsAt) {
- return fmt.Errorf("start time must be before end time")
- }
- if s.CreatedBy == "" {
- return fmt.Errorf("creator information missing")
- }
- if s.Comment == "" {
- return fmt.Errorf("comment missing")
- }
- if s.CreatedAt.IsZero() {
- return fmt.Errorf("creation timestamp missing")
- }
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go
deleted file mode 100644
index 5727452..0000000
--- a/vendor/github.com/prometheus/common/model/time.go
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- // MinimumTick is the minimum supported time resolution. This has to be
- // at least time.Second in order for the code below to work.
- minimumTick = time.Millisecond
- // second is the Time duration equivalent to one second.
- second = int64(time.Second / minimumTick)
- // The number of nanoseconds per minimum tick.
- nanosPerTick = int64(minimumTick / time.Nanosecond)
-
- // Earliest is the earliest Time representable. Handy for
- // initializing a high watermark.
- Earliest = Time(math.MinInt64)
- // Latest is the latest Time representable. Handy for initializing
- // a low watermark.
- Latest = Time(math.MaxInt64)
-)
-
-// Time is the number of milliseconds since the epoch
-// (1970-01-01 00:00 UTC) excluding leap seconds.
-type Time int64
-
-// Interval describes an interval between two timestamps.
-type Interval struct {
- Start, End Time
-}
-
-// Now returns the current time as a Time.
-func Now() Time {
- return TimeFromUnixNano(time.Now().UnixNano())
-}
-
-// TimeFromUnix returns the Time equivalent to the Unix Time t
-// provided in seconds.
-func TimeFromUnix(t int64) Time {
- return Time(t * second)
-}
-
-// TimeFromUnixNano returns the Time equivalent to the Unix Time
-// t provided in nanoseconds.
-func TimeFromUnixNano(t int64) Time {
- return Time(t / nanosPerTick)
-}
-
-// Equal reports whether two Times represent the same instant.
-func (t Time) Equal(o Time) bool {
- return t == o
-}
-
-// Before reports whether the Time t is before o.
-func (t Time) Before(o Time) bool {
- return t < o
-}
-
-// After reports whether the Time t is after o.
-func (t Time) After(o Time) bool {
- return t > o
-}
-
-// Add returns the Time t + d.
-func (t Time) Add(d time.Duration) Time {
- return t + Time(d/minimumTick)
-}
-
-// Sub returns the Duration t - o.
-func (t Time) Sub(o Time) time.Duration {
- return time.Duration(t-o) * minimumTick
-}
-
-// Time returns the time.Time representation of t.
-func (t Time) Time() time.Time {
- return time.Unix(int64(t)/second, (int64(t)%second)*nanosPerTick)
-}
-
-// Unix returns t as a Unix time, the number of seconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) Unix() int64 {
- return int64(t) / second
-}
-
-// UnixNano returns t as a Unix time, the number of nanoseconds elapsed
-// since January 1, 1970 UTC.
-func (t Time) UnixNano() int64 {
- return int64(t) * nanosPerTick
-}
-
-// The number of digits after the dot.
-var dotPrecision = int(math.Log10(float64(second)))
-
-// String returns a string representation of the Time.
-func (t Time) String() string {
- return strconv.FormatFloat(float64(t)/float64(second), 'f', -1, 64)
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (t Time) MarshalJSON() ([]byte, error) {
- return []byte(t.String()), nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (t *Time) UnmarshalJSON(b []byte) error {
- p := strings.Split(string(b), ".")
- switch len(p) {
- case 1:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- *t = Time(v * second)
-
- case 2:
- v, err := strconv.ParseInt(string(p[0]), 10, 64)
- if err != nil {
- return err
- }
- v *= second
-
- prec := dotPrecision - len(p[1])
- if prec < 0 {
- p[1] = p[1][:dotPrecision]
- } else if prec > 0 {
- p[1] = p[1] + strings.Repeat("0", prec)
- }
-
- va, err := strconv.ParseInt(p[1], 10, 32)
- if err != nil {
- return err
- }
-
- // If the value was something like -0.1 the negative is lost in the
- // parsing because of the leading zero, this ensures that we capture it.
- if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 {
- *t = Time(v+va) * -1
- } else {
- *t = Time(v + va)
- }
-
- default:
- return fmt.Errorf("invalid time %q", string(b))
- }
- return nil
-}
-
-// Duration wraps time.Duration. It is used to parse the custom duration format
-// from YAML.
-// This type should not propagate beyond the scope of input/output processing.
-type Duration time.Duration
-
-// Set implements pflag/flag.Value
-func (d *Duration) Set(s string) error {
- var err error
- *d, err = ParseDuration(s)
- return err
-}
-
-// Type implements pflag.Value
-func (d *Duration) Type() string {
- return "duration"
-}
-
-func isdigit(c byte) bool { return c >= '0' && c <= '9' }
-
-// Units are required to go in order from biggest to smallest.
-// This guards against confusion from "1m1d" being 1 minute + 1 day, not 1 month + 1 day.
-var unitMap = map[string]struct {
- pos int
- mult uint64
-}{
- "ms": {7, uint64(time.Millisecond)},
- "s": {6, uint64(time.Second)},
- "m": {5, uint64(time.Minute)},
- "h": {4, uint64(time.Hour)},
- "d": {3, uint64(24 * time.Hour)},
- "w": {2, uint64(7 * 24 * time.Hour)},
- "y": {1, uint64(365 * 24 * time.Hour)},
-}
-
-// ParseDuration parses a string into a time.Duration, assuming that a year
-// always has 365d, a week always has 7d, and a day always has 24h.
-func ParseDuration(s string) (Duration, error) {
- switch s {
- case "0":
- // Allow 0 without a unit.
- return 0, nil
- case "":
- return 0, errors.New("empty duration string")
- }
-
- orig := s
- var dur uint64
- lastUnitPos := 0
-
- for s != "" {
- if !isdigit(s[0]) {
- return 0, fmt.Errorf("not a valid duration string: %q", orig)
- }
- // Consume [0-9]*
- i := 0
- for ; i < len(s) && isdigit(s[i]); i++ {
- }
- v, err := strconv.ParseUint(s[:i], 10, 0)
- if err != nil {
- return 0, fmt.Errorf("not a valid duration string: %q", orig)
- }
- s = s[i:]
-
- // Consume unit.
- for i = 0; i < len(s) && !isdigit(s[i]); i++ {
- }
- if i == 0 {
- return 0, fmt.Errorf("not a valid duration string: %q", orig)
- }
- u := s[:i]
- s = s[i:]
- unit, ok := unitMap[u]
- if !ok {
- return 0, fmt.Errorf("unknown unit %q in duration %q", u, orig)
- }
- if unit.pos <= lastUnitPos { // Units must go in order from biggest to smallest.
- return 0, fmt.Errorf("not a valid duration string: %q", orig)
- }
- lastUnitPos = unit.pos
- // Check if the provided duration overflows time.Duration (> ~ 290years).
- if v > 1<<63/unit.mult {
- return 0, errors.New("duration out of range")
- }
- dur += v * unit.mult
- if dur > 1<<63-1 {
- return 0, errors.New("duration out of range")
- }
- }
- return Duration(dur), nil
-}
-
-func (d Duration) String() string {
- var (
- ms = int64(time.Duration(d) / time.Millisecond)
- r = ""
- )
- if ms == 0 {
- return "0s"
- }
-
- f := func(unit string, mult int64, exact bool) {
- if exact && ms%mult != 0 {
- return
- }
- if v := ms / mult; v > 0 {
- r += fmt.Sprintf("%d%s", v, unit)
- ms -= v * mult
- }
- }
-
- // Only format years and weeks if the remainder is zero, as it is often
- // easier to read 90d than 12w6d.
- f("y", 1000*60*60*24*365, true)
- f("w", 1000*60*60*24*7, true)
-
- f("d", 1000*60*60*24, false)
- f("h", 1000*60*60, false)
- f("m", 1000*60, false)
- f("s", 1000, false)
- f("ms", 1, false)
-
- return r
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (d Duration) MarshalJSON() ([]byte, error) {
- return json.Marshal(d.String())
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (d *Duration) UnmarshalJSON(bytes []byte) error {
- var s string
- if err := json.Unmarshal(bytes, &s); err != nil {
- return err
- }
- dur, err := ParseDuration(s)
- if err != nil {
- return err
- }
- *d = dur
- return nil
-}
-
-// MarshalText implements the encoding.TextMarshaler interface.
-func (d *Duration) MarshalText() ([]byte, error) {
- return []byte(d.String()), nil
-}
-
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
-func (d *Duration) UnmarshalText(text []byte) error {
- var err error
- *d, err = ParseDuration(string(text))
- return err
-}
-
-// MarshalYAML implements the yaml.Marshaler interface.
-func (d Duration) MarshalYAML() (interface{}, error) {
- return d.String(), nil
-}
-
-// UnmarshalYAML implements the yaml.Unmarshaler interface.
-func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
- var s string
- if err := unmarshal(&s); err != nil {
- return err
- }
- dur, err := ParseDuration(s)
- if err != nil {
- return err
- }
- *d = dur
- return nil
-}
diff --git a/vendor/github.com/prometheus/common/model/value.go b/vendor/github.com/prometheus/common/model/value.go
deleted file mode 100644
index 8050637..0000000
--- a/vendor/github.com/prometheus/common/model/value.go
+++ /dev/null
@@ -1,364 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "sort"
- "strconv"
- "strings"
-)
-
-// ZeroSample is the pseudo zero-value of Sample used to signal a
-// non-existing sample. It is a Sample with timestamp Earliest, value 0.0,
-// and metric nil. Note that the natural zero value of Sample has a timestamp
-// of 0, which is possible to appear in a real Sample and thus not suitable
-// to signal a non-existing Sample.
-var ZeroSample = Sample{Timestamp: Earliest}
-
-// Sample is a sample pair associated with a metric. A single sample must either
-// define Value or Histogram but not both. Histogram == nil implies the Value
-// field is used, otherwise it should be ignored.
-type Sample struct {
- Metric Metric `json:"metric"`
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
- Histogram *SampleHistogram `json:"histogram"`
-}
-
-// Equal compares first the metrics, then the timestamp, then the value. The
-// semantics of value equality is defined by SampleValue.Equal.
-func (s *Sample) Equal(o *Sample) bool {
- if s == o {
- return true
- }
-
- if !s.Metric.Equal(o.Metric) {
- return false
- }
- if !s.Timestamp.Equal(o.Timestamp) {
- return false
- }
- if s.Histogram != nil {
- return s.Histogram.Equal(o.Histogram)
- }
- return s.Value.Equal(o.Value)
-}
-
-func (s Sample) String() string {
- if s.Histogram != nil {
- return fmt.Sprintf("%s => %s", s.Metric, SampleHistogramPair{
- Timestamp: s.Timestamp,
- Histogram: s.Histogram,
- })
- }
- return fmt.Sprintf("%s => %s", s.Metric, SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- })
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Sample) MarshalJSON() ([]byte, error) {
- if s.Histogram != nil {
- v := struct {
- Metric Metric `json:"metric"`
- Histogram SampleHistogramPair `json:"histogram"`
- }{
- Metric: s.Metric,
- Histogram: SampleHistogramPair{
- Timestamp: s.Timestamp,
- Histogram: s.Histogram,
- },
- }
- return json.Marshal(&v)
- }
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- }
- return json.Marshal(&v)
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Sample) UnmarshalJSON(b []byte) error {
- v := struct {
- Metric Metric `json:"metric"`
- Value SamplePair `json:"value"`
- Histogram SampleHistogramPair `json:"histogram"`
- }{
- Metric: s.Metric,
- Value: SamplePair{
- Timestamp: s.Timestamp,
- Value: s.Value,
- },
- Histogram: SampleHistogramPair{
- Timestamp: s.Timestamp,
- Histogram: s.Histogram,
- },
- }
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- s.Metric = v.Metric
- if v.Histogram.Histogram != nil {
- s.Timestamp = v.Histogram.Timestamp
- s.Histogram = v.Histogram.Histogram
- } else {
- s.Timestamp = v.Value.Timestamp
- s.Value = v.Value.Value
- }
-
- return nil
-}
-
-// Samples is a sortable Sample slice. It implements sort.Interface.
-type Samples []*Sample
-
-func (s Samples) Len() int {
- return len(s)
-}
-
-// Less compares first the metrics, then the timestamp.
-func (s Samples) Less(i, j int) bool {
- switch {
- case s[i].Metric.Before(s[j].Metric):
- return true
- case s[j].Metric.Before(s[i].Metric):
- return false
- case s[i].Timestamp.Before(s[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-func (s Samples) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (s Samples) Equal(o Samples) bool {
- if len(s) != len(o) {
- return false
- }
-
- for i, sample := range s {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// SampleStream is a stream of Values belonging to an attached COWMetric.
-type SampleStream struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
- Histograms []SampleHistogramPair `json:"histograms"`
-}
-
-func (ss SampleStream) String() string {
- valuesLength := len(ss.Values)
- vals := make([]string, valuesLength+len(ss.Histograms))
- for i, v := range ss.Values {
- vals[i] = v.String()
- }
- for i, v := range ss.Histograms {
- vals[i+valuesLength] = v.String()
- }
- return fmt.Sprintf("%s =>\n%s", ss.Metric, strings.Join(vals, "\n"))
-}
-
-func (ss SampleStream) MarshalJSON() ([]byte, error) {
- if len(ss.Histograms) > 0 && len(ss.Values) > 0 {
- v := struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
- Histograms []SampleHistogramPair `json:"histograms"`
- }{
- Metric: ss.Metric,
- Values: ss.Values,
- Histograms: ss.Histograms,
- }
- return json.Marshal(&v)
- } else if len(ss.Histograms) > 0 {
- v := struct {
- Metric Metric `json:"metric"`
- Histograms []SampleHistogramPair `json:"histograms"`
- }{
- Metric: ss.Metric,
- Histograms: ss.Histograms,
- }
- return json.Marshal(&v)
- } else {
- v := struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
- }{
- Metric: ss.Metric,
- Values: ss.Values,
- }
- return json.Marshal(&v)
- }
-}
-
-func (ss *SampleStream) UnmarshalJSON(b []byte) error {
- v := struct {
- Metric Metric `json:"metric"`
- Values []SamplePair `json:"values"`
- Histograms []SampleHistogramPair `json:"histograms"`
- }{
- Metric: ss.Metric,
- Values: ss.Values,
- Histograms: ss.Histograms,
- }
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- ss.Metric = v.Metric
- ss.Values = v.Values
- ss.Histograms = v.Histograms
-
- return nil
-}
-
-// Scalar is a scalar value evaluated at the set timestamp.
-type Scalar struct {
- Value SampleValue `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s Scalar) String() string {
- return fmt.Sprintf("scalar: %v @[%v]", s.Value, s.Timestamp)
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s Scalar) MarshalJSON() ([]byte, error) {
- v := strconv.FormatFloat(float64(s.Value), 'f', -1, 64)
- return json.Marshal([...]interface{}{s.Timestamp, string(v)})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *Scalar) UnmarshalJSON(b []byte) error {
- var f string
- v := [...]interface{}{&s.Timestamp, &f}
-
- if err := json.Unmarshal(b, &v); err != nil {
- return err
- }
-
- value, err := strconv.ParseFloat(f, 64)
- if err != nil {
- return fmt.Errorf("error parsing sample value: %w", err)
- }
- s.Value = SampleValue(value)
- return nil
-}
-
-// String is a string value evaluated at the set timestamp.
-type String struct {
- Value string `json:"value"`
- Timestamp Time `json:"timestamp"`
-}
-
-func (s *String) String() string {
- return s.Value
-}
-
-// MarshalJSON implements json.Marshaler.
-func (s String) MarshalJSON() ([]byte, error) {
- return json.Marshal([]interface{}{s.Timestamp, s.Value})
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *String) UnmarshalJSON(b []byte) error {
- v := [...]interface{}{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Vector is basically only an alias for Samples, but the
-// contract is that in a Vector, all Samples have the same timestamp.
-type Vector []*Sample
-
-func (vec Vector) String() string {
- entries := make([]string, len(vec))
- for i, s := range vec {
- entries[i] = s.String()
- }
- return strings.Join(entries, "\n")
-}
-
-func (vec Vector) Len() int { return len(vec) }
-func (vec Vector) Swap(i, j int) { vec[i], vec[j] = vec[j], vec[i] }
-
-// Less compares first the metrics, then the timestamp.
-func (vec Vector) Less(i, j int) bool {
- switch {
- case vec[i].Metric.Before(vec[j].Metric):
- return true
- case vec[j].Metric.Before(vec[i].Metric):
- return false
- case vec[i].Timestamp.Before(vec[j].Timestamp):
- return true
- default:
- return false
- }
-}
-
-// Equal compares two sets of samples and returns true if they are equal.
-func (vec Vector) Equal(o Vector) bool {
- if len(vec) != len(o) {
- return false
- }
-
- for i, sample := range vec {
- if !sample.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-// Matrix is a list of time series.
-type Matrix []*SampleStream
-
-func (m Matrix) Len() int { return len(m) }
-func (m Matrix) Less(i, j int) bool { return m[i].Metric.Before(m[j].Metric) }
-func (m Matrix) Swap(i, j int) { m[i], m[j] = m[j], m[i] }
-
-func (mat Matrix) String() string {
- matCp := make(Matrix, len(mat))
- copy(matCp, mat)
- sort.Sort(matCp)
-
- strs := make([]string, len(matCp))
-
- for i, ss := range matCp {
- strs[i] = ss.String()
- }
-
- return strings.Join(strs, "\n")
-}
diff --git a/vendor/github.com/prometheus/common/model/value_float.go b/vendor/github.com/prometheus/common/model/value_float.go
deleted file mode 100644
index ae35cc2..0000000
--- a/vendor/github.com/prometheus/common/model/value_float.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "math"
- "strconv"
-)
-
-// ZeroSamplePair is the pseudo zero-value of SamplePair used to signal a
-// non-existing sample pair. It is a SamplePair with timestamp Earliest and
-// value 0.0. Note that the natural zero value of SamplePair has a timestamp
-// of 0, which is possible to appear in a real SamplePair and thus not
-// suitable to signal a non-existing SamplePair.
-var ZeroSamplePair = SamplePair{Timestamp: Earliest}
-
-// A SampleValue is a representation of a value for a given sample at a given
-// time.
-type SampleValue float64
-
-// MarshalJSON implements json.Marshaler.
-func (v SampleValue) MarshalJSON() ([]byte, error) {
- return json.Marshal(v.String())
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (v *SampleValue) UnmarshalJSON(b []byte) error {
- if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
- return fmt.Errorf("sample value must be a quoted string")
- }
- f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64)
- if err != nil {
- return err
- }
- *v = SampleValue(f)
- return nil
-}
-
-// Equal returns true if the value of v and o is equal or if both are NaN. Note
-// that v==o is false if both are NaN. If you want the conventional float
-// behavior, use == to compare two SampleValues.
-func (v SampleValue) Equal(o SampleValue) bool {
- if v == o {
- return true
- }
- return math.IsNaN(float64(v)) && math.IsNaN(float64(o))
-}
-
-func (v SampleValue) String() string {
- return strconv.FormatFloat(float64(v), 'f', -1, 64)
-}
-
-// SamplePair pairs a SampleValue with a Timestamp.
-type SamplePair struct {
- Timestamp Time
- Value SampleValue
-}
-
-func (s SamplePair) MarshalJSON() ([]byte, error) {
- t, err := json.Marshal(s.Timestamp)
- if err != nil {
- return nil, err
- }
- v, err := json.Marshal(s.Value)
- if err != nil {
- return nil, err
- }
- return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil
-}
-
-// UnmarshalJSON implements json.Unmarshaler.
-func (s *SamplePair) UnmarshalJSON(b []byte) error {
- v := [...]json.Unmarshaler{&s.Timestamp, &s.Value}
- return json.Unmarshal(b, &v)
-}
-
-// Equal returns true if this SamplePair and o have equal Values and equal
-// Timestamps. The semantics of Value equality is defined by SampleValue.Equal.
-func (s *SamplePair) Equal(o *SamplePair) bool {
- return s == o || (s.Value.Equal(o.Value) && s.Timestamp.Equal(o.Timestamp))
-}
-
-func (s SamplePair) String() string {
- return fmt.Sprintf("%s @[%s]", s.Value, s.Timestamp)
-}
diff --git a/vendor/github.com/prometheus/common/model/value_histogram.go b/vendor/github.com/prometheus/common/model/value_histogram.go
deleted file mode 100644
index 54bb038..0000000
--- a/vendor/github.com/prometheus/common/model/value_histogram.go
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
- "strings"
-)
-
-type FloatString float64
-
-func (v FloatString) String() string {
- return strconv.FormatFloat(float64(v), 'f', -1, 64)
-}
-
-func (v FloatString) MarshalJSON() ([]byte, error) {
- return json.Marshal(v.String())
-}
-
-func (v *FloatString) UnmarshalJSON(b []byte) error {
- if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' {
- return fmt.Errorf("float value must be a quoted string")
- }
- f, err := strconv.ParseFloat(string(b[1:len(b)-1]), 64)
- if err != nil {
- return err
- }
- *v = FloatString(f)
- return nil
-}
-
-type HistogramBucket struct {
- Boundaries int32
- Lower FloatString
- Upper FloatString
- Count FloatString
-}
-
-func (s HistogramBucket) MarshalJSON() ([]byte, error) {
- b, err := json.Marshal(s.Boundaries)
- if err != nil {
- return nil, err
- }
- l, err := json.Marshal(s.Lower)
- if err != nil {
- return nil, err
- }
- u, err := json.Marshal(s.Upper)
- if err != nil {
- return nil, err
- }
- c, err := json.Marshal(s.Count)
- if err != nil {
- return nil, err
- }
- return []byte(fmt.Sprintf("[%s,%s,%s,%s]", b, l, u, c)), nil
-}
-
-func (s *HistogramBucket) UnmarshalJSON(buf []byte) error {
- tmp := []interface{}{&s.Boundaries, &s.Lower, &s.Upper, &s.Count}
- wantLen := len(tmp)
- if err := json.Unmarshal(buf, &tmp); err != nil {
- return err
- }
- if gotLen := len(tmp); gotLen != wantLen {
- return fmt.Errorf("wrong number of fields: %d != %d", gotLen, wantLen)
- }
- return nil
-}
-
-func (s *HistogramBucket) Equal(o *HistogramBucket) bool {
- return s == o || (s.Boundaries == o.Boundaries && s.Lower == o.Lower && s.Upper == o.Upper && s.Count == o.Count)
-}
-
-func (b HistogramBucket) String() string {
- var sb strings.Builder
- lowerInclusive := b.Boundaries == 1 || b.Boundaries == 3
- upperInclusive := b.Boundaries == 0 || b.Boundaries == 3
- if lowerInclusive {
- sb.WriteRune('[')
- } else {
- sb.WriteRune('(')
- }
- fmt.Fprintf(&sb, "%g,%g", b.Lower, b.Upper)
- if upperInclusive {
- sb.WriteRune(']')
- } else {
- sb.WriteRune(')')
- }
- fmt.Fprintf(&sb, ":%v", b.Count)
- return sb.String()
-}
-
-type HistogramBuckets []*HistogramBucket
-
-func (s HistogramBuckets) Equal(o HistogramBuckets) bool {
- if len(s) != len(o) {
- return false
- }
-
- for i, bucket := range s {
- if !bucket.Equal(o[i]) {
- return false
- }
- }
- return true
-}
-
-type SampleHistogram struct {
- Count FloatString `json:"count"`
- Sum FloatString `json:"sum"`
- Buckets HistogramBuckets `json:"buckets"`
-}
-
-func (s SampleHistogram) String() string {
- return fmt.Sprintf("Count: %f, Sum: %f, Buckets: %v", s.Count, s.Sum, s.Buckets)
-}
-
-func (s *SampleHistogram) Equal(o *SampleHistogram) bool {
- return s == o || (s.Count == o.Count && s.Sum == o.Sum && s.Buckets.Equal(o.Buckets))
-}
-
-type SampleHistogramPair struct {
- Timestamp Time
- // Histogram should never be nil, it's only stored as pointer for efficiency.
- Histogram *SampleHistogram
-}
-
-func (s SampleHistogramPair) MarshalJSON() ([]byte, error) {
- if s.Histogram == nil {
- return nil, fmt.Errorf("histogram is nil")
- }
- t, err := json.Marshal(s.Timestamp)
- if err != nil {
- return nil, err
- }
- v, err := json.Marshal(s.Histogram)
- if err != nil {
- return nil, err
- }
- return []byte(fmt.Sprintf("[%s,%s]", t, v)), nil
-}
-
-func (s *SampleHistogramPair) UnmarshalJSON(buf []byte) error {
- tmp := []interface{}{&s.Timestamp, &s.Histogram}
- wantLen := len(tmp)
- if err := json.Unmarshal(buf, &tmp); err != nil {
- return err
- }
- if gotLen := len(tmp); gotLen != wantLen {
- return fmt.Errorf("wrong number of fields: %d != %d", gotLen, wantLen)
- }
- if s.Histogram == nil {
- return fmt.Errorf("histogram is null")
- }
- return nil
-}
-
-func (s SampleHistogramPair) String() string {
- return fmt.Sprintf("%s @[%s]", s.Histogram, s.Timestamp)
-}
-
-func (s *SampleHistogramPair) Equal(o *SampleHistogramPair) bool {
- return s == o || (s.Histogram.Equal(o.Histogram) && s.Timestamp.Equal(o.Timestamp))
-}
diff --git a/vendor/github.com/prometheus/common/model/value_type.go b/vendor/github.com/prometheus/common/model/value_type.go
deleted file mode 100644
index 726c50e..0000000
--- a/vendor/github.com/prometheus/common/model/value_type.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2013 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
-)
-
-// Value is a generic interface for values resulting from a query evaluation.
-type Value interface {
- Type() ValueType
- String() string
-}
-
-func (Matrix) Type() ValueType { return ValMatrix }
-func (Vector) Type() ValueType { return ValVector }
-func (*Scalar) Type() ValueType { return ValScalar }
-func (*String) Type() ValueType { return ValString }
-
-type ValueType int
-
-const (
- ValNone ValueType = iota
- ValScalar
- ValVector
- ValMatrix
- ValString
-)
-
-// MarshalJSON implements json.Marshaler.
-func (et ValueType) MarshalJSON() ([]byte, error) {
- return json.Marshal(et.String())
-}
-
-func (et *ValueType) UnmarshalJSON(b []byte) error {
- var s string
- if err := json.Unmarshal(b, &s); err != nil {
- return err
- }
- switch s {
- case "":
- *et = ValNone
- case "scalar":
- *et = ValScalar
- case "vector":
- *et = ValVector
- case "matrix":
- *et = ValMatrix
- case "string":
- *et = ValString
- default:
- return fmt.Errorf("unknown value type %q", s)
- }
- return nil
-}
-
-func (e ValueType) String() string {
- switch e {
- case ValNone:
- return ""
- case ValScalar:
- return "scalar"
- case ValVector:
- return "vector"
- case ValMatrix:
- return "matrix"
- case ValString:
- return "string"
- }
- panic("ValueType.String: unhandled value type")
-}
diff --git a/vendor/github.com/prometheus/common/version/info.go b/vendor/github.com/prometheus/common/version/info.go
index 6b526d9..044032c 100644
--- a/vendor/github.com/prometheus/common/version/info.go
+++ b/vendor/github.com/prometheus/common/version/info.go
@@ -19,8 +19,6 @@ import (
"runtime"
"strings"
"text/template"
-
- "github.com/prometheus/client_golang/prometheus"
)
// Build information. Populated at build-time.
@@ -35,33 +33,6 @@ var (
GoArch = runtime.GOARCH
)
-// Deprecated: Use github.com/prometheus/client_golang/prometheus/collectors/version.NewCollector instead.
-//
-// NewCollector returns a collector that exports metrics about current version
-// information.
-func NewCollector(program string) prometheus.Collector {
- return prometheus.NewGaugeFunc(
- prometheus.GaugeOpts{
- Namespace: program,
- Name: "build_info",
- Help: fmt.Sprintf(
- "A metric with a constant '1' value labeled by version, revision, branch, goversion from which %s was built, and the goos and goarch for the build.",
- program,
- ),
- ConstLabels: prometheus.Labels{
- "version": Version,
- "revision": GetRevision(),
- "branch": Branch,
- "goversion": GoVersion,
- "goos": GoOS,
- "goarch": GoArch,
- "tags": GetTags(),
- },
- },
- func() float64 { return 1 },
- )
-}
-
// versionInfoTmpl contains the template used by Info.
var versionInfoTmpl = `
{{.program}}, version {{.version}} (branch: {{.branch}}, revision: {{.revision}})
diff --git a/vendor/github.com/prometheus/procfs/.gitignore b/vendor/github.com/prometheus/procfs/.gitignore
deleted file mode 100644
index 7cc33ae..0000000
--- a/vendor/github.com/prometheus/procfs/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/testdata/fixtures/
-/fixtures
diff --git a/vendor/github.com/prometheus/procfs/.golangci.yml b/vendor/github.com/prometheus/procfs/.golangci.yml
deleted file mode 100644
index c24864a..0000000
--- a/vendor/github.com/prometheus/procfs/.golangci.yml
+++ /dev/null
@@ -1,15 +0,0 @@
----
-linters:
- enable:
- - godot
- - misspell
- - revive
-
-linter-settings:
- godot:
- capital: true
- exclude:
- # Ignore "See: URL"
- - 'See:'
- misspell:
- locale: US
diff --git a/vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md b/vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md
deleted file mode 100644
index d325872..0000000
--- a/vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Prometheus Community Code of Conduct
-
-Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
diff --git a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
deleted file mode 100644
index 853eb9d..0000000
--- a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# Contributing
-
-Prometheus uses GitHub to manage reviews of pull requests.
-
-* If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
-
-* If you have a trivial fix or improvement, go ahead and create a pull request,
- addressing (with `@...`) a suitable maintainer of this repository (see
- [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request.
-
-* If you plan to do something more involved, first discuss your ideas
- on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers).
- This will avoid unnecessary work and surely give you and us a good deal
- of inspiration. Also please see our [non-goals issue](https://github.com/prometheus/docs/issues/149) on areas that the Prometheus community doesn't plan to work on.
-
-* Relevant coding style guidelines are the [Go Code Review
- Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments)
- and the _Formatting and style_ section of Peter Bourgon's [Go: Best
- Practices for Production
- Environments](https://peter.bourgon.org/go-in-production/#formatting-and-style).
-
-* Be sure to sign off on the [DCO](https://github.com/probot/dco#how-it-works)
-
-## Steps to Contribute
-
-Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.
-
-Please check the [`help-wanted`](https://github.com/prometheus/procfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the maintainers will clarify it. For a quicker response, contact us over [IRC](https://prometheus.io/community).
-
-For quickly compiling and testing your changes do:
-```
-make test # Make sure all the tests pass before you commit and push :)
-```
-
-We use [`golangci-lint`](https://github.com/golangci/golangci-lint) for linting the code. If it reports an issue and you think that the warning needs to be disregarded or is a false-positive, you can add a special comment `//nolint:linter1[,linter2,...]` before the offending line. Use this sparingly though, fixing the code to comply with the linter's recommendation is in general the preferred course of action.
-
-## Pull Request Checklist
-
-* Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
-
-* Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests).
-
-* If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review on IRC channel [#prometheus](https://webchat.freenode.net/?channels=#prometheus) on irc.freenode.net (for the easiest start, [join via Riot](https://riot.im/app/#/room/#prometheus:matrix.org)).
-
-* Add tests relevant to the fixed bug or new feature.
-
-## Dependency management
-
-The Prometheus project uses [Go modules](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more) to manage dependencies on external packages. This requires a working Go environment with version 1.12 or greater installed.
-
-All dependencies are vendored in the `vendor/` directory.
-
-To add or update a new dependency, use the `go get` command:
-
-```bash
-# Pick the latest tagged release.
-go get example.com/some/module/pkg
-
-# Pick a specific version.
-go get example.com/some/module/pkg@vX.Y.Z
-```
-
-Tidy up the `go.mod` and `go.sum` files and copy the new/updated dependency to the `vendor/` directory:
-
-
-```bash
-# The GO111MODULE variable can be omitted when the code isn't located in GOPATH.
-GO111MODULE=on go mod tidy
-
-GO111MODULE=on go mod vendor
-```
-
-You have to commit the changes to `go.mod`, `go.sum` and the `vendor/` directory before submitting the pull request.
-
-
-## API Implementation Guidelines
-
-### Naming and Documentation
-
-Public functions and structs should normally be named according to the file(s) being read and parsed. For example,
-the `fs.BuddyInfo()` function reads the file `/proc/buddyinfo`. In addition, the godoc for each public function
-should contain the path to the file(s) being read and a URL of the linux kernel documentation describing the file(s).
-
-### Reading vs. Parsing
-
-Most functionality in this library consists of reading files and then parsing the text into structured data. In most
-cases reading and parsing should be separated into different functions/methods with a public `fs.Thing()` method and
-a private `parseThing(r Reader)` function. This provides a logical separation and allows parsing to be tested
-directly without the need to read from the filesystem. Using a `Reader` argument is preferred over other data types
-such as `string` or `*File` because it provides the most flexibility regarding the data source. When a set of files
-in a directory needs to be parsed, then a `path` string parameter to the parse function can be used instead.
-
-### /proc and /sys filesystem I/O
-
-The `proc` and `sys` filesystems are pseudo file systems and work a bit differently from standard disk I/O.
-Many of the files are changing continuously and the data being read can in some cases change between subsequent
-reads in the same file. Also, most of the files are relatively small (less than a few KBs), and system calls
-to the `stat` function will often return the wrong size. Therefore, for most files it's recommended to read the
-full file in a single operation using an internal utility function called `util.ReadFileNoStat`.
-This function is similar to `os.ReadFile`, but it avoids the system call to `stat` to get the current size of
-the file.
-
-Note that parsing the file's contents can still be performed one line at a time. This is done by first reading
-the full file, and then using a scanner on the `[]byte` or `string` containing the data.
-
-```
- data, err := util.ReadFileNoStat("/proc/cpuinfo")
- if err != nil {
- return err
- }
- reader := bytes.NewReader(data)
- scanner := bufio.NewScanner(reader)
-```
-
-The `/sys` filesystem contains many very small files which contain only a single numeric or text value. These files
-can be read using an internal function called `util.SysReadFile` which is similar to `os.ReadFile` but does
-not bother to check the size of the file before reading.
-```
- data, err := util.SysReadFile("/sys/class/power_supply/BAT0/capacity")
-```
-
diff --git a/vendor/github.com/prometheus/procfs/LICENSE b/vendor/github.com/prometheus/procfs/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/vendor/github.com/prometheus/procfs/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/prometheus/procfs/MAINTAINERS.md b/vendor/github.com/prometheus/procfs/MAINTAINERS.md
deleted file mode 100644
index 56ba67d..0000000
--- a/vendor/github.com/prometheus/procfs/MAINTAINERS.md
+++ /dev/null
@@ -1,2 +0,0 @@
-* Johannes 'fish' Ziemke @discordianfish
-* Paul Gier @pgier
diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile
deleted file mode 100644
index 7edfe4d..0000000
--- a/vendor/github.com/prometheus/procfs/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2018 The Prometheus Authors
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-include Makefile.common
-
-%/.unpacked: %.ttar
- @echo ">> extracting fixtures $*"
- ./ttar -C $(dir $*) -x -f $*.ttar
- touch $@
-
-fixtures: testdata/fixtures/.unpacked
-
-update_fixtures:
- rm -vf testdata/fixtures/.unpacked
- ./ttar -c -f testdata/fixtures.ttar -C testdata/ fixtures/
-
-.PHONY: build
-build:
-
-.PHONY: test
-test: testdata/fixtures/.unpacked common-test
diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common
deleted file mode 100644
index 062a281..0000000
--- a/vendor/github.com/prometheus/procfs/Makefile.common
+++ /dev/null
@@ -1,269 +0,0 @@
-# Copyright 2018 The Prometheus Authors
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# A common Makefile that includes rules to be reused in different prometheus projects.
-# !!! Open PRs only against the prometheus/prometheus/Makefile.common repository!
-
-# Example usage :
-# Create the main Makefile in the root project directory.
-# include Makefile.common
-# customTarget:
-# @echo ">> Running customTarget"
-#
-
-# Ensure GOBIN is not set during build so that promu is installed to the correct path
-unexport GOBIN
-
-GO ?= go
-GOFMT ?= $(GO)fmt
-FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
-GOOPTS ?=
-GOHOSTOS ?= $(shell $(GO) env GOHOSTOS)
-GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH)
-
-GO_VERSION ?= $(shell $(GO) version)
-GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
-PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
-
-PROMU := $(FIRST_GOPATH)/bin/promu
-pkgs = ./...
-
-ifeq (arm, $(GOHOSTARCH))
- GOHOSTARM ?= $(shell GOARM= $(GO) env GOARM)
- GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)v$(GOHOSTARM)
-else
- GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)
-endif
-
-GOTEST := $(GO) test
-GOTEST_DIR :=
-ifneq ($(CIRCLE_JOB),)
-ifneq ($(shell command -v gotestsum > /dev/null),)
- GOTEST_DIR := test-results
- GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
-endif
-endif
-
-PROMU_VERSION ?= 0.15.0
-PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
-
-SKIP_GOLANGCI_LINT :=
-GOLANGCI_LINT :=
-GOLANGCI_LINT_OPTS ?=
-GOLANGCI_LINT_VERSION ?= v1.54.2
-# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
-# windows isn't included here because of the path separator being different.
-ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
- ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
- # If we're in CI and there is an Actions file, that means the linter
- # is being run in Actions, so we don't need to run it here.
- ifneq (,$(SKIP_GOLANGCI_LINT))
- GOLANGCI_LINT :=
- else ifeq (,$(CIRCLE_JOB))
- GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
- else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
- GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
- endif
- endif
-endif
-
-PREFIX ?= $(shell pwd)
-BIN_DIR ?= $(shell pwd)
-DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD))
-DOCKERFILE_PATH ?= ./Dockerfile
-DOCKERBUILD_CONTEXT ?= ./
-DOCKER_REPO ?= prom
-
-DOCKER_ARCHS ?= amd64
-
-BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
-PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
-TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))
-
-SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))
-
-ifeq ($(GOHOSTARCH),amd64)
- ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
- # Only supported on amd64
- test-flags := -race
- endif
-endif
-
-# This rule is used to forward a target like "build" to "common-build". This
-# allows a new "build" target to be defined in a Makefile which includes this
-# one and override "common-build" without override warnings.
-%: common-% ;
-
-.PHONY: common-all
-common-all: precheck style check_license lint yamllint unused build test
-
-.PHONY: common-style
-common-style:
- @echo ">> checking code style"
- @fmtRes=$$($(GOFMT) -d $$(find . -path ./vendor -prune -o -name '*.go' -print)); \
- if [ -n "$${fmtRes}" ]; then \
- echo "gofmt checking failed!"; echo "$${fmtRes}"; echo; \
- echo "Please ensure you are using $$($(GO) version) for formatting code."; \
- exit 1; \
- fi
-
-.PHONY: common-check_license
-common-check_license:
- @echo ">> checking license header"
- @licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
- awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
- done); \
- if [ -n "$${licRes}" ]; then \
- echo "license header checking failed:"; echo "$${licRes}"; \
- exit 1; \
- fi
-
-.PHONY: common-deps
-common-deps:
- @echo ">> getting dependencies"
- $(GO) mod download
-
-.PHONY: update-go-deps
-update-go-deps:
- @echo ">> updating Go dependencies"
- @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
- $(GO) get -d $$m; \
- done
- $(GO) mod tidy
-
-.PHONY: common-test-short
-common-test-short: $(GOTEST_DIR)
- @echo ">> running short tests"
- $(GOTEST) -short $(GOOPTS) $(pkgs)
-
-.PHONY: common-test
-common-test: $(GOTEST_DIR)
- @echo ">> running all tests"
- $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
-
-$(GOTEST_DIR):
- @mkdir -p $@
-
-.PHONY: common-format
-common-format:
- @echo ">> formatting code"
- $(GO) fmt $(pkgs)
-
-.PHONY: common-vet
-common-vet:
- @echo ">> vetting code"
- $(GO) vet $(GOOPTS) $(pkgs)
-
-.PHONY: common-lint
-common-lint: $(GOLANGCI_LINT)
-ifdef GOLANGCI_LINT
- @echo ">> running golangci-lint"
-# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
-# Otherwise staticcheck might fail randomly for some reason not yet explained.
- $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
- $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
-endif
-
-.PHONY: common-yamllint
-common-yamllint:
- @echo ">> running yamllint on all YAML files in the repository"
-ifeq (, $(shell command -v yamllint > /dev/null))
- @echo "yamllint not installed so skipping"
-else
- yamllint .
-endif
-
-# For backward-compatibility.
-.PHONY: common-staticcheck
-common-staticcheck: lint
-
-.PHONY: common-unused
-common-unused:
- @echo ">> running check for unused/missing packages in go.mod"
- $(GO) mod tidy
- @git diff --exit-code -- go.sum go.mod
-
-.PHONY: common-build
-common-build: promu
- @echo ">> building binaries"
- $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
-
-.PHONY: common-tarball
-common-tarball: promu
- @echo ">> building release tarball"
- $(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR)
-
-.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
-common-docker: $(BUILD_DOCKER_ARCHS)
-$(BUILD_DOCKER_ARCHS): common-docker-%:
- docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
- -f $(DOCKERFILE_PATH) \
- --build-arg ARCH="$*" \
- --build-arg OS="linux" \
- $(DOCKERBUILD_CONTEXT)
-
-.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
-common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
-$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
- docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"
-
-DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
-.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
-common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
-$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
- docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
- docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
-
-.PHONY: common-docker-manifest
-common-docker-manifest:
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(SANITIZED_DOCKER_IMAGE_TAG))
- DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"
-
-.PHONY: promu
-promu: $(PROMU)
-
-$(PROMU):
- $(eval PROMU_TMP := $(shell mktemp -d))
- curl -s -L $(PROMU_URL) | tar -xvzf - -C $(PROMU_TMP)
- mkdir -p $(FIRST_GOPATH)/bin
- cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
- rm -r $(PROMU_TMP)
-
-.PHONY: proto
-proto:
- @echo ">> generating code from proto files"
- @./scripts/genproto.sh
-
-ifdef GOLANGCI_LINT
-$(GOLANGCI_LINT):
- mkdir -p $(FIRST_GOPATH)/bin
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \
- | sed -e '/install -d/d' \
- | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
-endif
-
-.PHONY: precheck
-precheck::
-
-define PRECHECK_COMMAND_template =
-precheck:: $(1)_precheck
-
-PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1)))
-.PHONY: $(1)_precheck
-$(1)_precheck:
- @if ! $$(PRECHECK_COMMAND_$(1)) 1>/dev/null 2>&1; then \
- echo "Execution of '$$(PRECHECK_COMMAND_$(1))' command failed. Is $(1) installed?"; \
- exit 1; \
- fi
-endef
diff --git a/vendor/github.com/prometheus/procfs/NOTICE b/vendor/github.com/prometheus/procfs/NOTICE
deleted file mode 100644
index 53c5e9a..0000000
--- a/vendor/github.com/prometheus/procfs/NOTICE
+++ /dev/null
@@ -1,7 +0,0 @@
-procfs provides functions to retrieve system, kernel and process
-metrics from the pseudo-filesystem proc.
-
-Copyright 2014-2015 The Prometheus Authors
-
-This product includes software developed at
-SoundCloud Ltd. (http://soundcloud.com/).
diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md
deleted file mode 100644
index 1224816..0000000
--- a/vendor/github.com/prometheus/procfs/README.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# procfs
-
-This package provides functions to retrieve system, kernel, and process
-metrics from the pseudo-filesystems /proc and /sys.
-
-*WARNING*: This package is a work in progress. Its API may still break in
-backwards-incompatible ways without warnings. Use it at your own risk.
-
-[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/procfs.svg)](https://pkg.go.dev/github.com/prometheus/procfs)
-[![CircleCI](https://circleci.com/gh/prometheus/procfs/tree/master.svg?style=svg)](https://circleci.com/gh/prometheus/procfs/tree/master)
-[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs)
-
-## Usage
-
-The procfs library is organized by packages based on whether the gathered data is coming from
-/proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc,
-/sys, or both. For example, cpu statistics are gathered from
-`/proc/stat` and are available via the root procfs package. First, the proc filesystem mount
-point is initialized, and then the stat information is read.
-
-```go
-fs, err := procfs.NewFS("/proc")
-stats, err := fs.Stat()
-```
-
-Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems.
-
-```go
- fs, err := blockdevice.NewFS("/proc", "/sys")
- stats, err := fs.ProcDiskstats()
-```
-
-## Package Organization
-
-The packages in this project are organized according to (1) whether the data comes from the `/proc` or
-`/sys` filesystem and (2) the type of information being retrieved. For example, most process information
-can be gathered from the functions in the root `procfs` package. Information about block devices such as disk drives
-is available in the `blockdevices` sub-package.
-
-## Building and Testing
-
-The procfs library is intended to be built as part of another application, so there are no distributable binaries.
-However, most of the API includes unit tests which can be run with `make test`.
-
-### Updating Test Fixtures
-
-The procfs library includes a set of test fixtures which include many example files from
-the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file
-which is extracted automatically during testing. To add/update the test fixtures, first
-ensure the `fixtures` directory is up to date by removing the existing directory and then
-extracting the ttar file using `make fixtures/.unpacked` or just `make test`.
-
-```bash
-rm -rf testdata/fixtures
-make test
-```
-
-Next, make the required changes to the extracted files in the `fixtures` directory. When
-the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file
-based on the updated `fixtures` directory. And finally, verify the changes using
-`git diff testdata/fixtures.ttar`.
diff --git a/vendor/github.com/prometheus/procfs/SECURITY.md b/vendor/github.com/prometheus/procfs/SECURITY.md
deleted file mode 100644
index fed02d8..0000000
--- a/vendor/github.com/prometheus/procfs/SECURITY.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Reporting a security issue
-
-The Prometheus security policy, including how to report vulnerabilities, can be
-found here:
-
-
diff --git a/vendor/github.com/prometheus/procfs/arp.go b/vendor/github.com/prometheus/procfs/arp.go
deleted file mode 100644
index 28783e2..0000000
--- a/vendor/github.com/prometheus/procfs/arp.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "net"
- "os"
- "strconv"
- "strings"
-)
-
-// Learned from include/uapi/linux/if_arp.h.
-const (
- // completed entry (ha valid).
- ATFComplete = 0x02
- // permanent entry.
- ATFPermanent = 0x04
- // Publish entry.
- ATFPublish = 0x08
- // Has requested trailers.
- ATFUseTrailers = 0x10
- // Obsoleted: Want to use a netmask (only for proxy entries).
- ATFNetmask = 0x20
- // Don't answer this addresses.
- ATFDontPublish = 0x40
-)
-
-// ARPEntry contains a single row of the columnar data represented in
-// /proc/net/arp.
-type ARPEntry struct {
- // IP address
- IPAddr net.IP
- // MAC address
- HWAddr net.HardwareAddr
- // Name of the device
- Device string
- // Flags
- Flags byte
-}
-
-// GatherARPEntries retrieves all the ARP entries, parse the relevant columns,
-// and then return a slice of ARPEntry's.
-func (fs FS) GatherARPEntries() ([]ARPEntry, error) {
- data, err := os.ReadFile(fs.proc.Path("net/arp"))
- if err != nil {
- return nil, fmt.Errorf("%s: error reading arp %s: %w", ErrFileRead, fs.proc.Path("net/arp"), err)
- }
-
- return parseARPEntries(data)
-}
-
-func parseARPEntries(data []byte) ([]ARPEntry, error) {
- lines := strings.Split(string(data), "\n")
- entries := make([]ARPEntry, 0)
- var err error
- const (
- expectedDataWidth = 6
- expectedHeaderWidth = 9
- )
- for _, line := range lines {
- columns := strings.Fields(line)
- width := len(columns)
-
- if width == expectedHeaderWidth || width == 0 {
- continue
- } else if width == expectedDataWidth {
- entry, err := parseARPEntry(columns)
- if err != nil {
- return []ARPEntry{}, fmt.Errorf("%s: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err)
- }
- entries = append(entries, entry)
- } else {
- return []ARPEntry{}, fmt.Errorf("%s: %d columns found, but expected %d: %w", ErrFileParse, width, expectedDataWidth, err)
- }
-
- }
-
- return entries, err
-}
-
-func parseARPEntry(columns []string) (ARPEntry, error) {
- entry := ARPEntry{Device: columns[5]}
- ip := net.ParseIP(columns[0])
- entry.IPAddr = ip
-
- if mac, err := net.ParseMAC(columns[3]); err == nil {
- entry.HWAddr = mac
- } else {
- return ARPEntry{}, err
- }
-
- if flags, err := strconv.ParseUint(columns[2], 0, 8); err == nil {
- entry.Flags = byte(flags)
- } else {
- return ARPEntry{}, err
- }
-
- return entry, nil
-}
-
-// IsComplete returns true if ARP entry is marked with complete flag.
-func (entry *ARPEntry) IsComplete() bool {
- return entry.Flags&ATFComplete != 0
-}
diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go
deleted file mode 100644
index 4a17363..0000000
--- a/vendor/github.com/prometheus/procfs/buddyinfo.go
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2017 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
-)
-
-// A BuddyInfo is the details parsed from /proc/buddyinfo.
-// The data is comprised of an array of free fragments of each size.
-// The sizes are 2^n*PAGE_SIZE, where n is the array index.
-type BuddyInfo struct {
- Node string
- Zone string
- Sizes []float64
-}
-
-// BuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem.
-func (fs FS) BuddyInfo() ([]BuddyInfo, error) {
- file, err := os.Open(fs.proc.Path("buddyinfo"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- return parseBuddyInfo(file)
-}
-
-func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) {
- var (
- buddyInfo = []BuddyInfo{}
- scanner = bufio.NewScanner(r)
- bucketCount = -1
- )
-
- for scanner.Scan() {
- var err error
- line := scanner.Text()
- parts := strings.Fields(line)
-
- if len(parts) < 4 {
- return nil, fmt.Errorf("%w: Invalid number of fields, found: %v", ErrFileParse, parts)
- }
-
- node := strings.TrimRight(parts[1], ",")
- zone := strings.TrimRight(parts[3], ",")
- arraySize := len(parts[4:])
-
- if bucketCount == -1 {
- bucketCount = arraySize
- } else {
- if bucketCount != arraySize {
- return nil, fmt.Errorf("%w: mismatch in number of buddyinfo buckets, previous count %d, new count %d", ErrFileParse, bucketCount, arraySize)
- }
- }
-
- sizes := make([]float64, arraySize)
- for i := 0; i < arraySize; i++ {
- sizes[i], err = strconv.ParseFloat(parts[i+4], 64)
- if err != nil {
- return nil, fmt.Errorf("%s: Invalid valid in buddyinfo: %f: %w", ErrFileParse, sizes[i], err)
- }
- }
-
- buddyInfo = append(buddyInfo, BuddyInfo{node, zone, sizes})
- }
-
- return buddyInfo, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/cmdline.go b/vendor/github.com/prometheus/procfs/cmdline.go
deleted file mode 100644
index bf4f3b4..0000000
--- a/vendor/github.com/prometheus/procfs/cmdline.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CmdLine returns the command line of the kernel.
-func (fs FS) CmdLine() ([]string, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("cmdline"))
- if err != nil {
- return nil, err
- }
-
- return strings.Fields(string(data)), nil
-}
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
deleted file mode 100644
index f4f5501..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
+++ /dev/null
@@ -1,519 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux
-// +build linux
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CPUInfo contains general information about a system CPU found in /proc/cpuinfo.
-type CPUInfo struct {
- Processor uint
- VendorID string
- CPUFamily string
- Model string
- ModelName string
- Stepping string
- Microcode string
- CPUMHz float64
- CacheSize string
- PhysicalID string
- Siblings uint
- CoreID string
- CPUCores uint
- APICID string
- InitialAPICID string
- FPU string
- FPUException string
- CPUIDLevel uint
- WP string
- Flags []string
- Bugs []string
- BogoMips float64
- CLFlushSize uint
- CacheAlignment uint
- AddressSizes string
- PowerManagement string
-}
-
-var (
- cpuinfoClockRegexp = regexp.MustCompile(`([\d.]+)`)
- cpuinfoS390XProcessorRegexp = regexp.MustCompile(`^processor\s+(\d+):.*`)
-)
-
-// CPUInfo returns information about current system CPUs.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) CPUInfo() ([]CPUInfo, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("cpuinfo"))
- if err != nil {
- return nil, err
- }
- return parseCPUInfo(data)
-}
-
-func parseCPUInfoX86(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- // find the first "processor" line
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%w: Cannot parse line: %q", ErrFileParse, firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- firstcpu := CPUInfo{Processor: uint(v)}
- cpuinfo := []CPUInfo{firstcpu}
- i := 0
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- i++
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Processor = uint(v)
- case "vendor", "vendor_id":
- cpuinfo[i].VendorID = field[1]
- case "cpu family":
- cpuinfo[i].CPUFamily = field[1]
- case "model":
- cpuinfo[i].Model = field[1]
- case "model name":
- cpuinfo[i].ModelName = field[1]
- case "stepping":
- cpuinfo[i].Stepping = field[1]
- case "microcode":
- cpuinfo[i].Microcode = field[1]
- case "cpu MHz":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUMHz = v
- case "cache size":
- cpuinfo[i].CacheSize = field[1]
- case "physical id":
- cpuinfo[i].PhysicalID = field[1]
- case "siblings":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Siblings = uint(v)
- case "core id":
- cpuinfo[i].CoreID = field[1]
- case "cpu cores":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUCores = uint(v)
- case "apicid":
- cpuinfo[i].APICID = field[1]
- case "initial apicid":
- cpuinfo[i].InitialAPICID = field[1]
- case "fpu":
- cpuinfo[i].FPU = field[1]
- case "fpu_exception":
- cpuinfo[i].FPUException = field[1]
- case "cpuid level":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUIDLevel = uint(v)
- case "wp":
- cpuinfo[i].WP = field[1]
- case "flags":
- cpuinfo[i].Flags = strings.Fields(field[1])
- case "bugs":
- cpuinfo[i].Bugs = strings.Fields(field[1])
- case "bogomips":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].BogoMips = v
- case "clflush size":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CLFlushSize = uint(v)
- case "cache_alignment":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CacheAlignment = uint(v)
- case "address sizes":
- cpuinfo[i].AddressSizes = field[1]
- case "power management":
- cpuinfo[i].PowerManagement = field[1]
- }
- }
- return cpuinfo, nil
-}
-
-func parseCPUInfoARM(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- firstLine := firstNonEmptyLine(scanner)
- match, err := regexp.MatchString("^[Pp]rocessor", firstLine)
- if !match || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%s: Cannot parse line: %q: %w", ErrFileParse, firstLine, err)
-
- }
- field := strings.SplitN(firstLine, ": ", 2)
- cpuinfo := []CPUInfo{}
- featuresLine := ""
- commonCPUInfo := CPUInfo{}
- i := 0
- if strings.TrimSpace(field[0]) == "Processor" {
- commonCPUInfo = CPUInfo{ModelName: field[1]}
- i = -1
- } else {
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- firstcpu := CPUInfo{Processor: uint(v)}
- cpuinfo = []CPUInfo{firstcpu}
- }
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- cpuinfo = append(cpuinfo, commonCPUInfo) // start of the next processor
- i++
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Processor = uint(v)
- case "BogoMIPS":
- if i == -1 {
- cpuinfo = append(cpuinfo, commonCPUInfo) // There is only one processor
- i++
- cpuinfo[i].Processor = 0
- }
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].BogoMips = v
- case "Features":
- featuresLine = line
- case "model name":
- cpuinfo[i].ModelName = field[1]
- }
- }
- fields := strings.SplitN(featuresLine, ": ", 2)
- for i := range cpuinfo {
- cpuinfo[i].Flags = strings.Fields(fields[1])
- }
- return cpuinfo, nil
-
-}
-
-func parseCPUInfoS390X(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "vendor_id") || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%w: Cannot parse line: %q", ErrFileParse, firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- cpuinfo := []CPUInfo{}
- commonCPUInfo := CPUInfo{VendorID: field[1]}
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "bogomips per cpu":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- commonCPUInfo.BogoMips = v
- case "features":
- commonCPUInfo.Flags = strings.Fields(field[1])
- }
- if strings.HasPrefix(line, "processor") {
- match := cpuinfoS390XProcessorRegexp.FindStringSubmatch(line)
- if len(match) < 2 {
- return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine)
- }
- cpu := commonCPUInfo
- v, err := strconv.ParseUint(match[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpu.Processor = uint(v)
- cpuinfo = append(cpuinfo, cpu)
- }
- if strings.HasPrefix(line, "cpu number") {
- break
- }
- }
-
- i := 0
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "cpu number":
- i++
- case "cpu MHz dynamic":
- clock := cpuinfoClockRegexp.FindString(strings.TrimSpace(field[1]))
- v, err := strconv.ParseFloat(clock, 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUMHz = v
- case "physical id":
- cpuinfo[i].PhysicalID = field[1]
- case "core id":
- cpuinfo[i].CoreID = field[1]
- case "cpu cores":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUCores = uint(v)
- case "siblings":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Siblings = uint(v)
- }
- }
-
- return cpuinfo, nil
-}
-
-func parseCPUInfoMips(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- // find the first "processor" line
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- cpuinfo := []CPUInfo{}
- systemType := field[1]
-
- i := 0
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- i = int(v)
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- cpuinfo[i].Processor = uint(v)
- cpuinfo[i].VendorID = systemType
- case "cpu model":
- cpuinfo[i].ModelName = field[1]
- case "BogoMIPS":
- v, err := strconv.ParseFloat(field[1], 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].BogoMips = v
- }
- }
- return cpuinfo, nil
-}
-
-func parseCPUInfoLoong(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
- // find the first "processor" line
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "system type") || !strings.Contains(firstLine, ":") {
- return nil, errors.New("invalid cpuinfo file: " + firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- cpuinfo := []CPUInfo{}
- systemType := field[1]
- i := 0
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- i = int(v)
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- cpuinfo[i].Processor = uint(v)
- cpuinfo[i].VendorID = systemType
- case "CPU Family":
- cpuinfo[i].CPUFamily = field[1]
- case "Model Name":
- cpuinfo[i].ModelName = field[1]
- }
- }
- return cpuinfo, nil
-}
-
-func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- firstcpu := CPUInfo{Processor: uint(v)}
- cpuinfo := []CPUInfo{firstcpu}
- i := 0
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- i++
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].Processor = uint(v)
- case "cpu":
- cpuinfo[i].VendorID = field[1]
- case "clock":
- clock := cpuinfoClockRegexp.FindString(strings.TrimSpace(field[1]))
- v, err := strconv.ParseFloat(clock, 64)
- if err != nil {
- return nil, err
- }
- cpuinfo[i].CPUMHz = v
- }
- }
- return cpuinfo, nil
-}
-
-func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) {
- scanner := bufio.NewScanner(bytes.NewReader(info))
-
- firstLine := firstNonEmptyLine(scanner)
- if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
- return nil, fmt.Errorf("%w: %q", ErrFileParse, firstLine)
- }
- field := strings.SplitN(firstLine, ": ", 2)
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- firstcpu := CPUInfo{Processor: uint(v)}
- cpuinfo := []CPUInfo{firstcpu}
- i := 0
-
- for scanner.Scan() {
- line := scanner.Text()
- if !strings.Contains(line, ":") {
- continue
- }
- field := strings.SplitN(line, ": ", 2)
- switch strings.TrimSpace(field[0]) {
- case "processor":
- v, err := strconv.ParseUint(field[1], 0, 32)
- if err != nil {
- return nil, err
- }
- i = int(v)
- cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
- cpuinfo[i].Processor = uint(v)
- case "hart":
- cpuinfo[i].CoreID = field[1]
- case "isa":
- cpuinfo[i].ModelName = field[1]
- }
- }
- return cpuinfo, nil
-}
-
-func parseCPUInfoDummy(_ []byte) ([]CPUInfo, error) { // nolint:unused,deadcode
- return nil, errors.New("not implemented")
-}
-
-// firstNonEmptyLine advances the scanner to the first non-empty line
-// and returns the contents of that line.
-func firstNonEmptyLine(scanner *bufio.Scanner) string {
- for scanner.Scan() {
- line := scanner.Text()
- if strings.TrimSpace(line) != "" {
- return line
- }
- }
- return ""
-}
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go b/vendor/github.com/prometheus/procfs/cpuinfo_armx.go
deleted file mode 100644
index 64cfd53..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && (arm || arm64)
-// +build linux
-// +build arm arm64
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoARM
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
deleted file mode 100644
index d88442f..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux
-// +build linux
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoLoong
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go b/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go
deleted file mode 100644
index c11207f..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && (mips || mipsle || mips64 || mips64le)
-// +build linux
-// +build mips mipsle mips64 mips64le
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoMips
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_others.go b/vendor/github.com/prometheus/procfs/cpuinfo_others.go
deleted file mode 100644
index a6b2b31..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_others.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && !386 && !amd64 && !arm && !arm64 && !loong64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x
-// +build linux,!386,!amd64,!arm,!arm64,!loong64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoDummy
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go b/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go
deleted file mode 100644
index 003bc2a..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && (ppc64 || ppc64le)
-// +build linux
-// +build ppc64 ppc64le
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoPPC
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
deleted file mode 100644
index 1c9b731..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && (riscv || riscv64)
-// +build linux
-// +build riscv riscv64
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoRISCV
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go b/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go
deleted file mode 100644
index fa3686b..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux
-// +build linux
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoS390X
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go b/vendor/github.com/prometheus/procfs/cpuinfo_x86.go
deleted file mode 100644
index a0ef555..0000000
--- a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build linux && (386 || amd64)
-// +build linux
-// +build 386 amd64
-
-package procfs
-
-var parseCPUInfo = parseCPUInfoX86
diff --git a/vendor/github.com/prometheus/procfs/crypto.go b/vendor/github.com/prometheus/procfs/crypto.go
deleted file mode 100644
index 9a73e26..0000000
--- a/vendor/github.com/prometheus/procfs/crypto.go
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Crypto holds info parsed from /proc/crypto.
-type Crypto struct {
- Alignmask *uint64
- Async bool
- Blocksize *uint64
- Chunksize *uint64
- Ctxsize *uint64
- Digestsize *uint64
- Driver string
- Geniv string
- Internal string
- Ivsize *uint64
- Maxauthsize *uint64
- MaxKeysize *uint64
- MinKeysize *uint64
- Module string
- Name string
- Priority *int64
- Refcnt *int64
- Seedsize *uint64
- Selftest string
- Type string
- Walksize *uint64
-}
-
-// Crypto parses an crypto-file (/proc/crypto) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://kernel.readthedocs.io/en/sphinx-samples/crypto-API.html
-func (fs FS) Crypto() ([]Crypto, error) {
- path := fs.proc.Path("crypto")
- b, err := util.ReadFileNoStat(path)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot read file %v: %w", ErrFileRead, b, err)
-
- }
-
- crypto, err := parseCrypto(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, crypto, err)
- }
-
- return crypto, nil
-}
-
-// parseCrypto parses a /proc/crypto stream into Crypto elements.
-func parseCrypto(r io.Reader) ([]Crypto, error) {
- var out []Crypto
-
- s := bufio.NewScanner(r)
- for s.Scan() {
- text := s.Text()
- switch {
- case strings.HasPrefix(text, "name"):
- // Each crypto element begins with its name.
- out = append(out, Crypto{})
- case text == "":
- continue
- }
-
- kv := strings.Split(text, ":")
- if len(kv) != 2 {
- return nil, fmt.Errorf("%w: Cannot parae line: %q", ErrFileParse, text)
- }
-
- k := strings.TrimSpace(kv[0])
- v := strings.TrimSpace(kv[1])
-
- // Parse the key/value pair into the currently focused element.
- c := &out[len(out)-1]
- if err := c.parseKV(k, v); err != nil {
- return nil, err
- }
- }
-
- if err := s.Err(); err != nil {
- return nil, err
- }
-
- return out, nil
-}
-
-// parseKV parses a key/value pair into the appropriate field of c.
-func (c *Crypto) parseKV(k, v string) error {
- vp := util.NewValueParser(v)
-
- switch k {
- case "async":
- // Interpret literal yes as true.
- c.Async = v == "yes"
- case "blocksize":
- c.Blocksize = vp.PUInt64()
- case "chunksize":
- c.Chunksize = vp.PUInt64()
- case "digestsize":
- c.Digestsize = vp.PUInt64()
- case "driver":
- c.Driver = v
- case "geniv":
- c.Geniv = v
- case "internal":
- c.Internal = v
- case "ivsize":
- c.Ivsize = vp.PUInt64()
- case "maxauthsize":
- c.Maxauthsize = vp.PUInt64()
- case "max keysize":
- c.MaxKeysize = vp.PUInt64()
- case "min keysize":
- c.MinKeysize = vp.PUInt64()
- case "module":
- c.Module = v
- case "name":
- c.Name = v
- case "priority":
- c.Priority = vp.PInt64()
- case "refcnt":
- c.Refcnt = vp.PInt64()
- case "seedsize":
- c.Seedsize = vp.PUInt64()
- case "selftest":
- c.Selftest = v
- case "type":
- c.Type = v
- case "walksize":
- c.Walksize = vp.PUInt64()
- }
-
- return vp.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/doc.go b/vendor/github.com/prometheus/procfs/doc.go
deleted file mode 100644
index f9d961e..0000000
--- a/vendor/github.com/prometheus/procfs/doc.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package procfs provides functions to retrieve system, kernel and process
-// metrics from the pseudo-filesystem proc.
-//
-// Example:
-//
-// package main
-//
-// import (
-// "fmt"
-// "log"
-//
-// "github.com/prometheus/procfs"
-// )
-//
-// func main() {
-// p, err := procfs.Self()
-// if err != nil {
-// log.Fatalf("could not get process: %s", err)
-// }
-//
-// stat, err := p.Stat()
-// if err != nil {
-// log.Fatalf("could not get process stat: %s", err)
-// }
-//
-// fmt.Printf("command: %s\n", stat.Comm)
-// fmt.Printf("cpu time: %fs\n", stat.CPUTime())
-// fmt.Printf("vsize: %dB\n", stat.VirtualMemory())
-// fmt.Printf("rss: %dB\n", stat.ResidentMemory())
-// }
-package procfs
diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go
deleted file mode 100644
index 4980c87..0000000
--- a/vendor/github.com/prometheus/procfs/fs.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "github.com/prometheus/procfs/internal/fs"
-)
-
-// FS represents the pseudo-filesystem sys, which provides an interface to
-// kernel data structures.
-type FS struct {
- proc fs.FS
- isReal bool
-}
-
-// DefaultMountPoint is the common mount point of the proc filesystem.
-const DefaultMountPoint = fs.DefaultProcMountPoint
-
-// NewDefaultFS returns a new proc FS mounted under the default proc mountPoint.
-// It will error if the mount point directory can't be read or is a file.
-func NewDefaultFS() (FS, error) {
- return NewFS(DefaultMountPoint)
-}
-
-// NewFS returns a new proc FS mounted under the given proc mountPoint. It will error
-// if the mount point directory can't be read or is a file.
-func NewFS(mountPoint string) (FS, error) {
- fs, err := fs.NewFS(mountPoint)
- if err != nil {
- return FS{}, err
- }
-
- isReal, err := isRealProc(mountPoint)
- if err != nil {
- return FS{}, err
- }
-
- return FS{fs, isReal}, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go b/vendor/github.com/prometheus/procfs/fs_statfs_notype.go
deleted file mode 100644
index 134767d..0000000
--- a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !freebsd && !linux
-// +build !freebsd,!linux
-
-package procfs
-
-// isRealProc returns true on architectures that don't have a Type argument
-// in their Statfs_t struct
-func isRealProc(mountPoint string) (bool, error) {
- return true, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_type.go b/vendor/github.com/prometheus/procfs/fs_statfs_type.go
deleted file mode 100644
index 80df79c..0000000
--- a/vendor/github.com/prometheus/procfs/fs_statfs_type.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build freebsd || linux
-// +build freebsd linux
-
-package procfs
-
-import (
- "syscall"
-)
-
-// isRealProc determines whether supplied mountpoint is really a proc filesystem.
-func isRealProc(mountPoint string) (bool, error) {
- stat := syscall.Statfs_t{}
- err := syscall.Statfs(mountPoint, &stat)
- if err != nil {
- return false, err
- }
-
- // 0x9fa0 is PROC_SUPER_MAGIC: https://elixir.bootlin.com/linux/v6.1/source/include/uapi/linux/magic.h#L87
- return stat.Type == 0x9fa0, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/fscache.go b/vendor/github.com/prometheus/procfs/fscache.go
deleted file mode 100644
index f560a8d..0000000
--- a/vendor/github.com/prometheus/procfs/fscache.go
+++ /dev/null
@@ -1,422 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Fscacheinfo represents fscache statistics.
-type Fscacheinfo struct {
- // Number of index cookies allocated
- IndexCookiesAllocated uint64
- // data storage cookies allocated
- DataStorageCookiesAllocated uint64
- // Number of special cookies allocated
- SpecialCookiesAllocated uint64
- // Number of objects allocated
- ObjectsAllocated uint64
- // Number of object allocation failures
- ObjectAllocationsFailure uint64
- // Number of objects that reached the available state
- ObjectsAvailable uint64
- // Number of objects that reached the dead state
- ObjectsDead uint64
- // Number of objects that didn't have a coherency check
- ObjectsWithoutCoherencyCheck uint64
- // Number of objects that passed a coherency check
- ObjectsWithCoherencyCheck uint64
- // Number of objects that needed a coherency data update
- ObjectsNeedCoherencyCheckUpdate uint64
- // Number of objects that were declared obsolete
- ObjectsDeclaredObsolete uint64
- // Number of pages marked as being cached
- PagesMarkedAsBeingCached uint64
- // Number of uncache page requests seen
- UncachePagesRequestSeen uint64
- // Number of acquire cookie requests seen
- AcquireCookiesRequestSeen uint64
- // Number of acq reqs given a NULL parent
- AcquireRequestsWithNullParent uint64
- // Number of acq reqs rejected due to no cache available
- AcquireRequestsRejectedNoCacheAvailable uint64
- // Number of acq reqs succeeded
- AcquireRequestsSucceeded uint64
- // Number of acq reqs rejected due to error
- AcquireRequestsRejectedDueToError uint64
- // Number of acq reqs failed on ENOMEM
- AcquireRequestsFailedDueToEnomem uint64
- // Number of lookup calls made on cache backends
- LookupsNumber uint64
- // Number of negative lookups made
- LookupsNegative uint64
- // Number of positive lookups made
- LookupsPositive uint64
- // Number of objects created by lookup
- ObjectsCreatedByLookup uint64
- // Number of lookups timed out and requeued
- LookupsTimedOutAndRequed uint64
- InvalidationsNumber uint64
- InvalidationsRunning uint64
- // Number of update cookie requests seen
- UpdateCookieRequestSeen uint64
- // Number of upd reqs given a NULL parent
- UpdateRequestsWithNullParent uint64
- // Number of upd reqs granted CPU time
- UpdateRequestsRunning uint64
- // Number of relinquish cookie requests seen
- RelinquishCookiesRequestSeen uint64
- // Number of rlq reqs given a NULL parent
- RelinquishCookiesWithNullParent uint64
- // Number of rlq reqs waited on completion of creation
- RelinquishRequestsWaitingCompleteCreation uint64
- // Relinqs rtr
- RelinquishRetries uint64
- // Number of attribute changed requests seen
- AttributeChangedRequestsSeen uint64
- // Number of attr changed requests queued
- AttributeChangedRequestsQueued uint64
- // Number of attr changed rejected -ENOBUFS
- AttributeChangedRejectDueToEnobufs uint64
- // Number of attr changed failed -ENOMEM
- AttributeChangedFailedDueToEnomem uint64
- // Number of attr changed ops given CPU time
- AttributeChangedOps uint64
- // Number of allocation requests seen
- AllocationRequestsSeen uint64
- // Number of successful alloc reqs
- AllocationOkRequests uint64
- // Number of alloc reqs that waited on lookup completion
- AllocationWaitingOnLookup uint64
- // Number of alloc reqs rejected -ENOBUFS
- AllocationsRejectedDueToEnobufs uint64
- // Number of alloc reqs aborted -ERESTARTSYS
- AllocationsAbortedDueToErestartsys uint64
- // Number of alloc reqs submitted
- AllocationOperationsSubmitted uint64
- // Number of alloc reqs waited for CPU time
- AllocationsWaitedForCPU uint64
- // Number of alloc reqs aborted due to object death
- AllocationsAbortedDueToObjectDeath uint64
- // Number of retrieval (read) requests seen
- RetrievalsReadRequests uint64
- // Number of successful retr reqs
- RetrievalsOk uint64
- // Number of retr reqs that waited on lookup completion
- RetrievalsWaitingLookupCompletion uint64
- // Number of retr reqs returned -ENODATA
- RetrievalsReturnedEnodata uint64
- // Number of retr reqs rejected -ENOBUFS
- RetrievalsRejectedDueToEnobufs uint64
- // Number of retr reqs aborted -ERESTARTSYS
- RetrievalsAbortedDueToErestartsys uint64
- // Number of retr reqs failed -ENOMEM
- RetrievalsFailedDueToEnomem uint64
- // Number of retr reqs submitted
- RetrievalsRequests uint64
- // Number of retr reqs waited for CPU time
- RetrievalsWaitingCPU uint64
- // Number of retr reqs aborted due to object death
- RetrievalsAbortedDueToObjectDeath uint64
- // Number of storage (write) requests seen
- StoreWriteRequests uint64
- // Number of successful store reqs
- StoreSuccessfulRequests uint64
- // Number of store reqs on a page already pending storage
- StoreRequestsOnPendingStorage uint64
- // Number of store reqs rejected -ENOBUFS
- StoreRequestsRejectedDueToEnobufs uint64
- // Number of store reqs failed -ENOMEM
- StoreRequestsFailedDueToEnomem uint64
- // Number of store reqs submitted
- StoreRequestsSubmitted uint64
- // Number of store reqs granted CPU time
- StoreRequestsRunning uint64
- // Number of pages given store req processing time
- StorePagesWithRequestsProcessing uint64
- // Number of store reqs deleted from tracking tree
- StoreRequestsDeleted uint64
- // Number of store reqs over store limit
- StoreRequestsOverStoreLimit uint64
- // Number of release reqs against pages with no pending store
- ReleaseRequestsAgainstPagesWithNoPendingStorage uint64
- // Number of release reqs against pages stored by time lock granted
- ReleaseRequestsAgainstPagesStoredByTimeLockGranted uint64
- // Number of release reqs ignored due to in-progress store
- ReleaseRequestsIgnoredDueToInProgressStore uint64
- // Number of page stores cancelled due to release req
- PageStoresCancelledByReleaseRequests uint64
- VmscanWaiting uint64
- // Number of times async ops added to pending queues
- OpsPending uint64
- // Number of times async ops given CPU time
- OpsRunning uint64
- // Number of times async ops queued for processing
- OpsEnqueued uint64
- // Number of async ops cancelled
- OpsCancelled uint64
- // Number of async ops rejected due to object lookup/create failure
- OpsRejected uint64
- // Number of async ops initialised
- OpsInitialised uint64
- // Number of async ops queued for deferred release
- OpsDeferred uint64
- // Number of async ops released (should equal ini=N when idle)
- OpsReleased uint64
- // Number of deferred-release async ops garbage collected
- OpsGarbageCollected uint64
- // Number of in-progress alloc_object() cache ops
- CacheopAllocationsinProgress uint64
- // Number of in-progress lookup_object() cache ops
- CacheopLookupObjectInProgress uint64
- // Number of in-progress lookup_complete() cache ops
- CacheopLookupCompleteInPorgress uint64
- // Number of in-progress grab_object() cache ops
- CacheopGrabObjectInProgress uint64
- CacheopInvalidations uint64
- // Number of in-progress update_object() cache ops
- CacheopUpdateObjectInProgress uint64
- // Number of in-progress drop_object() cache ops
- CacheopDropObjectInProgress uint64
- // Number of in-progress put_object() cache ops
- CacheopPutObjectInProgress uint64
- // Number of in-progress attr_changed() cache ops
- CacheopAttributeChangeInProgress uint64
- // Number of in-progress sync_cache() cache ops
- CacheopSyncCacheInProgress uint64
- // Number of in-progress read_or_alloc_page() cache ops
- CacheopReadOrAllocPageInProgress uint64
- // Number of in-progress read_or_alloc_pages() cache ops
- CacheopReadOrAllocPagesInProgress uint64
- // Number of in-progress allocate_page() cache ops
- CacheopAllocatePageInProgress uint64
- // Number of in-progress allocate_pages() cache ops
- CacheopAllocatePagesInProgress uint64
- // Number of in-progress write_page() cache ops
- CacheopWritePagesInProgress uint64
- // Number of in-progress uncache_page() cache ops
- CacheopUncachePagesInProgress uint64
- // Number of in-progress dissociate_pages() cache ops
- CacheopDissociatePagesInProgress uint64
- // Number of object lookups/creations rejected due to lack of space
- CacheevLookupsAndCreationsRejectedLackSpace uint64
- // Number of stale objects deleted
- CacheevStaleObjectsDeleted uint64
- // Number of objects retired when relinquished
- CacheevRetiredWhenReliquished uint64
- // Number of objects culled
- CacheevObjectsCulled uint64
-}
-
-// Fscacheinfo returns information about current fscache statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/caching/fscache.txt
-func (fs FS) Fscacheinfo() (Fscacheinfo, error) {
- b, err := util.ReadFileNoStat(fs.proc.Path("fs/fscache/stats"))
- if err != nil {
- return Fscacheinfo{}, err
- }
-
- m, err := parseFscacheinfo(bytes.NewReader(b))
- if err != nil {
- return Fscacheinfo{}, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, m, err)
- }
-
- return *m, nil
-}
-
-func setFSCacheFields(fields []string, setFields ...*uint64) error {
- var err error
- if len(fields) < len(setFields) {
- return fmt.Errorf("%s: Expected %d, but got %d: %w", ErrFileParse, len(setFields), len(fields), err)
- }
-
- for i := range setFields {
- *setFields[i], err = strconv.ParseUint(strings.Split(fields[i], "=")[1], 0, 64)
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-func parseFscacheinfo(r io.Reader) (*Fscacheinfo, error) {
- var m Fscacheinfo
- s := bufio.NewScanner(r)
- for s.Scan() {
- fields := strings.Fields(s.Text())
- if len(fields) < 2 {
- return nil, fmt.Errorf("%w: malformed Fscacheinfo line: %q", ErrFileParse, s.Text())
- }
-
- switch fields[0] {
- case "Cookies:":
- err := setFSCacheFields(fields[1:], &m.IndexCookiesAllocated, &m.DataStorageCookiesAllocated,
- &m.SpecialCookiesAllocated)
- if err != nil {
- return &m, err
- }
- case "Objects:":
- err := setFSCacheFields(fields[1:], &m.ObjectsAllocated, &m.ObjectAllocationsFailure,
- &m.ObjectsAvailable, &m.ObjectsDead)
- if err != nil {
- return &m, err
- }
- case "ChkAux":
- err := setFSCacheFields(fields[2:], &m.ObjectsWithoutCoherencyCheck, &m.ObjectsWithCoherencyCheck,
- &m.ObjectsNeedCoherencyCheckUpdate, &m.ObjectsDeclaredObsolete)
- if err != nil {
- return &m, err
- }
- case "Pages":
- err := setFSCacheFields(fields[2:], &m.PagesMarkedAsBeingCached, &m.UncachePagesRequestSeen)
- if err != nil {
- return &m, err
- }
- case "Acquire:":
- err := setFSCacheFields(fields[1:], &m.AcquireCookiesRequestSeen, &m.AcquireRequestsWithNullParent,
- &m.AcquireRequestsRejectedNoCacheAvailable, &m.AcquireRequestsSucceeded, &m.AcquireRequestsRejectedDueToError,
- &m.AcquireRequestsFailedDueToEnomem)
- if err != nil {
- return &m, err
- }
- case "Lookups:":
- err := setFSCacheFields(fields[1:], &m.LookupsNumber, &m.LookupsNegative, &m.LookupsPositive,
- &m.ObjectsCreatedByLookup, &m.LookupsTimedOutAndRequed)
- if err != nil {
- return &m, err
- }
- case "Invals":
- err := setFSCacheFields(fields[2:], &m.InvalidationsNumber, &m.InvalidationsRunning)
- if err != nil {
- return &m, err
- }
- case "Updates:":
- err := setFSCacheFields(fields[1:], &m.UpdateCookieRequestSeen, &m.UpdateRequestsWithNullParent,
- &m.UpdateRequestsRunning)
- if err != nil {
- return &m, err
- }
- case "Relinqs:":
- err := setFSCacheFields(fields[1:], &m.RelinquishCookiesRequestSeen, &m.RelinquishCookiesWithNullParent,
- &m.RelinquishRequestsWaitingCompleteCreation, &m.RelinquishRetries)
- if err != nil {
- return &m, err
- }
- case "AttrChg:":
- err := setFSCacheFields(fields[1:], &m.AttributeChangedRequestsSeen, &m.AttributeChangedRequestsQueued,
- &m.AttributeChangedRejectDueToEnobufs, &m.AttributeChangedFailedDueToEnomem, &m.AttributeChangedOps)
- if err != nil {
- return &m, err
- }
- case "Allocs":
- if strings.Split(fields[2], "=")[0] == "n" {
- err := setFSCacheFields(fields[2:], &m.AllocationRequestsSeen, &m.AllocationOkRequests,
- &m.AllocationWaitingOnLookup, &m.AllocationsRejectedDueToEnobufs, &m.AllocationsAbortedDueToErestartsys)
- if err != nil {
- return &m, err
- }
- } else {
- err := setFSCacheFields(fields[2:], &m.AllocationOperationsSubmitted, &m.AllocationsWaitedForCPU,
- &m.AllocationsAbortedDueToObjectDeath)
- if err != nil {
- return &m, err
- }
- }
- case "Retrvls:":
- if strings.Split(fields[1], "=")[0] == "n" {
- err := setFSCacheFields(fields[1:], &m.RetrievalsReadRequests, &m.RetrievalsOk, &m.RetrievalsWaitingLookupCompletion,
- &m.RetrievalsReturnedEnodata, &m.RetrievalsRejectedDueToEnobufs, &m.RetrievalsAbortedDueToErestartsys,
- &m.RetrievalsFailedDueToEnomem)
- if err != nil {
- return &m, err
- }
- } else {
- err := setFSCacheFields(fields[1:], &m.RetrievalsRequests, &m.RetrievalsWaitingCPU, &m.RetrievalsAbortedDueToObjectDeath)
- if err != nil {
- return &m, err
- }
- }
- case "Stores":
- if strings.Split(fields[2], "=")[0] == "n" {
- err := setFSCacheFields(fields[2:], &m.StoreWriteRequests, &m.StoreSuccessfulRequests,
- &m.StoreRequestsOnPendingStorage, &m.StoreRequestsRejectedDueToEnobufs, &m.StoreRequestsFailedDueToEnomem)
- if err != nil {
- return &m, err
- }
- } else {
- err := setFSCacheFields(fields[2:], &m.StoreRequestsSubmitted, &m.StoreRequestsRunning,
- &m.StorePagesWithRequestsProcessing, &m.StoreRequestsDeleted, &m.StoreRequestsOverStoreLimit)
- if err != nil {
- return &m, err
- }
- }
- case "VmScan":
- err := setFSCacheFields(fields[2:], &m.ReleaseRequestsAgainstPagesWithNoPendingStorage,
- &m.ReleaseRequestsAgainstPagesStoredByTimeLockGranted, &m.ReleaseRequestsIgnoredDueToInProgressStore,
- &m.PageStoresCancelledByReleaseRequests, &m.VmscanWaiting)
- if err != nil {
- return &m, err
- }
- case "Ops":
- if strings.Split(fields[2], "=")[0] == "pend" {
- err := setFSCacheFields(fields[2:], &m.OpsPending, &m.OpsRunning, &m.OpsEnqueued, &m.OpsCancelled, &m.OpsRejected)
- if err != nil {
- return &m, err
- }
- } else {
- err := setFSCacheFields(fields[2:], &m.OpsInitialised, &m.OpsDeferred, &m.OpsReleased, &m.OpsGarbageCollected)
- if err != nil {
- return &m, err
- }
- }
- case "CacheOp:":
- if strings.Split(fields[1], "=")[0] == "alo" {
- err := setFSCacheFields(fields[1:], &m.CacheopAllocationsinProgress, &m.CacheopLookupObjectInProgress,
- &m.CacheopLookupCompleteInPorgress, &m.CacheopGrabObjectInProgress)
- if err != nil {
- return &m, err
- }
- } else if strings.Split(fields[1], "=")[0] == "inv" {
- err := setFSCacheFields(fields[1:], &m.CacheopInvalidations, &m.CacheopUpdateObjectInProgress,
- &m.CacheopDropObjectInProgress, &m.CacheopPutObjectInProgress, &m.CacheopAttributeChangeInProgress,
- &m.CacheopSyncCacheInProgress)
- if err != nil {
- return &m, err
- }
- } else {
- err := setFSCacheFields(fields[1:], &m.CacheopReadOrAllocPageInProgress, &m.CacheopReadOrAllocPagesInProgress,
- &m.CacheopAllocatePageInProgress, &m.CacheopAllocatePagesInProgress, &m.CacheopWritePagesInProgress,
- &m.CacheopUncachePagesInProgress, &m.CacheopDissociatePagesInProgress)
- if err != nil {
- return &m, err
- }
- }
- case "CacheEv:":
- err := setFSCacheFields(fields[1:], &m.CacheevLookupsAndCreationsRejectedLackSpace, &m.CacheevStaleObjectsDeleted,
- &m.CacheevRetiredWhenReliquished, &m.CacheevObjectsCulled)
- if err != nil {
- return &m, err
- }
- }
- }
-
- return &m, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go
deleted file mode 100644
index 3c18c76..0000000
--- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package fs
-
-import (
- "fmt"
- "os"
- "path/filepath"
-)
-
-const (
- // DefaultProcMountPoint is the common mount point of the proc filesystem.
- DefaultProcMountPoint = "/proc"
-
- // DefaultSysMountPoint is the common mount point of the sys filesystem.
- DefaultSysMountPoint = "/sys"
-
- // DefaultConfigfsMountPoint is the common mount point of the configfs.
- DefaultConfigfsMountPoint = "/sys/kernel/config"
-)
-
-// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an
-// interface to kernel data structures.
-type FS string
-
-// NewFS returns a new FS mounted under the given mountPoint. It will error
-// if the mount point can't be read.
-func NewFS(mountPoint string) (FS, error) {
- info, err := os.Stat(mountPoint)
- if err != nil {
- return "", fmt.Errorf("could not read %q: %w", mountPoint, err)
- }
- if !info.IsDir() {
- return "", fmt.Errorf("mount point %q is not a directory", mountPoint)
- }
-
- return FS(mountPoint), nil
-}
-
-// Path appends the given path elements to the filesystem path, adding separators
-// as necessary.
-func (fs FS) Path(p ...string) string {
- return filepath.Join(append([]string{string(fs)}, p...)...)
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/parse.go b/vendor/github.com/prometheus/procfs/internal/util/parse.go
deleted file mode 100644
index 14272dc..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/parse.go
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "os"
- "strconv"
- "strings"
-)
-
-// ParseUint32s parses a slice of strings into a slice of uint32s.
-func ParseUint32s(ss []string) ([]uint32, error) {
- us := make([]uint32, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 10, 32)
- if err != nil {
- return nil, err
- }
-
- us = append(us, uint32(u))
- }
-
- return us, nil
-}
-
-// ParseUint64s parses a slice of strings into a slice of uint64s.
-func ParseUint64s(ss []string) ([]uint64, error) {
- us := make([]uint64, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- us = append(us, u)
- }
-
- return us, nil
-}
-
-// ParsePInt64s parses a slice of strings into a slice of int64 pointers.
-func ParsePInt64s(ss []string) ([]*int64, error) {
- us := make([]*int64, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- us = append(us, &u)
- }
-
- return us, nil
-}
-
-// Parses a uint64 from given hex in string.
-func ParseHexUint64s(ss []string) ([]*uint64, error) {
- us := make([]*uint64, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 16, 64)
- if err != nil {
- return nil, err
- }
-
- us = append(us, &u)
- }
-
- return us, nil
-}
-
-// ReadUintFromFile reads a file and attempts to parse a uint64 from it.
-func ReadUintFromFile(path string) (uint64, error) {
- data, err := os.ReadFile(path)
- if err != nil {
- return 0, err
- }
- return strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64)
-}
-
-// ReadIntFromFile reads a file and attempts to parse a int64 from it.
-func ReadIntFromFile(path string) (int64, error) {
- data, err := os.ReadFile(path)
- if err != nil {
- return 0, err
- }
- return strconv.ParseInt(strings.TrimSpace(string(data)), 10, 64)
-}
-
-// ParseBool parses a string into a boolean pointer.
-func ParseBool(b string) *bool {
- var truth bool
- switch b {
- case "enabled":
- truth = true
- case "disabled":
- truth = false
- default:
- return nil
- }
- return &truth
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/readfile.go b/vendor/github.com/prometheus/procfs/internal/util/readfile.go
deleted file mode 100644
index 71b7a70..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/readfile.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "io"
- "os"
-)
-
-// ReadFileNoStat uses io.ReadAll to read contents of entire file.
-// This is similar to os.ReadFile but without the call to os.Stat, because
-// many files in /proc and /sys report incorrect file sizes (either 0 or 4096).
-// Reads a max file size of 1024kB. For files larger than this, a scanner
-// should be used.
-func ReadFileNoStat(filename string) ([]byte, error) {
- const maxBufferSize = 1024 * 1024
-
- f, err := os.Open(filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- reader := io.LimitReader(f, maxBufferSize)
- return io.ReadAll(reader)
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
deleted file mode 100644
index 1ab875c..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build (linux || darwin) && !appengine
-// +build linux darwin
-// +build !appengine
-
-package util
-
-import (
- "bytes"
- "os"
- "syscall"
-)
-
-// SysReadFile is a simplified os.ReadFile that invokes syscall.Read directly.
-// https://github.com/prometheus/node_exporter/pull/728/files
-//
-// Note that this function will not read files larger than 128 bytes.
-func SysReadFile(file string) (string, error) {
- f, err := os.Open(file)
- if err != nil {
- return "", err
- }
- defer f.Close()
-
- // On some machines, hwmon drivers are broken and return EAGAIN. This causes
- // Go's os.ReadFile implementation to poll forever.
- //
- // Since we either want to read data or bail immediately, do the simplest
- // possible read using syscall directly.
- const sysFileBufferSize = 128
- b := make([]byte, sysFileBufferSize)
- n, err := syscall.Read(int(f.Fd()), b)
- if err != nil {
- return "", err
- }
-
- return string(bytes.TrimSpace(b[:n])), nil
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
deleted file mode 100644
index 1d86f5e..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build (linux && appengine) || (!linux && !darwin)
-// +build linux,appengine !linux,!darwin
-
-package util
-
-import (
- "fmt"
-)
-
-// SysReadFile is here implemented as a noop for builds that do not support
-// the read syscall. For example Windows, or Linux on Google App Engine.
-func SysReadFile(file string) (string, error) {
- return "", fmt.Errorf("not supported on this platform")
-}
diff --git a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
deleted file mode 100644
index fe2355d..0000000
--- a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
- "strconv"
-)
-
-// TODO(mdlayher): util packages are an anti-pattern and this should be moved
-// somewhere else that is more focused in the future.
-
-// A ValueParser enables parsing a single string into a variety of data types
-// in a concise and safe way. The Err method must be invoked after invoking
-// any other methods to ensure a value was successfully parsed.
-type ValueParser struct {
- v string
- err error
-}
-
-// NewValueParser creates a ValueParser using the input string.
-func NewValueParser(v string) *ValueParser {
- return &ValueParser{v: v}
-}
-
-// Int interprets the underlying value as an int and returns that value.
-func (vp *ValueParser) Int() int { return int(vp.int64()) }
-
-// PInt64 interprets the underlying value as an int64 and returns a pointer to
-// that value.
-func (vp *ValueParser) PInt64() *int64 {
- if vp.err != nil {
- return nil
- }
-
- v := vp.int64()
- return &v
-}
-
-// int64 interprets the underlying value as an int64 and returns that value.
-// TODO: export if/when necessary.
-func (vp *ValueParser) int64() int64 {
- if vp.err != nil {
- return 0
- }
-
- // A base value of zero makes ParseInt infer the correct base using the
- // string's prefix, if any.
- const base = 0
- v, err := strconv.ParseInt(vp.v, base, 64)
- if err != nil {
- vp.err = err
- return 0
- }
-
- return v
-}
-
-// PUInt64 interprets the underlying value as an uint64 and returns a pointer to
-// that value.
-func (vp *ValueParser) PUInt64() *uint64 {
- if vp.err != nil {
- return nil
- }
-
- // A base value of zero makes ParseInt infer the correct base using the
- // string's prefix, if any.
- const base = 0
- v, err := strconv.ParseUint(vp.v, base, 64)
- if err != nil {
- vp.err = err
- return nil
- }
-
- return &v
-}
-
-// Err returns the last error, if any, encountered by the ValueParser.
-func (vp *ValueParser) Err() error {
- return vp.err
-}
diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go
deleted file mode 100644
index 5a145bb..0000000
--- a/vendor/github.com/prometheus/procfs/ipvs.go
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "encoding/hex"
- "errors"
- "fmt"
- "io"
- "net"
- "os"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`.
-type IPVSStats struct {
- // Total count of connections.
- Connections uint64
- // Total incoming packages processed.
- IncomingPackets uint64
- // Total outgoing packages processed.
- OutgoingPackets uint64
- // Total incoming traffic.
- IncomingBytes uint64
- // Total outgoing traffic.
- OutgoingBytes uint64
-}
-
-// IPVSBackendStatus holds current metrics of one virtual / real address pair.
-type IPVSBackendStatus struct {
- // The local (virtual) IP address.
- LocalAddress net.IP
- // The remote (real) IP address.
- RemoteAddress net.IP
- // The local (virtual) port.
- LocalPort uint16
- // The remote (real) port.
- RemotePort uint16
- // The local firewall mark
- LocalMark string
- // The transport protocol (TCP, UDP).
- Proto string
- // The current number of active connections for this virtual/real address pair.
- ActiveConn uint64
- // The current number of inactive connections for this virtual/real address pair.
- InactConn uint64
- // The current weight of this virtual/real address pair.
- Weight uint64
-}
-
-// IPVSStats reads the IPVS statistics from the specified `proc` filesystem.
-func (fs FS) IPVSStats() (IPVSStats, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("net/ip_vs_stats"))
- if err != nil {
- return IPVSStats{}, err
- }
-
- return parseIPVSStats(bytes.NewReader(data))
-}
-
-// parseIPVSStats performs the actual parsing of `ip_vs_stats`.
-func parseIPVSStats(r io.Reader) (IPVSStats, error) {
- var (
- statContent []byte
- statLines []string
- statFields []string
- stats IPVSStats
- )
-
- statContent, err := io.ReadAll(r)
- if err != nil {
- return IPVSStats{}, err
- }
-
- statLines = strings.SplitN(string(statContent), "\n", 4)
- if len(statLines) != 4 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: too short")
- }
-
- statFields = strings.Fields(statLines[2])
- if len(statFields) != 5 {
- return IPVSStats{}, errors.New("ip_vs_stats corrupt: unexpected number of fields")
- }
-
- stats.Connections, err = strconv.ParseUint(statFields[0], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingPackets, err = strconv.ParseUint(statFields[1], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingPackets, err = strconv.ParseUint(statFields[2], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.IncomingBytes, err = strconv.ParseUint(statFields[3], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
- stats.OutgoingBytes, err = strconv.ParseUint(statFields[4], 16, 64)
- if err != nil {
- return IPVSStats{}, err
- }
-
- return stats, nil
-}
-
-// IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem.
-func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error) {
- file, err := os.Open(fs.proc.Path("net/ip_vs"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- return parseIPVSBackendStatus(file)
-}
-
-func parseIPVSBackendStatus(file io.Reader) ([]IPVSBackendStatus, error) {
- var (
- status []IPVSBackendStatus
- scanner = bufio.NewScanner(file)
- proto string
- localMark string
- localAddress net.IP
- localPort uint16
- err error
- )
-
- for scanner.Scan() {
- fields := strings.Fields(scanner.Text())
- if len(fields) == 0 {
- continue
- }
- switch {
- case fields[0] == "IP" || fields[0] == "Prot" || fields[1] == "RemoteAddress:Port":
- continue
- case fields[0] == "TCP" || fields[0] == "UDP":
- if len(fields) < 2 {
- continue
- }
- proto = fields[0]
- localMark = ""
- localAddress, localPort, err = parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- case fields[0] == "FWM":
- if len(fields) < 2 {
- continue
- }
- proto = fields[0]
- localMark = fields[1]
- localAddress = nil
- localPort = 0
- case fields[0] == "->":
- if len(fields) < 6 {
- continue
- }
- remoteAddress, remotePort, err := parseIPPort(fields[1])
- if err != nil {
- return nil, err
- }
- weight, err := strconv.ParseUint(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- activeConn, err := strconv.ParseUint(fields[4], 10, 64)
- if err != nil {
- return nil, err
- }
- inactConn, err := strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- status = append(status, IPVSBackendStatus{
- LocalAddress: localAddress,
- LocalPort: localPort,
- LocalMark: localMark,
- RemoteAddress: remoteAddress,
- RemotePort: remotePort,
- Proto: proto,
- Weight: weight,
- ActiveConn: activeConn,
- InactConn: inactConn,
- })
- }
- }
- return status, nil
-}
-
-func parseIPPort(s string) (net.IP, uint16, error) {
- var (
- ip net.IP
- err error
- )
-
- switch len(s) {
- case 13:
- ip, err = hex.DecodeString(s[0:8])
- if err != nil {
- return nil, 0, err
- }
- case 46:
- ip = net.ParseIP(s[1:40])
- if ip == nil {
- return nil, 0, fmt.Errorf("%s: Invalid IPv6 addr %s: %w", ErrFileParse, s[1:40], err)
- }
- default:
- return nil, 0, fmt.Errorf("%s: Unexpected IP:Port %s: %w", ErrFileParse, s, err)
- }
-
- portString := s[len(s)-4:]
- if len(portString) != 4 {
- return nil, 0,
- fmt.Errorf("%s: Unexpected port string format %s: %w", ErrFileParse, portString, err)
- }
- port, err := strconv.ParseUint(portString, 16, 16)
- if err != nil {
- return nil, 0, err
- }
-
- return ip, uint16(port), nil
-}
diff --git a/vendor/github.com/prometheus/procfs/kernel_random.go b/vendor/github.com/prometheus/procfs/kernel_random.go
deleted file mode 100644
index db88566..0000000
--- a/vendor/github.com/prometheus/procfs/kernel_random.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows
-// +build !windows
-
-package procfs
-
-import (
- "os"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// KernelRandom contains information about to the kernel's random number generator.
-type KernelRandom struct {
- // EntropyAvaliable gives the available entropy, in bits.
- EntropyAvaliable *uint64
- // PoolSize gives the size of the entropy pool, in bits.
- PoolSize *uint64
- // URandomMinReseedSeconds is the number of seconds after which the DRNG will be reseeded.
- URandomMinReseedSeconds *uint64
- // WriteWakeupThreshold the number of bits of entropy below which we wake up processes
- // that do a select(2) or poll(2) for write access to /dev/random.
- WriteWakeupThreshold *uint64
- // ReadWakeupThreshold is the number of bits of entropy required for waking up processes that sleep
- // waiting for entropy from /dev/random.
- ReadWakeupThreshold *uint64
-}
-
-// KernelRandom returns values from /proc/sys/kernel/random.
-func (fs FS) KernelRandom() (KernelRandom, error) {
- random := KernelRandom{}
-
- for file, p := range map[string]**uint64{
- "entropy_avail": &random.EntropyAvaliable,
- "poolsize": &random.PoolSize,
- "urandom_min_reseed_secs": &random.URandomMinReseedSeconds,
- "write_wakeup_threshold": &random.WriteWakeupThreshold,
- "read_wakeup_threshold": &random.ReadWakeupThreshold,
- } {
- val, err := util.ReadUintFromFile(fs.proc.Path("sys", "kernel", "random", file))
- if os.IsNotExist(err) {
- continue
- }
- if err != nil {
- return random, err
- }
- *p = &val
- }
-
- return random, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/loadavg.go b/vendor/github.com/prometheus/procfs/loadavg.go
deleted file mode 100644
index 59465c5..0000000
--- a/vendor/github.com/prometheus/procfs/loadavg.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// LoadAvg represents an entry in /proc/loadavg.
-type LoadAvg struct {
- Load1 float64
- Load5 float64
- Load15 float64
-}
-
-// LoadAvg returns loadavg from /proc.
-func (fs FS) LoadAvg() (*LoadAvg, error) {
- path := fs.proc.Path("loadavg")
-
- data, err := util.ReadFileNoStat(path)
- if err != nil {
- return nil, err
- }
- return parseLoad(data)
-}
-
-// Parse /proc loadavg and return 1m, 5m and 15m.
-func parseLoad(loadavgBytes []byte) (*LoadAvg, error) {
- loads := make([]float64, 3)
- parts := strings.Fields(string(loadavgBytes))
- if len(parts) < 3 {
- return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, string(loadavgBytes))
- }
-
- var err error
- for i, load := range parts[0:3] {
- loads[i], err = strconv.ParseFloat(load, 64)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse load: %f: %w", ErrFileParse, loads[i], err)
- }
- }
- return &LoadAvg{
- Load1: loads[0],
- Load5: loads[1],
- Load15: loads[2],
- }, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go
deleted file mode 100644
index fdd4b95..0000000
--- a/vendor/github.com/prometheus/procfs/mdstat.go
+++ /dev/null
@@ -1,266 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "os"
- "regexp"
- "strconv"
- "strings"
-)
-
-var (
- statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[([U_]+)\]`)
- recoveryLineBlocksRE = regexp.MustCompile(`\((\d+)/\d+\)`)
- recoveryLinePctRE = regexp.MustCompile(`= (.+)%`)
- recoveryLineFinishRE = regexp.MustCompile(`finish=(.+)min`)
- recoveryLineSpeedRE = regexp.MustCompile(`speed=(.+)[A-Z]`)
- componentDeviceRE = regexp.MustCompile(`(.*)\[\d+\]`)
-)
-
-// MDStat holds info parsed from /proc/mdstat.
-type MDStat struct {
- // Name of the device.
- Name string
- // activity-state of the device.
- ActivityState string
- // Number of active disks.
- DisksActive int64
- // Total number of disks the device requires.
- DisksTotal int64
- // Number of failed disks.
- DisksFailed int64
- // Number of "down" disks. (the _ indicator in the status line)
- DisksDown int64
- // Spare disks in the device.
- DisksSpare int64
- // Number of blocks the device holds.
- BlocksTotal int64
- // Number of blocks on the device that are in sync.
- BlocksSynced int64
- // progress percentage of current sync
- BlocksSyncedPct float64
- // estimated finishing time for current sync (in minutes)
- BlocksSyncedFinishTime float64
- // current sync speed (in Kilobytes/sec)
- BlocksSyncedSpeed float64
- // Name of md component devices
- Devices []string
-}
-
-// MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://raid.wiki.kernel.org/index.php/Mdstat
-func (fs FS) MDStat() ([]MDStat, error) {
- data, err := os.ReadFile(fs.proc.Path("mdstat"))
- if err != nil {
- return nil, err
- }
- mdstat, err := parseMDStat(data)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse %v: %w", ErrFileParse, fs.proc.Path("mdstat"), err)
- }
- return mdstat, nil
-}
-
-// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of
-// structs containing the relevant info.
-func parseMDStat(mdStatData []byte) ([]MDStat, error) {
- mdStats := []MDStat{}
- lines := strings.Split(string(mdStatData), "\n")
-
- for i, line := range lines {
- if strings.TrimSpace(line) == "" || line[0] == ' ' ||
- strings.HasPrefix(line, "Personalities") ||
- strings.HasPrefix(line, "unused") {
- continue
- }
-
- deviceFields := strings.Fields(line)
- if len(deviceFields) < 3 {
- return nil, fmt.Errorf("%s: Expected 3+ lines, got %q", ErrFileParse, line)
- }
- mdName := deviceFields[0] // mdx
- state := deviceFields[2] // active or inactive
-
- if len(lines) <= i+3 {
- return nil, fmt.Errorf("%w: Too few lines for md device: %q", ErrFileParse, mdName)
- }
-
- // Failed disks have the suffix (F) & Spare disks have the suffix (S).
- fail := int64(strings.Count(line, "(F)"))
- spare := int64(strings.Count(line, "(S)"))
- active, total, down, size, err := evalStatusLine(lines[i], lines[i+1])
-
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse md device lines: %v: %w", ErrFileParse, active, err)
- }
-
- syncLineIdx := i + 2
- if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line
- syncLineIdx++
- }
-
- // If device is syncing at the moment, get the number of currently
- // synced bytes, otherwise that number equals the size of the device.
- syncedBlocks := size
- speed := float64(0)
- finish := float64(0)
- pct := float64(0)
- recovering := strings.Contains(lines[syncLineIdx], "recovery")
- resyncing := strings.Contains(lines[syncLineIdx], "resync")
- checking := strings.Contains(lines[syncLineIdx], "check")
-
- // Append recovery and resyncing state info.
- if recovering || resyncing || checking {
- if recovering {
- state = "recovering"
- } else if checking {
- state = "checking"
- } else {
- state = "resyncing"
- }
-
- // Handle case when resync=PENDING or resync=DELAYED.
- if strings.Contains(lines[syncLineIdx], "PENDING") ||
- strings.Contains(lines[syncLineIdx], "DELAYED") {
- syncedBlocks = 0
- } else {
- syncedBlocks, pct, finish, speed, err = evalRecoveryLine(lines[syncLineIdx])
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse sync line in md device: %q: %w", ErrFileParse, mdName, err)
- }
- }
- }
-
- mdStats = append(mdStats, MDStat{
- Name: mdName,
- ActivityState: state,
- DisksActive: active,
- DisksFailed: fail,
- DisksDown: down,
- DisksSpare: spare,
- DisksTotal: total,
- BlocksTotal: size,
- BlocksSynced: syncedBlocks,
- BlocksSyncedPct: pct,
- BlocksSyncedFinishTime: finish,
- BlocksSyncedSpeed: speed,
- Devices: evalComponentDevices(deviceFields),
- })
- }
-
- return mdStats, nil
-}
-
-func evalStatusLine(deviceLine, statusLine string) (active, total, down, size int64, err error) {
- statusFields := strings.Fields(statusLine)
- if len(statusFields) < 1 {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err)
- }
-
- sizeStr := statusFields[0]
- size, err = strconv.ParseInt(sizeStr, 10, 64)
- if err != nil {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err)
- }
-
- if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") {
- // In the device deviceLine, only disks have a number associated with them in [].
- total = int64(strings.Count(deviceLine, "["))
- return total, total, 0, size, nil
- }
-
- if strings.Contains(deviceLine, "inactive") {
- return 0, 0, 0, size, nil
- }
-
- matches := statusLineRE.FindStringSubmatch(statusLine)
- if len(matches) != 5 {
- return 0, 0, 0, 0, fmt.Errorf("%s: Could not fild all substring matches %s: %w", ErrFileParse, statusLine, err)
- }
-
- total, err = strconv.ParseInt(matches[2], 10, 64)
- if err != nil {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected statusline %q: %w", ErrFileParse, statusLine, err)
- }
-
- active, err = strconv.ParseInt(matches[3], 10, 64)
- if err != nil {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected active %d: %w", ErrFileParse, active, err)
- }
- down = int64(strings.Count(matches[4], "_"))
-
- return active, total, down, size, nil
-}
-
-func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, pct float64, finish float64, speed float64, err error) {
- matches := recoveryLineBlocksRE.FindStringSubmatch(recoveryLine)
- if len(matches) != 2 {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected recoveryLine %s: %w", ErrFileParse, recoveryLine, err)
- }
-
- syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
- if err != nil {
- return 0, 0, 0, 0, fmt.Errorf("%s: Unexpected parsing of recoveryLine %q: %w", ErrFileParse, recoveryLine, err)
- }
-
- // Get percentage complete
- matches = recoveryLinePctRE.FindStringSubmatch(recoveryLine)
- if len(matches) != 2 {
- return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching percentage %s", ErrFileParse, recoveryLine)
- }
- pct, err = strconv.ParseFloat(strings.TrimSpace(matches[1]), 64)
- if err != nil {
- return syncedBlocks, 0, 0, 0, fmt.Errorf("%w: Error parsing float from recoveryLine %q", ErrFileParse, recoveryLine)
- }
-
- // Get time expected left to complete
- matches = recoveryLineFinishRE.FindStringSubmatch(recoveryLine)
- if len(matches) != 2 {
- return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unexpected recoveryLine matching est. finish time: %s", ErrFileParse, recoveryLine)
- }
- finish, err = strconv.ParseFloat(matches[1], 64)
- if err != nil {
- return syncedBlocks, pct, 0, 0, fmt.Errorf("%w: Unable to parse float from recoveryLine: %q", ErrFileParse, recoveryLine)
- }
-
- // Get recovery speed
- matches = recoveryLineSpeedRE.FindStringSubmatch(recoveryLine)
- if len(matches) != 2 {
- return syncedBlocks, pct, finish, 0, fmt.Errorf("%w: Unexpected recoveryLine value: %s", ErrFileParse, recoveryLine)
- }
- speed, err = strconv.ParseFloat(matches[1], 64)
- if err != nil {
- return syncedBlocks, pct, finish, 0, fmt.Errorf("%s: Error parsing float from recoveryLine: %q: %w", ErrFileParse, recoveryLine, err)
- }
-
- return syncedBlocks, pct, finish, speed, nil
-}
-
-func evalComponentDevices(deviceFields []string) []string {
- mdComponentDevices := make([]string, 0)
- if len(deviceFields) > 3 {
- for _, field := range deviceFields[4:] {
- match := componentDeviceRE.FindStringSubmatch(field)
- if match == nil {
- continue
- }
- mdComponentDevices = append(mdComponentDevices, match[1])
- }
- }
-
- return mdComponentDevices
-}
diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go
deleted file mode 100644
index eaf00e2..0000000
--- a/vendor/github.com/prometheus/procfs/meminfo.go
+++ /dev/null
@@ -1,277 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Meminfo represents memory statistics.
-type Meminfo struct {
- // Total usable ram (i.e. physical ram minus a few reserved
- // bits and the kernel binary code)
- MemTotal *uint64
- // The sum of LowFree+HighFree
- MemFree *uint64
- // An estimate of how much memory is available for starting
- // new applications, without swapping. Calculated from
- // MemFree, SReclaimable, the size of the file LRU lists, and
- // the low watermarks in each zone. The estimate takes into
- // account that the system needs some page cache to function
- // well, and that not all reclaimable slab will be
- // reclaimable, due to items being in use. The impact of those
- // factors will vary from system to system.
- MemAvailable *uint64
- // Relatively temporary storage for raw disk blocks shouldn't
- // get tremendously large (20MB or so)
- Buffers *uint64
- Cached *uint64
- // Memory that once was swapped out, is swapped back in but
- // still also is in the swapfile (if memory is needed it
- // doesn't need to be swapped out AGAIN because it is already
- // in the swapfile. This saves I/O)
- SwapCached *uint64
- // Memory that has been used more recently and usually not
- // reclaimed unless absolutely necessary.
- Active *uint64
- // Memory which has been less recently used. It is more
- // eligible to be reclaimed for other purposes
- Inactive *uint64
- ActiveAnon *uint64
- InactiveAnon *uint64
- ActiveFile *uint64
- InactiveFile *uint64
- Unevictable *uint64
- Mlocked *uint64
- // total amount of swap space available
- SwapTotal *uint64
- // Memory which has been evicted from RAM, and is temporarily
- // on the disk
- SwapFree *uint64
- // Memory which is waiting to get written back to the disk
- Dirty *uint64
- // Memory which is actively being written back to the disk
- Writeback *uint64
- // Non-file backed pages mapped into userspace page tables
- AnonPages *uint64
- // files which have been mapped, such as libraries
- Mapped *uint64
- Shmem *uint64
- // in-kernel data structures cache
- Slab *uint64
- // Part of Slab, that might be reclaimed, such as caches
- SReclaimable *uint64
- // Part of Slab, that cannot be reclaimed on memory pressure
- SUnreclaim *uint64
- KernelStack *uint64
- // amount of memory dedicated to the lowest level of page
- // tables.
- PageTables *uint64
- // NFS pages sent to the server, but not yet committed to
- // stable storage
- NFSUnstable *uint64
- // Memory used for block device "bounce buffers"
- Bounce *uint64
- // Memory used by FUSE for temporary writeback buffers
- WritebackTmp *uint64
- // Based on the overcommit ratio ('vm.overcommit_ratio'),
- // this is the total amount of memory currently available to
- // be allocated on the system. This limit is only adhered to
- // if strict overcommit accounting is enabled (mode 2 in
- // 'vm.overcommit_memory').
- // The CommitLimit is calculated with the following formula:
- // CommitLimit = ([total RAM pages] - [total huge TLB pages]) *
- // overcommit_ratio / 100 + [total swap pages]
- // For example, on a system with 1G of physical RAM and 7G
- // of swap with a `vm.overcommit_ratio` of 30 it would
- // yield a CommitLimit of 7.3G.
- // For more details, see the memory overcommit documentation
- // in vm/overcommit-accounting.
- CommitLimit *uint64
- // The amount of memory presently allocated on the system.
- // The committed memory is a sum of all of the memory which
- // has been allocated by processes, even if it has not been
- // "used" by them as of yet. A process which malloc()'s 1G
- // of memory, but only touches 300M of it will show up as
- // using 1G. This 1G is memory which has been "committed" to
- // by the VM and can be used at any time by the allocating
- // application. With strict overcommit enabled on the system
- // (mode 2 in 'vm.overcommit_memory'),allocations which would
- // exceed the CommitLimit (detailed above) will not be permitted.
- // This is useful if one needs to guarantee that processes will
- // not fail due to lack of memory once that memory has been
- // successfully allocated.
- CommittedAS *uint64
- // total size of vmalloc memory area
- VmallocTotal *uint64
- // amount of vmalloc area which is used
- VmallocUsed *uint64
- // largest contiguous block of vmalloc area which is free
- VmallocChunk *uint64
- HardwareCorrupted *uint64
- AnonHugePages *uint64
- ShmemHugePages *uint64
- ShmemPmdMapped *uint64
- CmaTotal *uint64
- CmaFree *uint64
- HugePagesTotal *uint64
- HugePagesFree *uint64
- HugePagesRsvd *uint64
- HugePagesSurp *uint64
- Hugepagesize *uint64
- DirectMap4k *uint64
- DirectMap2M *uint64
- DirectMap1G *uint64
-}
-
-// Meminfo returns an information about current kernel/system memory statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) Meminfo() (Meminfo, error) {
- b, err := util.ReadFileNoStat(fs.proc.Path("meminfo"))
- if err != nil {
- return Meminfo{}, err
- }
-
- m, err := parseMemInfo(bytes.NewReader(b))
- if err != nil {
- return Meminfo{}, fmt.Errorf("%s: %w", ErrFileParse, err)
- }
-
- return *m, nil
-}
-
-func parseMemInfo(r io.Reader) (*Meminfo, error) {
- var m Meminfo
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Each line has at least a name and value; we ignore the unit.
- fields := strings.Fields(s.Text())
- if len(fields) < 2 {
- return nil, fmt.Errorf("%w: Malformed line %q", ErrFileParse, s.Text())
- }
-
- v, err := strconv.ParseUint(fields[1], 0, 64)
- if err != nil {
- return nil, err
- }
-
- switch fields[0] {
- case "MemTotal:":
- m.MemTotal = &v
- case "MemFree:":
- m.MemFree = &v
- case "MemAvailable:":
- m.MemAvailable = &v
- case "Buffers:":
- m.Buffers = &v
- case "Cached:":
- m.Cached = &v
- case "SwapCached:":
- m.SwapCached = &v
- case "Active:":
- m.Active = &v
- case "Inactive:":
- m.Inactive = &v
- case "Active(anon):":
- m.ActiveAnon = &v
- case "Inactive(anon):":
- m.InactiveAnon = &v
- case "Active(file):":
- m.ActiveFile = &v
- case "Inactive(file):":
- m.InactiveFile = &v
- case "Unevictable:":
- m.Unevictable = &v
- case "Mlocked:":
- m.Mlocked = &v
- case "SwapTotal:":
- m.SwapTotal = &v
- case "SwapFree:":
- m.SwapFree = &v
- case "Dirty:":
- m.Dirty = &v
- case "Writeback:":
- m.Writeback = &v
- case "AnonPages:":
- m.AnonPages = &v
- case "Mapped:":
- m.Mapped = &v
- case "Shmem:":
- m.Shmem = &v
- case "Slab:":
- m.Slab = &v
- case "SReclaimable:":
- m.SReclaimable = &v
- case "SUnreclaim:":
- m.SUnreclaim = &v
- case "KernelStack:":
- m.KernelStack = &v
- case "PageTables:":
- m.PageTables = &v
- case "NFS_Unstable:":
- m.NFSUnstable = &v
- case "Bounce:":
- m.Bounce = &v
- case "WritebackTmp:":
- m.WritebackTmp = &v
- case "CommitLimit:":
- m.CommitLimit = &v
- case "Committed_AS:":
- m.CommittedAS = &v
- case "VmallocTotal:":
- m.VmallocTotal = &v
- case "VmallocUsed:":
- m.VmallocUsed = &v
- case "VmallocChunk:":
- m.VmallocChunk = &v
- case "HardwareCorrupted:":
- m.HardwareCorrupted = &v
- case "AnonHugePages:":
- m.AnonHugePages = &v
- case "ShmemHugePages:":
- m.ShmemHugePages = &v
- case "ShmemPmdMapped:":
- m.ShmemPmdMapped = &v
- case "CmaTotal:":
- m.CmaTotal = &v
- case "CmaFree:":
- m.CmaFree = &v
- case "HugePages_Total:":
- m.HugePagesTotal = &v
- case "HugePages_Free:":
- m.HugePagesFree = &v
- case "HugePages_Rsvd:":
- m.HugePagesRsvd = &v
- case "HugePages_Surp:":
- m.HugePagesSurp = &v
- case "Hugepagesize:":
- m.Hugepagesize = &v
- case "DirectMap4k:":
- m.DirectMap4k = &v
- case "DirectMap2M:":
- m.DirectMap2M = &v
- case "DirectMap1G:":
- m.DirectMap1G = &v
- }
- }
-
- return &m, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go
deleted file mode 100644
index 388ebf3..0000000
--- a/vendor/github.com/prometheus/procfs/mountinfo.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// A MountInfo is a type that describes the details, options
-// for each mount, parsed from /proc/self/mountinfo.
-// The fields described in each entry of /proc/self/mountinfo
-// is described in the following man page.
-// http://man7.org/linux/man-pages/man5/proc.5.html
-type MountInfo struct {
- // Unique ID for the mount
- MountID int
- // The ID of the parent mount
- ParentID int
- // The value of `st_dev` for the files on this FS
- MajorMinorVer string
- // The pathname of the directory in the FS that forms
- // the root for this mount
- Root string
- // The pathname of the mount point relative to the root
- MountPoint string
- // Mount options
- Options map[string]string
- // Zero or more optional fields
- OptionalFields map[string]string
- // The Filesystem type
- FSType string
- // FS specific information or "none"
- Source string
- // Superblock options
- SuperOptions map[string]string
-}
-
-// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs.
-func parseMountInfo(info []byte) ([]*MountInfo, error) {
- mounts := []*MountInfo{}
- scanner := bufio.NewScanner(bytes.NewReader(info))
- for scanner.Scan() {
- mountString := scanner.Text()
- parsedMounts, err := parseMountInfoString(mountString)
- if err != nil {
- return nil, err
- }
- mounts = append(mounts, parsedMounts)
- }
-
- err := scanner.Err()
- return mounts, err
-}
-
-// Parses a mountinfo file line, and converts it to a MountInfo struct.
-// An important check here is to see if the hyphen separator, as if it does not exist,
-// it means that the line is malformed.
-func parseMountInfoString(mountString string) (*MountInfo, error) {
- var err error
-
- mountInfo := strings.Split(mountString, " ")
- mountInfoLength := len(mountInfo)
- if mountInfoLength < 10 {
- return nil, fmt.Errorf("%w: Too few fields in mount string: %s", ErrFileParse, mountString)
- }
-
- if mountInfo[mountInfoLength-4] != "-" {
- return nil, fmt.Errorf("%w: couldn't find separator in expected field: %s", ErrFileParse, mountInfo[mountInfoLength-4])
- }
-
- mount := &MountInfo{
- MajorMinorVer: mountInfo[2],
- Root: mountInfo[3],
- MountPoint: mountInfo[4],
- Options: mountOptionsParser(mountInfo[5]),
- OptionalFields: nil,
- FSType: mountInfo[mountInfoLength-3],
- Source: mountInfo[mountInfoLength-2],
- SuperOptions: mountOptionsParser(mountInfo[mountInfoLength-1]),
- }
-
- mount.MountID, err = strconv.Atoi(mountInfo[0])
- if err != nil {
- return nil, fmt.Errorf("%w: mount ID: %q", ErrFileParse, mount.MountID)
- }
- mount.ParentID, err = strconv.Atoi(mountInfo[1])
- if err != nil {
- return nil, fmt.Errorf("%w: parent ID: %q", ErrFileParse, mount.ParentID)
- }
- // Has optional fields, which is a space separated list of values.
- // Example: shared:2 master:7
- if mountInfo[6] != "" {
- mount.OptionalFields, err = mountOptionsParseOptionalFields(mountInfo[6 : mountInfoLength-4])
- if err != nil {
- return nil, fmt.Errorf("%s: %w", ErrFileParse, err)
- }
- }
- return mount, nil
-}
-
-// mountOptionsIsValidField checks a string against a valid list of optional fields keys.
-func mountOptionsIsValidField(s string) bool {
- switch s {
- case
- "shared",
- "master",
- "propagate_from",
- "unbindable":
- return true
- }
- return false
-}
-
-// mountOptionsParseOptionalFields parses a list of optional fields strings into a double map of strings.
-func mountOptionsParseOptionalFields(o []string) (map[string]string, error) {
- optionalFields := make(map[string]string)
- for _, field := range o {
- optionSplit := strings.SplitN(field, ":", 2)
- value := ""
- if len(optionSplit) == 2 {
- value = optionSplit[1]
- }
- if mountOptionsIsValidField(optionSplit[0]) {
- optionalFields[optionSplit[0]] = value
- }
- }
- return optionalFields, nil
-}
-
-// mountOptionsParser parses the mount options, superblock options.
-func mountOptionsParser(mountOptions string) map[string]string {
- opts := make(map[string]string)
- options := strings.Split(mountOptions, ",")
- for _, opt := range options {
- splitOption := strings.Split(opt, "=")
- if len(splitOption) < 2 {
- key := splitOption[0]
- opts[key] = ""
- } else {
- key, value := splitOption[0], splitOption[1]
- opts[key] = value
- }
- }
- return opts
-}
-
-// GetMounts retrieves mountinfo information from `/proc/self/mountinfo`.
-func GetMounts() ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat("/proc/self/mountinfo")
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
-
-// GetProcMounts retrieves mountinfo information from a processes' `/proc//mountinfo`.
-func GetProcMounts(pid int) ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat(fmt.Sprintf("/proc/%d/mountinfo", pid))
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go
deleted file mode 100644
index 9d8af6d..0000000
--- a/vendor/github.com/prometheus/procfs/mountstats.go
+++ /dev/null
@@ -1,712 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-// While implementing parsing of /proc/[pid]/mountstats, this blog was used
-// heavily as a reference:
-// https://utcc.utoronto.ca/~cks/space/blog/linux/NFSMountstatsIndex
-//
-// Special thanks to Chris Siebenmann for all of his posts explaining the
-// various statistics available for NFS.
-
-import (
- "bufio"
- "fmt"
- "io"
- "strconv"
- "strings"
- "time"
-)
-
-// Constants shared between multiple functions.
-const (
- deviceEntryLen = 8
-
- fieldBytesLen = 8
- fieldEventsLen = 27
-
- statVersion10 = "1.0"
- statVersion11 = "1.1"
-
- fieldTransport10TCPLen = 10
- fieldTransport10UDPLen = 7
-
- fieldTransport11TCPLen = 13
- fieldTransport11UDPLen = 10
-
- // kernel version >= 4.14 MaxLen
- // See: https://elixir.bootlin.com/linux/v6.4.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L393
- fieldTransport11RDMAMaxLen = 28
-
- // kernel version <= 4.2 MinLen
- // See: https://elixir.bootlin.com/linux/v4.2.8/source/net/sunrpc/xprtrdma/xprt_rdma.h#L331
- fieldTransport11RDMAMinLen = 20
-)
-
-// A Mount is a device mount parsed from /proc/[pid]/mountstats.
-type Mount struct {
- // Name of the device.
- Device string
- // The mount point of the device.
- Mount string
- // The filesystem type used by the device.
- Type string
- // If available additional statistics related to this Mount.
- // Use a type assertion to determine if additional statistics are available.
- Stats MountStats
-}
-
-// A MountStats is a type which contains detailed statistics for a specific
-// type of Mount.
-type MountStats interface {
- mountStats()
-}
-
-// A MountStatsNFS is a MountStats implementation for NFSv3 and v4 mounts.
-type MountStatsNFS struct {
- // The version of statistics provided.
- StatVersion string
- // The mount options of the NFS mount.
- Opts map[string]string
- // The age of the NFS mount.
- Age time.Duration
- // Statistics related to byte counters for various operations.
- Bytes NFSBytesStats
- // Statistics related to various NFS event occurrences.
- Events NFSEventsStats
- // Statistics broken down by filesystem operation.
- Operations []NFSOperationStats
- // Statistics about the NFS RPC transport.
- Transport NFSTransportStats
-}
-
-// mountStats implements MountStats.
-func (m MountStatsNFS) mountStats() {}
-
-// A NFSBytesStats contains statistics about the number of bytes read and written
-// by an NFS client to and from an NFS server.
-type NFSBytesStats struct {
- // Number of bytes read using the read() syscall.
- Read uint64
- // Number of bytes written using the write() syscall.
- Write uint64
- // Number of bytes read using the read() syscall in O_DIRECT mode.
- DirectRead uint64
- // Number of bytes written using the write() syscall in O_DIRECT mode.
- DirectWrite uint64
- // Number of bytes read from the NFS server, in total.
- ReadTotal uint64
- // Number of bytes written to the NFS server, in total.
- WriteTotal uint64
- // Number of pages read directly via mmap()'d files.
- ReadPages uint64
- // Number of pages written directly via mmap()'d files.
- WritePages uint64
-}
-
-// A NFSEventsStats contains statistics about NFS event occurrences.
-type NFSEventsStats struct {
- // Number of times cached inode attributes are re-validated from the server.
- InodeRevalidate uint64
- // Number of times cached dentry nodes are re-validated from the server.
- DnodeRevalidate uint64
- // Number of times an inode cache is cleared.
- DataInvalidate uint64
- // Number of times cached inode attributes are invalidated.
- AttributeInvalidate uint64
- // Number of times files or directories have been open()'d.
- VFSOpen uint64
- // Number of times a directory lookup has occurred.
- VFSLookup uint64
- // Number of times permissions have been checked.
- VFSAccess uint64
- // Number of updates (and potential writes) to pages.
- VFSUpdatePage uint64
- // Number of pages read directly via mmap()'d files.
- VFSReadPage uint64
- // Number of times a group of pages have been read.
- VFSReadPages uint64
- // Number of pages written directly via mmap()'d files.
- VFSWritePage uint64
- // Number of times a group of pages have been written.
- VFSWritePages uint64
- // Number of times directory entries have been read with getdents().
- VFSGetdents uint64
- // Number of times attributes have been set on inodes.
- VFSSetattr uint64
- // Number of pending writes that have been forcefully flushed to the server.
- VFSFlush uint64
- // Number of times fsync() has been called on directories and files.
- VFSFsync uint64
- // Number of times locking has been attempted on a file.
- VFSLock uint64
- // Number of times files have been closed and released.
- VFSFileRelease uint64
- // Unknown. Possibly unused.
- CongestionWait uint64
- // Number of times files have been truncated.
- Truncation uint64
- // Number of times a file has been grown due to writes beyond its existing end.
- WriteExtension uint64
- // Number of times a file was removed while still open by another process.
- SillyRename uint64
- // Number of times the NFS server gave less data than expected while reading.
- ShortRead uint64
- // Number of times the NFS server wrote less data than expected while writing.
- ShortWrite uint64
- // Number of times the NFS server indicated EJUKEBOX; retrieving data from
- // offline storage.
- JukeboxDelay uint64
- // Number of NFS v4.1+ pNFS reads.
- PNFSRead uint64
- // Number of NFS v4.1+ pNFS writes.
- PNFSWrite uint64
-}
-
-// A NFSOperationStats contains statistics for a single operation.
-type NFSOperationStats struct {
- // The name of the operation.
- Operation string
- // Number of requests performed for this operation.
- Requests uint64
- // Number of times an actual RPC request has been transmitted for this operation.
- Transmissions uint64
- // Number of times a request has had a major timeout.
- MajorTimeouts uint64
- // Number of bytes sent for this operation, including RPC headers and payload.
- BytesSent uint64
- // Number of bytes received for this operation, including RPC headers and payload.
- BytesReceived uint64
- // Duration all requests spent queued for transmission before they were sent.
- CumulativeQueueMilliseconds uint64
- // Duration it took to get a reply back after the request was transmitted.
- CumulativeTotalResponseMilliseconds uint64
- // Duration from when a request was enqueued to when it was completely handled.
- CumulativeTotalRequestMilliseconds uint64
- // The average time from the point the client sends RPC requests until it receives the response.
- AverageRTTMilliseconds float64
- // The count of operations that complete with tk_status < 0. These statuses usually indicate error conditions.
- Errors uint64
-}
-
-// A NFSTransportStats contains statistics for the NFS mount RPC requests and
-// responses.
-type NFSTransportStats struct {
- // The transport protocol used for the NFS mount.
- Protocol string
- // The local port used for the NFS mount.
- Port uint64
- // Number of times the client has had to establish a connection from scratch
- // to the NFS server.
- Bind uint64
- // Number of times the client has made a TCP connection to the NFS server.
- Connect uint64
- // Duration (in jiffies, a kernel internal unit of time) the NFS mount has
- // spent waiting for connections to the server to be established.
- ConnectIdleTime uint64
- // Duration since the NFS mount last saw any RPC traffic.
- IdleTimeSeconds uint64
- // Number of RPC requests for this mount sent to the NFS server.
- Sends uint64
- // Number of RPC responses for this mount received from the NFS server.
- Receives uint64
- // Number of times the NFS server sent a response with a transaction ID
- // unknown to this client.
- BadTransactionIDs uint64
- // A running counter, incremented on each request as the current difference
- // ebetween sends and receives.
- CumulativeActiveRequests uint64
- // A running counter, incremented on each request by the current backlog
- // queue size.
- CumulativeBacklog uint64
-
- // Stats below only available with stat version 1.1.
-
- // Maximum number of simultaneously active RPC requests ever used.
- MaximumRPCSlotsUsed uint64
- // A running counter, incremented on each request as the current size of the
- // sending queue.
- CumulativeSendingQueue uint64
- // A running counter, incremented on each request as the current size of the
- // pending queue.
- CumulativePendingQueue uint64
-
- // Stats below only available with stat version 1.1.
- // Transport over RDMA
-
- // accessed when sending a call
- ReadChunkCount uint64
- WriteChunkCount uint64
- ReplyChunkCount uint64
- TotalRdmaRequest uint64
-
- // rarely accessed error counters
- PullupCopyCount uint64
- HardwayRegisterCount uint64
- FailedMarshalCount uint64
- BadReplyCount uint64
- MrsRecovered uint64
- MrsOrphaned uint64
- MrsAllocated uint64
- EmptySendctxQ uint64
-
- // accessed when receiving a reply
- TotalRdmaReply uint64
- FixupCopyCount uint64
- ReplyWaitsForSend uint64
- LocalInvNeeded uint64
- NomsgCallCount uint64
- BcallCount uint64
-}
-
-// parseMountStats parses a /proc/[pid]/mountstats file and returns a slice
-// of Mount structures containing detailed information about each mount.
-// If available, statistics for each mount are parsed as well.
-func parseMountStats(r io.Reader) ([]*Mount, error) {
- const (
- device = "device"
- statVersionPrefix = "statvers="
-
- nfs3Type = "nfs"
- nfs4Type = "nfs4"
- )
-
- var mounts []*Mount
-
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Only look for device entries in this function
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 || ss[0] != device {
- continue
- }
-
- m, err := parseMount(ss)
- if err != nil {
- return nil, err
- }
-
- // Does this mount also possess statistics information?
- if len(ss) > deviceEntryLen {
- // Only NFSv3 and v4 are supported for parsing statistics
- if m.Type != nfs3Type && m.Type != nfs4Type {
- return nil, fmt.Errorf("%w: Cannot parse MountStats for %q", ErrFileParse, m.Type)
- }
-
- statVersion := strings.TrimPrefix(ss[8], statVersionPrefix)
-
- stats, err := parseMountStatsNFS(s, statVersion)
- if err != nil {
- return nil, err
- }
-
- m.Stats = stats
- }
-
- mounts = append(mounts, m)
- }
-
- return mounts, s.Err()
-}
-
-// parseMount parses an entry in /proc/[pid]/mountstats in the format:
-//
-// device [device] mounted on [mount] with fstype [type]
-func parseMount(ss []string) (*Mount, error) {
- if len(ss) < deviceEntryLen {
- return nil, fmt.Errorf("%w: Invalid device %q", ErrFileParse, ss)
- }
-
- // Check for specific words appearing at specific indices to ensure
- // the format is consistent with what we expect
- format := []struct {
- i int
- s string
- }{
- {i: 0, s: "device"},
- {i: 2, s: "mounted"},
- {i: 3, s: "on"},
- {i: 5, s: "with"},
- {i: 6, s: "fstype"},
- }
-
- for _, f := range format {
- if ss[f.i] != f.s {
- return nil, fmt.Errorf("%w: Invalid device %q", ErrFileParse, ss)
- }
- }
-
- return &Mount{
- Device: ss[1],
- Mount: ss[4],
- Type: ss[7],
- }, nil
-}
-
-// parseMountStatsNFS parses a MountStatsNFS by scanning additional information
-// related to NFS statistics.
-func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, error) {
- // Field indicators for parsing specific types of data
- const (
- fieldOpts = "opts:"
- fieldAge = "age:"
- fieldBytes = "bytes:"
- fieldEvents = "events:"
- fieldPerOpStats = "per-op"
- fieldTransport = "xprt:"
- )
-
- stats := &MountStatsNFS{
- StatVersion: statVersion,
- }
-
- for s.Scan() {
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 {
- break
- }
-
- switch ss[0] {
- case fieldOpts:
- if len(ss) < 2 {
- return nil, fmt.Errorf("%w: Incomplete information for NFS stats: %v", ErrFileParse, ss)
- }
- if stats.Opts == nil {
- stats.Opts = map[string]string{}
- }
- for _, opt := range strings.Split(ss[1], ",") {
- split := strings.Split(opt, "=")
- if len(split) == 2 {
- stats.Opts[split[0]] = split[1]
- } else {
- stats.Opts[opt] = ""
- }
- }
- case fieldAge:
- if len(ss) < 2 {
- return nil, fmt.Errorf("%w: Incomplete information for NFS stats: %v", ErrFileParse, ss)
- }
- // Age integer is in seconds
- d, err := time.ParseDuration(ss[1] + "s")
- if err != nil {
- return nil, err
- }
-
- stats.Age = d
- case fieldBytes:
- if len(ss) < 2 {
- return nil, fmt.Errorf("%w: Incomplete information for NFS stats: %v", ErrFileParse, ss)
- }
- bstats, err := parseNFSBytesStats(ss[1:])
- if err != nil {
- return nil, err
- }
-
- stats.Bytes = *bstats
- case fieldEvents:
- if len(ss) < 2 {
- return nil, fmt.Errorf("%w: Incomplete information for NFS events: %v", ErrFileParse, ss)
- }
- estats, err := parseNFSEventsStats(ss[1:])
- if err != nil {
- return nil, err
- }
-
- stats.Events = *estats
- case fieldTransport:
- if len(ss) < 3 {
- return nil, fmt.Errorf("%w: Incomplete information for NFS transport stats: %v", ErrFileParse, ss)
- }
-
- tstats, err := parseNFSTransportStats(ss[1:], statVersion)
- if err != nil {
- return nil, err
- }
-
- stats.Transport = *tstats
- }
-
- // When encountering "per-operation statistics", we must break this
- // loop and parse them separately to ensure we can terminate parsing
- // before reaching another device entry; hence why this 'if' statement
- // is not just another switch case
- if ss[0] == fieldPerOpStats {
- break
- }
- }
-
- if err := s.Err(); err != nil {
- return nil, err
- }
-
- // NFS per-operation stats appear last before the next device entry
- perOpStats, err := parseNFSOperationStats(s)
- if err != nil {
- return nil, err
- }
-
- stats.Operations = perOpStats
-
- return stats, nil
-}
-
-// parseNFSBytesStats parses a NFSBytesStats line using an input set of
-// integer fields.
-func parseNFSBytesStats(ss []string) (*NFSBytesStats, error) {
- if len(ss) != fieldBytesLen {
- return nil, fmt.Errorf("%w: Invalid NFS bytes stats: %v", ErrFileParse, ss)
- }
-
- ns := make([]uint64, 0, fieldBytesLen)
- for _, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
-
- return &NFSBytesStats{
- Read: ns[0],
- Write: ns[1],
- DirectRead: ns[2],
- DirectWrite: ns[3],
- ReadTotal: ns[4],
- WriteTotal: ns[5],
- ReadPages: ns[6],
- WritePages: ns[7],
- }, nil
-}
-
-// parseNFSEventsStats parses a NFSEventsStats line using an input set of
-// integer fields.
-func parseNFSEventsStats(ss []string) (*NFSEventsStats, error) {
- if len(ss) != fieldEventsLen {
- return nil, fmt.Errorf("%w: invalid NFS events stats: %v", ErrFileParse, ss)
- }
-
- ns := make([]uint64, 0, fieldEventsLen)
- for _, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
-
- return &NFSEventsStats{
- InodeRevalidate: ns[0],
- DnodeRevalidate: ns[1],
- DataInvalidate: ns[2],
- AttributeInvalidate: ns[3],
- VFSOpen: ns[4],
- VFSLookup: ns[5],
- VFSAccess: ns[6],
- VFSUpdatePage: ns[7],
- VFSReadPage: ns[8],
- VFSReadPages: ns[9],
- VFSWritePage: ns[10],
- VFSWritePages: ns[11],
- VFSGetdents: ns[12],
- VFSSetattr: ns[13],
- VFSFlush: ns[14],
- VFSFsync: ns[15],
- VFSLock: ns[16],
- VFSFileRelease: ns[17],
- CongestionWait: ns[18],
- Truncation: ns[19],
- WriteExtension: ns[20],
- SillyRename: ns[21],
- ShortRead: ns[22],
- ShortWrite: ns[23],
- JukeboxDelay: ns[24],
- PNFSRead: ns[25],
- PNFSWrite: ns[26],
- }, nil
-}
-
-// parseNFSOperationStats parses a slice of NFSOperationStats by scanning
-// additional information about per-operation statistics until an empty
-// line is reached.
-func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) {
- const (
- // Minimum number of expected fields in each per-operation statistics set
- minFields = 9
- )
-
- var ops []NFSOperationStats
-
- for s.Scan() {
- ss := strings.Fields(string(s.Bytes()))
- if len(ss) == 0 {
- // Must break when reading a blank line after per-operation stats to
- // enable top-level function to parse the next device entry
- break
- }
-
- if len(ss) < minFields {
- return nil, fmt.Errorf("%w: invalid NFS per-operations stats: %v", ErrFileParse, ss)
- }
-
- // Skip string operation name for integers
- ns := make([]uint64, 0, minFields-1)
- for _, st := range ss[1:] {
- n, err := strconv.ParseUint(st, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns = append(ns, n)
- }
- opStats := NFSOperationStats{
- Operation: strings.TrimSuffix(ss[0], ":"),
- Requests: ns[0],
- Transmissions: ns[1],
- MajorTimeouts: ns[2],
- BytesSent: ns[3],
- BytesReceived: ns[4],
- CumulativeQueueMilliseconds: ns[5],
- CumulativeTotalResponseMilliseconds: ns[6],
- CumulativeTotalRequestMilliseconds: ns[7],
- }
- if ns[0] != 0 {
- opStats.AverageRTTMilliseconds = float64(ns[6]) / float64(ns[0])
- }
-
- if len(ns) > 8 {
- opStats.Errors = ns[8]
- }
-
- ops = append(ops, opStats)
- }
-
- return ops, s.Err()
-}
-
-// parseNFSTransportStats parses a NFSTransportStats line using an input set of
-// integer fields matched to a specific stats version.
-func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats, error) {
- // Extract the protocol field. It is the only string value in the line
- protocol := ss[0]
- ss = ss[1:]
-
- switch statVersion {
- case statVersion10:
- var expectedLength int
- if protocol == "tcp" {
- expectedLength = fieldTransport10TCPLen
- } else if protocol == "udp" {
- expectedLength = fieldTransport10UDPLen
- } else {
- return nil, fmt.Errorf("%w: Invalid NFS protocol \"%s\" in stats 1.0 statement: %v", ErrFileParse, protocol, ss)
- }
- if len(ss) != expectedLength {
- return nil, fmt.Errorf("%w: Invalid NFS transport stats 1.0 statement: %v", ErrFileParse, ss)
- }
- case statVersion11:
- var expectedLength int
- if protocol == "tcp" {
- expectedLength = fieldTransport11TCPLen
- } else if protocol == "udp" {
- expectedLength = fieldTransport11UDPLen
- } else if protocol == "rdma" {
- expectedLength = fieldTransport11RDMAMinLen
- } else {
- return nil, fmt.Errorf("%w: invalid NFS protocol \"%s\" in stats 1.1 statement: %v", ErrFileParse, protocol, ss)
- }
- if (len(ss) != expectedLength && (protocol == "tcp" || protocol == "udp")) ||
- (protocol == "rdma" && len(ss) < expectedLength) {
- return nil, fmt.Errorf("%w: invalid NFS transport stats 1.1 statement: %v, protocol: %v", ErrFileParse, ss, protocol)
- }
- default:
- return nil, fmt.Errorf("%s: Unrecognized NFS transport stats version: %q, protocol: %v", ErrFileParse, statVersion, protocol)
- }
-
- // Allocate enough for v1.1 stats since zero value for v1.1 stats will be okay
- // in a v1.0 response. Since the stat length is bigger for TCP stats, we use
- // the TCP length here.
- //
- // Note: slice length must be set to length of v1.1 stats to avoid a panic when
- // only v1.0 stats are present.
- // See: https://github.com/prometheus/node_exporter/issues/571.
- //
- // Note: NFS Over RDMA slice length is fieldTransport11RDMAMaxLen
- ns := make([]uint64, fieldTransport11RDMAMaxLen+3)
- for i, s := range ss {
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return nil, err
- }
-
- ns[i] = n
- }
-
- // The fields differ depending on the transport protocol (TCP or UDP)
- // From https://utcc.utoronto.ca/%7Ecks/space/blog/linux/NFSMountstatsXprt
- //
- // For the udp RPC transport there is no connection count, connect idle time,
- // or idle time (fields #3, #4, and #5); all other fields are the same. So
- // we set them to 0 here.
- if protocol == "udp" {
- ns = append(ns[:2], append(make([]uint64, 3), ns[2:]...)...)
- } else if protocol == "tcp" {
- ns = append(ns[:fieldTransport11TCPLen], make([]uint64, fieldTransport11RDMAMaxLen-fieldTransport11TCPLen+3)...)
- } else if protocol == "rdma" {
- ns = append(ns[:fieldTransport10TCPLen], append(make([]uint64, 3), ns[fieldTransport10TCPLen:]...)...)
- }
-
- return &NFSTransportStats{
- // NFS xprt over tcp or udp
- Protocol: protocol,
- Port: ns[0],
- Bind: ns[1],
- Connect: ns[2],
- ConnectIdleTime: ns[3],
- IdleTimeSeconds: ns[4],
- Sends: ns[5],
- Receives: ns[6],
- BadTransactionIDs: ns[7],
- CumulativeActiveRequests: ns[8],
- CumulativeBacklog: ns[9],
-
- // NFS xprt over tcp or udp
- // And statVersion 1.1
- MaximumRPCSlotsUsed: ns[10],
- CumulativeSendingQueue: ns[11],
- CumulativePendingQueue: ns[12],
-
- // NFS xprt over rdma
- // And stat Version 1.1
- ReadChunkCount: ns[13],
- WriteChunkCount: ns[14],
- ReplyChunkCount: ns[15],
- TotalRdmaRequest: ns[16],
- PullupCopyCount: ns[17],
- HardwayRegisterCount: ns[18],
- FailedMarshalCount: ns[19],
- BadReplyCount: ns[20],
- MrsRecovered: ns[21],
- MrsOrphaned: ns[22],
- MrsAllocated: ns[23],
- EmptySendctxQ: ns[24],
- TotalRdmaReply: ns[25],
- FixupCopyCount: ns[26],
- ReplyWaitsForSend: ns[27],
- LocalInvNeeded: ns[28],
- NomsgCallCount: ns[29],
- BcallCount: ns[30],
- }, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_conntrackstat.go b/vendor/github.com/prometheus/procfs/net_conntrackstat.go
deleted file mode 100644
index fdfa456..0000000
--- a/vendor/github.com/prometheus/procfs/net_conntrackstat.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// A ConntrackStatEntry represents one line from net/stat/nf_conntrack
-// and contains netfilter conntrack statistics at one CPU core.
-type ConntrackStatEntry struct {
- Entries uint64
- Searched uint64
- Found uint64
- New uint64
- Invalid uint64
- Ignore uint64
- Delete uint64
- DeleteList uint64
- Insert uint64
- InsertFailed uint64
- Drop uint64
- EarlyDrop uint64
- SearchRestart uint64
-}
-
-// ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores.
-func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error) {
- return readConntrackStat(fs.proc.Path("net", "stat", "nf_conntrack"))
-}
-
-// Parses a slice of ConntrackStatEntries from the given filepath.
-func readConntrackStat(path string) ([]ConntrackStatEntry, error) {
- // This file is small and can be read with one syscall.
- b, err := util.ReadFileNoStat(path)
- if err != nil {
- // Do not wrap this error so the caller can detect os.IsNotExist and
- // similar conditions.
- return nil, err
- }
-
- stat, err := parseConntrackStat(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, path, err)
- }
-
- return stat, nil
-}
-
-// Reads the contents of a conntrack statistics file and parses a slice of ConntrackStatEntries.
-func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) {
- var entries []ConntrackStatEntry
-
- scanner := bufio.NewScanner(r)
- scanner.Scan()
- for scanner.Scan() {
- fields := strings.Fields(scanner.Text())
- conntrackEntry, err := parseConntrackStatEntry(fields)
- if err != nil {
- return nil, err
- }
- entries = append(entries, *conntrackEntry)
- }
-
- return entries, nil
-}
-
-// Parses a ConntrackStatEntry from given array of fields.
-func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) {
- entries, err := util.ParseHexUint64s(fields)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse entry: %d: %w", ErrFileParse, entries, err)
- }
- numEntries := len(entries)
- if numEntries < 16 || numEntries > 17 {
- return nil,
- fmt.Errorf("%w: invalid conntrackstat entry, invalid number of fields: %d", ErrFileParse, numEntries)
- }
-
- stats := &ConntrackStatEntry{
- Entries: *entries[0],
- Searched: *entries[1],
- Found: *entries[2],
- New: *entries[3],
- Invalid: *entries[4],
- Ignore: *entries[5],
- Delete: *entries[6],
- DeleteList: *entries[7],
- Insert: *entries[8],
- InsertFailed: *entries[9],
- Drop: *entries[10],
- EarlyDrop: *entries[11],
- }
-
- // Ignore missing search_restart on Linux < 2.6.35.
- if numEntries == 17 {
- stats.SearchRestart = *entries[16]
- }
-
- return stats, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go
deleted file mode 100644
index e66208a..0000000
--- a/vendor/github.com/prometheus/procfs/net_dev.go
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "os"
- "sort"
- "strconv"
- "strings"
-)
-
-// NetDevLine is single line parsed from /proc/net/dev or /proc/[pid]/net/dev.
-type NetDevLine struct {
- Name string `json:"name"` // The name of the interface.
- RxBytes uint64 `json:"rx_bytes"` // Cumulative count of bytes received.
- RxPackets uint64 `json:"rx_packets"` // Cumulative count of packets received.
- RxErrors uint64 `json:"rx_errors"` // Cumulative count of receive errors encountered.
- RxDropped uint64 `json:"rx_dropped"` // Cumulative count of packets dropped while receiving.
- RxFIFO uint64 `json:"rx_fifo"` // Cumulative count of FIFO buffer errors.
- RxFrame uint64 `json:"rx_frame"` // Cumulative count of packet framing errors.
- RxCompressed uint64 `json:"rx_compressed"` // Cumulative count of compressed packets received by the device driver.
- RxMulticast uint64 `json:"rx_multicast"` // Cumulative count of multicast frames received by the device driver.
- TxBytes uint64 `json:"tx_bytes"` // Cumulative count of bytes transmitted.
- TxPackets uint64 `json:"tx_packets"` // Cumulative count of packets transmitted.
- TxErrors uint64 `json:"tx_errors"` // Cumulative count of transmit errors encountered.
- TxDropped uint64 `json:"tx_dropped"` // Cumulative count of packets dropped while transmitting.
- TxFIFO uint64 `json:"tx_fifo"` // Cumulative count of FIFO buffer errors.
- TxCollisions uint64 `json:"tx_collisions"` // Cumulative count of collisions detected on the interface.
- TxCarrier uint64 `json:"tx_carrier"` // Cumulative count of carrier losses detected by the device driver.
- TxCompressed uint64 `json:"tx_compressed"` // Cumulative count of compressed packets transmitted by the device driver.
-}
-
-// NetDev is parsed from /proc/net/dev or /proc/[pid]/net/dev. The map keys
-// are interface names.
-type NetDev map[string]NetDevLine
-
-// NetDev returns kernel/system statistics read from /proc/net/dev.
-func (fs FS) NetDev() (NetDev, error) {
- return newNetDev(fs.proc.Path("net/dev"))
-}
-
-// NetDev returns kernel/system statistics read from /proc/[pid]/net/dev.
-func (p Proc) NetDev() (NetDev, error) {
- return newNetDev(p.path("net/dev"))
-}
-
-// newNetDev creates a new NetDev from the contents of the given file.
-func newNetDev(file string) (NetDev, error) {
- f, err := os.Open(file)
- if err != nil {
- return NetDev{}, err
- }
- defer f.Close()
-
- netDev := NetDev{}
- s := bufio.NewScanner(f)
- for n := 0; s.Scan(); n++ {
- // Skip the 2 header lines.
- if n < 2 {
- continue
- }
-
- line, err := netDev.parseLine(s.Text())
- if err != nil {
- return netDev, err
- }
-
- netDev[line.Name] = *line
- }
-
- return netDev, s.Err()
-}
-
-// parseLine parses a single line from the /proc/net/dev file. Header lines
-// must be filtered prior to calling this method.
-func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) {
- idx := strings.LastIndex(rawLine, ":")
- if idx == -1 {
- return nil, errors.New("invalid net/dev line, missing colon")
- }
- fields := strings.Fields(strings.TrimSpace(rawLine[idx+1:]))
-
- var err error
- line := &NetDevLine{}
-
- // Interface Name
- line.Name = strings.TrimSpace(rawLine[:idx])
- if line.Name == "" {
- return nil, errors.New("invalid net/dev line, empty interface name")
- }
-
- // RX
- line.RxBytes, err = strconv.ParseUint(fields[0], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxPackets, err = strconv.ParseUint(fields[1], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxErrors, err = strconv.ParseUint(fields[2], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxDropped, err = strconv.ParseUint(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxFIFO, err = strconv.ParseUint(fields[4], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxFrame, err = strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxCompressed, err = strconv.ParseUint(fields[6], 10, 64)
- if err != nil {
- return nil, err
- }
- line.RxMulticast, err = strconv.ParseUint(fields[7], 10, 64)
- if err != nil {
- return nil, err
- }
-
- // TX
- line.TxBytes, err = strconv.ParseUint(fields[8], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxPackets, err = strconv.ParseUint(fields[9], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxErrors, err = strconv.ParseUint(fields[10], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxDropped, err = strconv.ParseUint(fields[11], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxFIFO, err = strconv.ParseUint(fields[12], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCollisions, err = strconv.ParseUint(fields[13], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCarrier, err = strconv.ParseUint(fields[14], 10, 64)
- if err != nil {
- return nil, err
- }
- line.TxCompressed, err = strconv.ParseUint(fields[15], 10, 64)
- if err != nil {
- return nil, err
- }
-
- return line, nil
-}
-
-// Total aggregates the values across interfaces and returns a new NetDevLine.
-// The Name field will be a sorted comma separated list of interface names.
-func (netDev NetDev) Total() NetDevLine {
- total := NetDevLine{}
-
- names := make([]string, 0, len(netDev))
- for _, ifc := range netDev {
- names = append(names, ifc.Name)
- total.RxBytes += ifc.RxBytes
- total.RxPackets += ifc.RxPackets
- total.RxErrors += ifc.RxErrors
- total.RxDropped += ifc.RxDropped
- total.RxFIFO += ifc.RxFIFO
- total.RxFrame += ifc.RxFrame
- total.RxCompressed += ifc.RxCompressed
- total.RxMulticast += ifc.RxMulticast
- total.TxBytes += ifc.TxBytes
- total.TxPackets += ifc.TxPackets
- total.TxErrors += ifc.TxErrors
- total.TxDropped += ifc.TxDropped
- total.TxFIFO += ifc.TxFIFO
- total.TxCollisions += ifc.TxCollisions
- total.TxCarrier += ifc.TxCarrier
- total.TxCompressed += ifc.TxCompressed
- }
- sort.Strings(names)
- total.Name = strings.Join(names, ", ")
-
- return total
-}
diff --git a/vendor/github.com/prometheus/procfs/net_ip_socket.go b/vendor/github.com/prometheus/procfs/net_ip_socket.go
deleted file mode 100644
index 4da81ea..0000000
--- a/vendor/github.com/prometheus/procfs/net_ip_socket.go
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "encoding/hex"
- "fmt"
- "io"
- "net"
- "os"
- "strconv"
- "strings"
-)
-
-const (
- // readLimit is used by io.LimitReader while reading the content of the
- // /proc/net/udp{,6} files. The number of lines inside such a file is dynamic
- // as each line represents a single used socket.
- // In theory, the number of available sockets is 65535 (2^16 - 1) per IP.
- // With e.g. 150 Byte per line and the maximum number of 65535,
- // the reader needs to handle 150 Byte * 65535 =~ 10 MB for a single IP.
- readLimit = 4294967296 // Byte -> 4 GiB
-)
-
-// This contains generic data structures for both udp and tcp sockets.
-type (
- // NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header.
- NetIPSocket []*netIPSocketLine
-
- // NetIPSocketSummary provides already computed values like the total queue lengths or
- // the total number of used sockets. In contrast to NetIPSocket it does not collect
- // the parsed lines into a slice.
- NetIPSocketSummary struct {
- // TxQueueLength shows the total queue length of all parsed tx_queue lengths.
- TxQueueLength uint64
- // RxQueueLength shows the total queue length of all parsed rx_queue lengths.
- RxQueueLength uint64
- // UsedSockets shows the total number of parsed lines representing the
- // number of used sockets.
- UsedSockets uint64
- }
-
- // netIPSocketLine represents the fields parsed from a single line
- // in /proc/net/{t,u}dp{,6}. Fields which are not used by IPSocket are skipped.
- // For the proc file format details, see https://linux.die.net/man/5/proc.
- netIPSocketLine struct {
- Sl uint64
- LocalAddr net.IP
- LocalPort uint64
- RemAddr net.IP
- RemPort uint64
- St uint64
- TxQueue uint64
- RxQueue uint64
- UID uint64
- Inode uint64
- }
-)
-
-func newNetIPSocket(file string) (NetIPSocket, error) {
- f, err := os.Open(file)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- var netIPSocket NetIPSocket
-
- lr := io.LimitReader(f, readLimit)
- s := bufio.NewScanner(lr)
- s.Scan() // skip first line with headers
- for s.Scan() {
- fields := strings.Fields(s.Text())
- line, err := parseNetIPSocketLine(fields)
- if err != nil {
- return nil, err
- }
- netIPSocket = append(netIPSocket, line)
- }
- if err := s.Err(); err != nil {
- return nil, err
- }
- return netIPSocket, nil
-}
-
-// newNetIPSocketSummary creates a new NetIPSocket{,6} from the contents of the given file.
-func newNetIPSocketSummary(file string) (*NetIPSocketSummary, error) {
- f, err := os.Open(file)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- var netIPSocketSummary NetIPSocketSummary
-
- lr := io.LimitReader(f, readLimit)
- s := bufio.NewScanner(lr)
- s.Scan() // skip first line with headers
- for s.Scan() {
- fields := strings.Fields(s.Text())
- line, err := parseNetIPSocketLine(fields)
- if err != nil {
- return nil, err
- }
- netIPSocketSummary.TxQueueLength += line.TxQueue
- netIPSocketSummary.RxQueueLength += line.RxQueue
- netIPSocketSummary.UsedSockets++
- }
- if err := s.Err(); err != nil {
- return nil, err
- }
- return &netIPSocketSummary, nil
-}
-
-// the /proc/net/{t,u}dp{,6} files are network byte order for ipv4 and for ipv6 the address is four words consisting of four bytes each. In each of those four words the four bytes are written in reverse order.
-
-func parseIP(hexIP string) (net.IP, error) {
- var byteIP []byte
- byteIP, err := hex.DecodeString(hexIP)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse socket field in %q: %w", ErrFileParse, hexIP, err)
- }
- switch len(byteIP) {
- case 4:
- return net.IP{byteIP[3], byteIP[2], byteIP[1], byteIP[0]}, nil
- case 16:
- i := net.IP{
- byteIP[3], byteIP[2], byteIP[1], byteIP[0],
- byteIP[7], byteIP[6], byteIP[5], byteIP[4],
- byteIP[11], byteIP[10], byteIP[9], byteIP[8],
- byteIP[15], byteIP[14], byteIP[13], byteIP[12],
- }
- return i, nil
- default:
- return nil, fmt.Errorf("%s: Unable to parse IP %s: %w", ErrFileParse, hexIP, nil)
- }
-}
-
-// parseNetIPSocketLine parses a single line, represented by a list of fields.
-func parseNetIPSocketLine(fields []string) (*netIPSocketLine, error) {
- line := &netIPSocketLine{}
- if len(fields) < 10 {
- return nil, fmt.Errorf(
- "%w: Less than 10 columns found %q",
- ErrFileParse,
- strings.Join(fields, " "),
- )
- }
- var err error // parse error
-
- // sl
- s := strings.Split(fields[0], ":")
- if len(s) != 2 {
- return nil, fmt.Errorf("%w: Unable to parse sl field in line %q", ErrFileParse, fields[0])
- }
-
- if line.Sl, err = strconv.ParseUint(s[0], 0, 64); err != nil {
- return nil, fmt.Errorf("%s: Unable to parse sl field in %q: %w", ErrFileParse, line.Sl, err)
- }
- // local_address
- l := strings.Split(fields[1], ":")
- if len(l) != 2 {
- return nil, fmt.Errorf("%w: Unable to parse local_address field in %q", ErrFileParse, fields[1])
- }
- if line.LocalAddr, err = parseIP(l[0]); err != nil {
- return nil, err
- }
- if line.LocalPort, err = strconv.ParseUint(l[1], 16, 64); err != nil {
- return nil, fmt.Errorf("%s: Unable to parse local_address port value line %q: %w", ErrFileParse, line.LocalPort, err)
- }
-
- // remote_address
- r := strings.Split(fields[2], ":")
- if len(r) != 2 {
- return nil, fmt.Errorf("%w: Unable to parse rem_address field in %q", ErrFileParse, fields[1])
- }
- if line.RemAddr, err = parseIP(r[0]); err != nil {
- return nil, err
- }
- if line.RemPort, err = strconv.ParseUint(r[1], 16, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse rem_address port value in %q: %w", ErrFileParse, line.RemPort, err)
- }
-
- // st
- if line.St, err = strconv.ParseUint(fields[3], 16, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse st value in %q: %w", ErrFileParse, line.St, err)
- }
-
- // tx_queue and rx_queue
- q := strings.Split(fields[4], ":")
- if len(q) != 2 {
- return nil, fmt.Errorf(
- "%w: Missing colon for tx/rx queues in socket line %q",
- ErrFileParse,
- fields[4],
- )
- }
- if line.TxQueue, err = strconv.ParseUint(q[0], 16, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse tx_queue value in %q: %w", ErrFileParse, line.TxQueue, err)
- }
- if line.RxQueue, err = strconv.ParseUint(q[1], 16, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse trx_queue value in %q: %w", ErrFileParse, line.RxQueue, err)
- }
-
- // uid
- if line.UID, err = strconv.ParseUint(fields[7], 0, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse UID value in %q: %w", ErrFileParse, line.UID, err)
- }
-
- // inode
- if line.Inode, err = strconv.ParseUint(fields[9], 0, 64); err != nil {
- return nil, fmt.Errorf("%s: Cannot parse inode value in %q: %w", ErrFileParse, line.Inode, err)
- }
-
- return line, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_protocols.go b/vendor/github.com/prometheus/procfs/net_protocols.go
deleted file mode 100644
index b6c77b7..0000000
--- a/vendor/github.com/prometheus/procfs/net_protocols.go
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// NetProtocolStats stores the contents from /proc/net/protocols.
-type NetProtocolStats map[string]NetProtocolStatLine
-
-// NetProtocolStatLine contains a single line parsed from /proc/net/protocols. We
-// only care about the first six columns as the rest are not likely to change
-// and only serve to provide a set of capabilities for each protocol.
-type NetProtocolStatLine struct {
- Name string // 0 The name of the protocol
- Size uint64 // 1 The size, in bytes, of a given protocol structure. e.g. sizeof(struct tcp_sock) or sizeof(struct unix_sock)
- Sockets int64 // 2 Number of sockets in use by this protocol
- Memory int64 // 3 Number of 4KB pages allocated by all sockets of this protocol
- Pressure int // 4 This is either yes, no, or NI (not implemented). For the sake of simplicity we treat NI as not experiencing memory pressure.
- MaxHeader uint64 // 5 Protocol specific max header size
- Slab bool // 6 Indicates whether or not memory is allocated from the SLAB
- ModuleName string // 7 The name of the module that implemented this protocol or "kernel" if not from a module
- Capabilities NetProtocolCapabilities
-}
-
-// NetProtocolCapabilities contains a list of capabilities for each protocol.
-type NetProtocolCapabilities struct {
- Close bool // 8
- Connect bool // 9
- Disconnect bool // 10
- Accept bool // 11
- IoCtl bool // 12
- Init bool // 13
- Destroy bool // 14
- Shutdown bool // 15
- SetSockOpt bool // 16
- GetSockOpt bool // 17
- SendMsg bool // 18
- RecvMsg bool // 19
- SendPage bool // 20
- Bind bool // 21
- BacklogRcv bool // 22
- Hash bool // 23
- UnHash bool // 24
- GetPort bool // 25
- EnterMemoryPressure bool // 26
-}
-
-// NetProtocols reads stats from /proc/net/protocols and returns a map of
-// PortocolStatLine entries. As of this writing no official Linux Documentation
-// exists, however the source is fairly self-explanatory and the format seems
-// stable since its introduction in 2.6.12-rc2
-// Linux 2.6.12-rc2 - https://elixir.bootlin.com/linux/v2.6.12-rc2/source/net/core/sock.c#L1452
-// Linux 5.10 - https://elixir.bootlin.com/linux/v5.10.4/source/net/core/sock.c#L3586
-func (fs FS) NetProtocols() (NetProtocolStats, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("net/protocols"))
- if err != nil {
- return NetProtocolStats{}, err
- }
- return parseNetProtocols(bufio.NewScanner(bytes.NewReader(data)))
-}
-
-func parseNetProtocols(s *bufio.Scanner) (NetProtocolStats, error) {
- nps := NetProtocolStats{}
-
- // Skip the header line
- s.Scan()
-
- for s.Scan() {
- line, err := nps.parseLine(s.Text())
- if err != nil {
- return NetProtocolStats{}, err
- }
-
- nps[line.Name] = *line
- }
- return nps, nil
-}
-
-func (ps NetProtocolStats) parseLine(rawLine string) (*NetProtocolStatLine, error) {
- line := &NetProtocolStatLine{Capabilities: NetProtocolCapabilities{}}
- var err error
- const enabled = "yes"
- const disabled = "no"
-
- fields := strings.Fields(rawLine)
- line.Name = fields[0]
- line.Size, err = strconv.ParseUint(fields[1], 10, 64)
- if err != nil {
- return nil, err
- }
- line.Sockets, err = strconv.ParseInt(fields[2], 10, 64)
- if err != nil {
- return nil, err
- }
- line.Memory, err = strconv.ParseInt(fields[3], 10, 64)
- if err != nil {
- return nil, err
- }
- if fields[4] == enabled {
- line.Pressure = 1
- } else if fields[4] == disabled {
- line.Pressure = 0
- } else {
- line.Pressure = -1
- }
- line.MaxHeader, err = strconv.ParseUint(fields[5], 10, 64)
- if err != nil {
- return nil, err
- }
- if fields[6] == enabled {
- line.Slab = true
- } else if fields[6] == disabled {
- line.Slab = false
- } else {
- return nil, fmt.Errorf("%w: capability for protocol: %s", ErrFileParse, line.Name)
- }
- line.ModuleName = fields[7]
-
- err = line.Capabilities.parseCapabilities(fields[8:])
- if err != nil {
- return nil, err
- }
-
- return line, nil
-}
-
-func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) error {
- // The capabilities are all bools so we can loop over to map them
- capabilityFields := [...]*bool{
- &pc.Close,
- &pc.Connect,
- &pc.Disconnect,
- &pc.Accept,
- &pc.IoCtl,
- &pc.Init,
- &pc.Destroy,
- &pc.Shutdown,
- &pc.SetSockOpt,
- &pc.GetSockOpt,
- &pc.SendMsg,
- &pc.RecvMsg,
- &pc.SendPage,
- &pc.Bind,
- &pc.BacklogRcv,
- &pc.Hash,
- &pc.UnHash,
- &pc.GetPort,
- &pc.EnterMemoryPressure,
- }
-
- for i := 0; i < len(capabilities); i++ {
- if capabilities[i] == "y" {
- *capabilityFields[i] = true
- } else if capabilities[i] == "n" {
- *capabilityFields[i] = false
- } else {
- return fmt.Errorf("%w: capability block for protocol: position %d", ErrFileParse, i)
- }
- }
- return nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_route.go b/vendor/github.com/prometheus/procfs/net_route.go
deleted file mode 100644
index deb7029..0000000
--- a/vendor/github.com/prometheus/procfs/net_route.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2023 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-const (
- blackholeRepresentation string = "*"
- blackholeIfaceName string = "blackhole"
- routeLineColumns int = 11
-)
-
-// A NetRouteLine represents one line from net/route.
-type NetRouteLine struct {
- Iface string
- Destination uint32
- Gateway uint32
- Flags uint32
- RefCnt uint32
- Use uint32
- Metric uint32
- Mask uint32
- MTU uint32
- Window uint32
- IRTT uint32
-}
-
-func (fs FS) NetRoute() ([]NetRouteLine, error) {
- return readNetRoute(fs.proc.Path("net", "route"))
-}
-
-func readNetRoute(path string) ([]NetRouteLine, error) {
- b, err := util.ReadFileNoStat(path)
- if err != nil {
- return nil, err
- }
-
- routelines, err := parseNetRoute(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("failed to read net route from %s: %w", path, err)
- }
- return routelines, nil
-}
-
-func parseNetRoute(r io.Reader) ([]NetRouteLine, error) {
- var routelines []NetRouteLine
-
- scanner := bufio.NewScanner(r)
- scanner.Scan()
- for scanner.Scan() {
- fields := strings.Fields(scanner.Text())
- routeline, err := parseNetRouteLine(fields)
- if err != nil {
- return nil, err
- }
- routelines = append(routelines, *routeline)
- }
- return routelines, nil
-}
-
-func parseNetRouteLine(fields []string) (*NetRouteLine, error) {
- if len(fields) != routeLineColumns {
- return nil, fmt.Errorf("invalid routeline, num of digits: %d", len(fields))
- }
- iface := fields[0]
- if iface == blackholeRepresentation {
- iface = blackholeIfaceName
- }
- destination, err := strconv.ParseUint(fields[1], 16, 32)
- if err != nil {
- return nil, err
- }
- gateway, err := strconv.ParseUint(fields[2], 16, 32)
- if err != nil {
- return nil, err
- }
- flags, err := strconv.ParseUint(fields[3], 10, 32)
- if err != nil {
- return nil, err
- }
- refcnt, err := strconv.ParseUint(fields[4], 10, 32)
- if err != nil {
- return nil, err
- }
- use, err := strconv.ParseUint(fields[5], 10, 32)
- if err != nil {
- return nil, err
- }
- metric, err := strconv.ParseUint(fields[6], 10, 32)
- if err != nil {
- return nil, err
- }
- mask, err := strconv.ParseUint(fields[7], 16, 32)
- if err != nil {
- return nil, err
- }
- mtu, err := strconv.ParseUint(fields[8], 10, 32)
- if err != nil {
- return nil, err
- }
- window, err := strconv.ParseUint(fields[9], 10, 32)
- if err != nil {
- return nil, err
- }
- irtt, err := strconv.ParseUint(fields[10], 10, 32)
- if err != nil {
- return nil, err
- }
- routeline := &NetRouteLine{
- Iface: iface,
- Destination: uint32(destination),
- Gateway: uint32(gateway),
- Flags: uint32(flags),
- RefCnt: uint32(refcnt),
- Use: uint32(use),
- Metric: uint32(metric),
- Mask: uint32(mask),
- MTU: uint32(mtu),
- Window: uint32(window),
- IRTT: uint32(irtt),
- }
- return routeline, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_sockstat.go b/vendor/github.com/prometheus/procfs/net_sockstat.go
deleted file mode 100644
index 360e36a..0000000
--- a/vendor/github.com/prometheus/procfs/net_sockstat.go
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// A NetSockstat contains the output of /proc/net/sockstat{,6} for IPv4 or IPv6,
-// respectively.
-type NetSockstat struct {
- // Used is non-nil for IPv4 sockstat results, but nil for IPv6.
- Used *int
- Protocols []NetSockstatProtocol
-}
-
-// A NetSockstatProtocol contains statistics about a given socket protocol.
-// Pointer fields indicate that the value may or may not be present on any
-// given protocol.
-type NetSockstatProtocol struct {
- Protocol string
- InUse int
- Orphan *int
- TW *int
- Alloc *int
- Mem *int
- Memory *int
-}
-
-// NetSockstat retrieves IPv4 socket statistics.
-func (fs FS) NetSockstat() (*NetSockstat, error) {
- return readSockstat(fs.proc.Path("net", "sockstat"))
-}
-
-// NetSockstat6 retrieves IPv6 socket statistics.
-//
-// If IPv6 is disabled on this kernel, the returned error can be checked with
-// os.IsNotExist.
-func (fs FS) NetSockstat6() (*NetSockstat, error) {
- return readSockstat(fs.proc.Path("net", "sockstat6"))
-}
-
-// readSockstat opens and parses a NetSockstat from the input file.
-func readSockstat(name string) (*NetSockstat, error) {
- // This file is small and can be read with one syscall.
- b, err := util.ReadFileNoStat(name)
- if err != nil {
- // Do not wrap this error so the caller can detect os.IsNotExist and
- // similar conditions.
- return nil, err
- }
-
- stat, err := parseSockstat(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("%s: sockstats from %q: %w", ErrFileRead, name, err)
- }
-
- return stat, nil
-}
-
-// parseSockstat reads the contents of a sockstat file and parses a NetSockstat.
-func parseSockstat(r io.Reader) (*NetSockstat, error) {
- var stat NetSockstat
- s := bufio.NewScanner(r)
- for s.Scan() {
- // Expect a minimum of a protocol and one key/value pair.
- fields := strings.Split(s.Text(), " ")
- if len(fields) < 3 {
- return nil, fmt.Errorf("%w: Malformed sockstat line: %q", ErrFileParse, s.Text())
- }
-
- // The remaining fields are key/value pairs.
- kvs, err := parseSockstatKVs(fields[1:])
- if err != nil {
- return nil, fmt.Errorf("%s: sockstat key/value pairs from %q: %w", ErrFileParse, s.Text(), err)
- }
-
- // The first field is the protocol. We must trim its colon suffix.
- proto := strings.TrimSuffix(fields[0], ":")
- switch proto {
- case "sockets":
- // Special case: IPv4 has a sockets "used" key/value pair that we
- // embed at the top level of the structure.
- used := kvs["used"]
- stat.Used = &used
- default:
- // Parse all other lines as individual protocols.
- nsp := parseSockstatProtocol(kvs)
- nsp.Protocol = proto
- stat.Protocols = append(stat.Protocols, nsp)
- }
- }
-
- if err := s.Err(); err != nil {
- return nil, err
- }
-
- return &stat, nil
-}
-
-// parseSockstatKVs parses a string slice into a map of key/value pairs.
-func parseSockstatKVs(kvs []string) (map[string]int, error) {
- if len(kvs)%2 != 0 {
- return nil, fmt.Errorf("%w:: Odd number of fields in key/value pairs %q", ErrFileParse, kvs)
- }
-
- // Iterate two values at a time to gather key/value pairs.
- out := make(map[string]int, len(kvs)/2)
- for i := 0; i < len(kvs); i += 2 {
- vp := util.NewValueParser(kvs[i+1])
- out[kvs[i]] = vp.Int()
-
- if err := vp.Err(); err != nil {
- return nil, err
- }
- }
-
- return out, nil
-}
-
-// parseSockstatProtocol parses a NetSockstatProtocol from the input kvs map.
-func parseSockstatProtocol(kvs map[string]int) NetSockstatProtocol {
- var nsp NetSockstatProtocol
- for k, v := range kvs {
- // Capture the range variable to ensure we get unique pointers for
- // each of the optional fields.
- v := v
- switch k {
- case "inuse":
- nsp.InUse = v
- case "orphan":
- nsp.Orphan = &v
- case "tw":
- nsp.TW = &v
- case "alloc":
- nsp.Alloc = &v
- case "mem":
- nsp.Mem = &v
- case "memory":
- nsp.Memory = &v
- }
- }
-
- return nsp
-}
diff --git a/vendor/github.com/prometheus/procfs/net_softnet.go b/vendor/github.com/prometheus/procfs/net_softnet.go
deleted file mode 100644
index c770852..0000000
--- a/vendor/github.com/prometheus/procfs/net_softnet.go
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// For the proc file format details,
-// See:
-// * Linux 2.6.23 https://elixir.bootlin.com/linux/v2.6.23/source/net/core/dev.c#L2343
-// * Linux 2.6.39 https://elixir.bootlin.com/linux/v2.6.39/source/net/core/dev.c#L4086
-// * Linux 4.18 https://elixir.bootlin.com/linux/v4.18/source/net/core/net-procfs.c#L162
-// * Linux 5.14 https://elixir.bootlin.com/linux/v5.14/source/net/core/net-procfs.c#L169
-
-// SoftnetStat contains a single row of data from /proc/net/softnet_stat.
-type SoftnetStat struct {
- // Number of processed packets.
- Processed uint32
- // Number of dropped packets.
- Dropped uint32
- // Number of times processing packets ran out of quota.
- TimeSqueezed uint32
- // Number of collision occur while obtaining device lock while transmitting.
- CPUCollision uint32
- // Number of times cpu woken up received_rps.
- ReceivedRps uint32
- // number of times flow limit has been reached.
- FlowLimitCount uint32
- // Softnet backlog status.
- SoftnetBacklogLen uint32
- // CPU id owning this softnet_data.
- Index uint32
- // softnet_data's Width.
- Width int
-}
-
-var softNetProcFile = "net/softnet_stat"
-
-// NetSoftnetStat reads data from /proc/net/softnet_stat.
-func (fs FS) NetSoftnetStat() ([]SoftnetStat, error) {
- b, err := util.ReadFileNoStat(fs.proc.Path(softNetProcFile))
- if err != nil {
- return nil, err
- }
-
- entries, err := parseSoftnet(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("%s: /proc/net/softnet_stat: %w", ErrFileParse, err)
- }
-
- return entries, nil
-}
-
-func parseSoftnet(r io.Reader) ([]SoftnetStat, error) {
- const minColumns = 9
-
- s := bufio.NewScanner(r)
-
- var stats []SoftnetStat
- cpuIndex := 0
- for s.Scan() {
- columns := strings.Fields(s.Text())
- width := len(columns)
- softnetStat := SoftnetStat{}
-
- if width < minColumns {
- return nil, fmt.Errorf("%w: detected %d columns, but expected at least %d", ErrFileParse, width, minColumns)
- }
-
- // Linux 2.6.23 https://elixir.bootlin.com/linux/v2.6.23/source/net/core/dev.c#L2347
- if width >= minColumns {
- us, err := parseHexUint32s(columns[0:9])
- if err != nil {
- return nil, err
- }
-
- softnetStat.Processed = us[0]
- softnetStat.Dropped = us[1]
- softnetStat.TimeSqueezed = us[2]
- softnetStat.CPUCollision = us[8]
- }
-
- // Linux 2.6.39 https://elixir.bootlin.com/linux/v2.6.39/source/net/core/dev.c#L4086
- if width >= 10 {
- us, err := parseHexUint32s(columns[9:10])
- if err != nil {
- return nil, err
- }
-
- softnetStat.ReceivedRps = us[0]
- }
-
- // Linux 4.18 https://elixir.bootlin.com/linux/v4.18/source/net/core/net-procfs.c#L162
- if width >= 11 {
- us, err := parseHexUint32s(columns[10:11])
- if err != nil {
- return nil, err
- }
-
- softnetStat.FlowLimitCount = us[0]
- }
-
- // Linux 5.14 https://elixir.bootlin.com/linux/v5.14/source/net/core/net-procfs.c#L169
- if width >= 13 {
- us, err := parseHexUint32s(columns[11:13])
- if err != nil {
- return nil, err
- }
-
- softnetStat.SoftnetBacklogLen = us[0]
- softnetStat.Index = us[1]
- } else {
- // For older kernels, create the Index based on the scan line number.
- softnetStat.Index = uint32(cpuIndex)
- }
- softnetStat.Width = width
- stats = append(stats, softnetStat)
- cpuIndex++
- }
-
- return stats, nil
-}
-
-func parseHexUint32s(ss []string) ([]uint32, error) {
- us := make([]uint32, 0, len(ss))
- for _, s := range ss {
- u, err := strconv.ParseUint(s, 16, 32)
- if err != nil {
- return nil, err
- }
-
- us = append(us, uint32(u))
- }
-
- return us, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_tcp.go b/vendor/github.com/prometheus/procfs/net_tcp.go
deleted file mode 100644
index 5277629..0000000
--- a/vendor/github.com/prometheus/procfs/net_tcp.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-type (
- // NetTCP represents the contents of /proc/net/tcp{,6} file without the header.
- NetTCP []*netIPSocketLine
-
- // NetTCPSummary provides already computed values like the total queue lengths or
- // the total number of used sockets. In contrast to NetTCP it does not collect
- // the parsed lines into a slice.
- NetTCPSummary NetIPSocketSummary
-)
-
-// NetTCP returns the IPv4 kernel/networking statistics for TCP datagrams
-// read from /proc/net/tcp.
-func (fs FS) NetTCP() (NetTCP, error) {
- return newNetTCP(fs.proc.Path("net/tcp"))
-}
-
-// NetTCP6 returns the IPv6 kernel/networking statistics for TCP datagrams
-// read from /proc/net/tcp6.
-func (fs FS) NetTCP6() (NetTCP, error) {
- return newNetTCP(fs.proc.Path("net/tcp6"))
-}
-
-// NetTCPSummary returns already computed statistics like the total queue lengths
-// for TCP datagrams read from /proc/net/tcp.
-func (fs FS) NetTCPSummary() (*NetTCPSummary, error) {
- return newNetTCPSummary(fs.proc.Path("net/tcp"))
-}
-
-// NetTCP6Summary returns already computed statistics like the total queue lengths
-// for TCP datagrams read from /proc/net/tcp6.
-func (fs FS) NetTCP6Summary() (*NetTCPSummary, error) {
- return newNetTCPSummary(fs.proc.Path("net/tcp6"))
-}
-
-// newNetTCP creates a new NetTCP{,6} from the contents of the given file.
-func newNetTCP(file string) (NetTCP, error) {
- n, err := newNetIPSocket(file)
- n1 := NetTCP(n)
- return n1, err
-}
-
-func newNetTCPSummary(file string) (*NetTCPSummary, error) {
- n, err := newNetIPSocketSummary(file)
- if n == nil {
- return nil, err
- }
- n1 := NetTCPSummary(*n)
- return &n1, err
-}
diff --git a/vendor/github.com/prometheus/procfs/net_udp.go b/vendor/github.com/prometheus/procfs/net_udp.go
deleted file mode 100644
index 9ac3daf..0000000
--- a/vendor/github.com/prometheus/procfs/net_udp.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-type (
- // NetUDP represents the contents of /proc/net/udp{,6} file without the header.
- NetUDP []*netIPSocketLine
-
- // NetUDPSummary provides already computed values like the total queue lengths or
- // the total number of used sockets. In contrast to NetUDP it does not collect
- // the parsed lines into a slice.
- NetUDPSummary NetIPSocketSummary
-)
-
-// NetUDP returns the IPv4 kernel/networking statistics for UDP datagrams
-// read from /proc/net/udp.
-func (fs FS) NetUDP() (NetUDP, error) {
- return newNetUDP(fs.proc.Path("net/udp"))
-}
-
-// NetUDP6 returns the IPv6 kernel/networking statistics for UDP datagrams
-// read from /proc/net/udp6.
-func (fs FS) NetUDP6() (NetUDP, error) {
- return newNetUDP(fs.proc.Path("net/udp6"))
-}
-
-// NetUDPSummary returns already computed statistics like the total queue lengths
-// for UDP datagrams read from /proc/net/udp.
-func (fs FS) NetUDPSummary() (*NetUDPSummary, error) {
- return newNetUDPSummary(fs.proc.Path("net/udp"))
-}
-
-// NetUDP6Summary returns already computed statistics like the total queue lengths
-// for UDP datagrams read from /proc/net/udp6.
-func (fs FS) NetUDP6Summary() (*NetUDPSummary, error) {
- return newNetUDPSummary(fs.proc.Path("net/udp6"))
-}
-
-// newNetUDP creates a new NetUDP{,6} from the contents of the given file.
-func newNetUDP(file string) (NetUDP, error) {
- n, err := newNetIPSocket(file)
- n1 := NetUDP(n)
- return n1, err
-}
-
-func newNetUDPSummary(file string) (*NetUDPSummary, error) {
- n, err := newNetIPSocketSummary(file)
- if n == nil {
- return nil, err
- }
- n1 := NetUDPSummary(*n)
- return &n1, err
-}
diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go
deleted file mode 100644
index acbbc57..0000000
--- a/vendor/github.com/prometheus/procfs/net_unix.go
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
-)
-
-// For the proc file format details,
-// see https://elixir.bootlin.com/linux/v4.17/source/net/unix/af_unix.c#L2815
-// and https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h#L48.
-
-// Constants for the various /proc/net/unix enumerations.
-// TODO: match against x/sys/unix or similar?
-const (
- netUnixTypeStream = 1
- netUnixTypeDgram = 2
- netUnixTypeSeqpacket = 5
-
- netUnixFlagDefault = 0
- netUnixFlagListen = 1 << 16
-
- netUnixStateUnconnected = 1
- netUnixStateConnecting = 2
- netUnixStateConnected = 3
- netUnixStateDisconnected = 4
-)
-
-// NetUNIXType is the type of the type field.
-type NetUNIXType uint64
-
-// NetUNIXFlags is the type of the flags field.
-type NetUNIXFlags uint64
-
-// NetUNIXState is the type of the state field.
-type NetUNIXState uint64
-
-// NetUNIXLine represents a line of /proc/net/unix.
-type NetUNIXLine struct {
- KernelPtr string
- RefCount uint64
- Protocol uint64
- Flags NetUNIXFlags
- Type NetUNIXType
- State NetUNIXState
- Inode uint64
- Path string
-}
-
-// NetUNIX holds the data read from /proc/net/unix.
-type NetUNIX struct {
- Rows []*NetUNIXLine
-}
-
-// NetUNIX returns data read from /proc/net/unix.
-func (fs FS) NetUNIX() (*NetUNIX, error) {
- return readNetUNIX(fs.proc.Path("net/unix"))
-}
-
-// readNetUNIX reads data in /proc/net/unix format from the specified file.
-func readNetUNIX(file string) (*NetUNIX, error) {
- // This file could be quite large and a streaming read is desirable versus
- // reading the entire contents at once.
- f, err := os.Open(file)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- return parseNetUNIX(f)
-}
-
-// parseNetUNIX creates a NetUnix structure from the incoming stream.
-func parseNetUNIX(r io.Reader) (*NetUNIX, error) {
- // Begin scanning by checking for the existence of Inode.
- s := bufio.NewScanner(r)
- s.Scan()
-
- // From the man page of proc(5), it does not contain an Inode field,
- // but in actually it exists. This code works for both cases.
- hasInode := strings.Contains(s.Text(), "Inode")
-
- // Expect a minimum number of fields, but Inode and Path are optional:
- // Num RefCount Protocol Flags Type St Inode Path
- minFields := 6
- if hasInode {
- minFields++
- }
-
- var nu NetUNIX
- for s.Scan() {
- line := s.Text()
- item, err := nu.parseLine(line, hasInode, minFields)
- if err != nil {
- return nil, fmt.Errorf("%s: /proc/net/unix encountered data %q: %w", ErrFileParse, line, err)
- }
-
- nu.Rows = append(nu.Rows, item)
- }
-
- if err := s.Err(); err != nil {
- return nil, fmt.Errorf("%s: /proc/net/unix encountered data: %w", ErrFileParse, err)
- }
-
- return &nu, nil
-}
-
-func (u *NetUNIX) parseLine(line string, hasInode bool, min int) (*NetUNIXLine, error) {
- fields := strings.Fields(line)
-
- l := len(fields)
- if l < min {
- return nil, fmt.Errorf("%w: expected at least %d fields but got %d", ErrFileParse, min, l)
- }
-
- // Field offsets are as follows:
- // Num RefCount Protocol Flags Type St Inode Path
-
- kernelPtr := strings.TrimSuffix(fields[0], ":")
-
- users, err := u.parseUsers(fields[1])
- if err != nil {
- return nil, fmt.Errorf("%s: ref count %q: %w", ErrFileParse, fields[1], err)
- }
-
- flags, err := u.parseFlags(fields[3])
- if err != nil {
- return nil, fmt.Errorf("%s: Unable to parse flags %q: %w", ErrFileParse, fields[3], err)
- }
-
- typ, err := u.parseType(fields[4])
- if err != nil {
- return nil, fmt.Errorf("%s: Failed to parse type %q: %w", ErrFileParse, fields[4], err)
- }
-
- state, err := u.parseState(fields[5])
- if err != nil {
- return nil, fmt.Errorf("%s: Failed to parse state %q: %w", ErrFileParse, fields[5], err)
- }
-
- var inode uint64
- if hasInode {
- inode, err = u.parseInode(fields[6])
- if err != nil {
- return nil, fmt.Errorf("%s failed to parse inode %q: %w", ErrFileParse, fields[6], err)
- }
- }
-
- n := &NetUNIXLine{
- KernelPtr: kernelPtr,
- RefCount: users,
- Type: typ,
- Flags: flags,
- State: state,
- Inode: inode,
- }
-
- // Path field is optional.
- if l > min {
- // Path occurs at either index 6 or 7 depending on whether inode is
- // already present.
- pathIdx := 7
- if !hasInode {
- pathIdx--
- }
-
- n.Path = fields[pathIdx]
- }
-
- return n, nil
-}
-
-func (u NetUNIX) parseUsers(s string) (uint64, error) {
- return strconv.ParseUint(s, 16, 32)
-}
-
-func (u NetUNIX) parseType(s string) (NetUNIXType, error) {
- typ, err := strconv.ParseUint(s, 16, 16)
- if err != nil {
- return 0, err
- }
-
- return NetUNIXType(typ), nil
-}
-
-func (u NetUNIX) parseFlags(s string) (NetUNIXFlags, error) {
- flags, err := strconv.ParseUint(s, 16, 32)
- if err != nil {
- return 0, err
- }
-
- return NetUNIXFlags(flags), nil
-}
-
-func (u NetUNIX) parseState(s string) (NetUNIXState, error) {
- st, err := strconv.ParseInt(s, 16, 8)
- if err != nil {
- return 0, err
- }
-
- return NetUNIXState(st), nil
-}
-
-func (u NetUNIX) parseInode(s string) (uint64, error) {
- return strconv.ParseUint(s, 10, 64)
-}
-
-func (t NetUNIXType) String() string {
- switch t {
- case netUnixTypeStream:
- return "stream"
- case netUnixTypeDgram:
- return "dgram"
- case netUnixTypeSeqpacket:
- return "seqpacket"
- }
- return "unknown"
-}
-
-func (f NetUNIXFlags) String() string {
- switch f {
- case netUnixFlagListen:
- return "listen"
- default:
- return "default"
- }
-}
-
-func (s NetUNIXState) String() string {
- switch s {
- case netUnixStateUnconnected:
- return "unconnected"
- case netUnixStateConnecting:
- return "connecting"
- case netUnixStateConnected:
- return "connected"
- case netUnixStateDisconnected:
- return "disconnected"
- }
- return "unknown"
-}
diff --git a/vendor/github.com/prometheus/procfs/net_wireless.go b/vendor/github.com/prometheus/procfs/net_wireless.go
deleted file mode 100644
index 7443edc..0000000
--- a/vendor/github.com/prometheus/procfs/net_wireless.go
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2023 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Wireless models the content of /proc/net/wireless.
-type Wireless struct {
- Name string
-
- // Status is the current 4-digit hex value status of the interface.
- Status uint64
-
- // QualityLink is the link quality.
- QualityLink int
-
- // QualityLevel is the signal gain (dBm).
- QualityLevel int
-
- // QualityNoise is the signal noise baseline (dBm).
- QualityNoise int
-
- // DiscardedNwid is the number of discarded packets with wrong nwid/essid.
- DiscardedNwid int
-
- // DiscardedCrypt is the number of discarded packets with wrong code/decode (WEP).
- DiscardedCrypt int
-
- // DiscardedFrag is the number of discarded packets that can't perform MAC reassembly.
- DiscardedFrag int
-
- // DiscardedRetry is the number of discarded packets that reached max MAC retries.
- DiscardedRetry int
-
- // DiscardedMisc is the number of discarded packets for other reasons.
- DiscardedMisc int
-
- // MissedBeacon is the number of missed beacons/superframe.
- MissedBeacon int
-}
-
-// Wireless returns kernel wireless statistics.
-func (fs FS) Wireless() ([]*Wireless, error) {
- b, err := util.ReadFileNoStat(fs.proc.Path("net/wireless"))
- if err != nil {
- return nil, err
- }
-
- m, err := parseWireless(bytes.NewReader(b))
- if err != nil {
- return nil, fmt.Errorf("%s: wireless: %w", ErrFileParse, err)
- }
-
- return m, nil
-}
-
-// parseWireless parses the contents of /proc/net/wireless.
-/*
-Inter-| sta-| Quality | Discarded packets | Missed | WE
-face | tus | link level noise | nwid crypt frag retry misc | beacon | 22
- eth1: 0000 5. -256. -10. 0 1 0 3 0 0
- eth2: 0000 5. -256. -20. 0 2 0 4 0 0
-*/
-func parseWireless(r io.Reader) ([]*Wireless, error) {
- var (
- interfaces []*Wireless
- scanner = bufio.NewScanner(r)
- )
-
- for n := 0; scanner.Scan(); n++ {
- // Skip the 2 header lines.
- if n < 2 {
- continue
- }
-
- line := scanner.Text()
-
- parts := strings.Split(line, ":")
- if len(parts) != 2 {
- return nil, fmt.Errorf("%w: expected 2 parts after splitting line by ':', got %d for line %q", ErrFileParse, len(parts), line)
- }
-
- name := strings.TrimSpace(parts[0])
- stats := strings.Fields(parts[1])
-
- if len(stats) < 10 {
- return nil, fmt.Errorf("%w: invalid number of fields in line %d, expected 10+, got %d: %q", ErrFileParse, n, len(stats), line)
- }
-
- status, err := strconv.ParseUint(stats[0], 16, 16)
- if err != nil {
- return nil, fmt.Errorf("%w: invalid status in line %d: %q", ErrFileParse, n, line)
- }
-
- qlink, err := strconv.Atoi(strings.TrimSuffix(stats[1], "."))
- if err != nil {
- return nil, fmt.Errorf("%s: parse Quality:link as integer %q: %w", ErrFileParse, qlink, err)
- }
-
- qlevel, err := strconv.Atoi(strings.TrimSuffix(stats[2], "."))
- if err != nil {
- return nil, fmt.Errorf("%s: Quality:level as integer %q: %w", ErrFileParse, qlevel, err)
- }
-
- qnoise, err := strconv.Atoi(strings.TrimSuffix(stats[3], "."))
- if err != nil {
- return nil, fmt.Errorf("%s: Quality:noise as integer %q: %w", ErrFileParse, qnoise, err)
- }
-
- dnwid, err := strconv.Atoi(stats[4])
- if err != nil {
- return nil, fmt.Errorf("%s: Discarded:nwid as integer %q: %w", ErrFileParse, dnwid, err)
- }
-
- dcrypt, err := strconv.Atoi(stats[5])
- if err != nil {
- return nil, fmt.Errorf("%s: Discarded:crypt as integer %q: %w", ErrFileParse, dcrypt, err)
- }
-
- dfrag, err := strconv.Atoi(stats[6])
- if err != nil {
- return nil, fmt.Errorf("%s: Discarded:frag as integer %q: %w", ErrFileParse, dfrag, err)
- }
-
- dretry, err := strconv.Atoi(stats[7])
- if err != nil {
- return nil, fmt.Errorf("%s: Discarded:retry as integer %q: %w", ErrFileParse, dretry, err)
- }
-
- dmisc, err := strconv.Atoi(stats[8])
- if err != nil {
- return nil, fmt.Errorf("%s: Discarded:misc as integer %q: %w", ErrFileParse, dmisc, err)
- }
-
- mbeacon, err := strconv.Atoi(stats[9])
- if err != nil {
- return nil, fmt.Errorf("%s: Missed:beacon as integer %q: %w", ErrFileParse, mbeacon, err)
- }
-
- w := &Wireless{
- Name: name,
- Status: status,
- QualityLink: qlink,
- QualityLevel: qlevel,
- QualityNoise: qnoise,
- DiscardedNwid: dnwid,
- DiscardedCrypt: dcrypt,
- DiscardedFrag: dfrag,
- DiscardedRetry: dretry,
- DiscardedMisc: dmisc,
- MissedBeacon: mbeacon,
- }
-
- interfaces = append(interfaces, w)
- }
-
- if err := scanner.Err(); err != nil {
- return nil, fmt.Errorf("%s: Failed to scan /proc/net/wireless: %w", ErrFileRead, err)
- }
-
- return interfaces, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/net_xfrm.go b/vendor/github.com/prometheus/procfs/net_xfrm.go
deleted file mode 100644
index 932ef20..0000000
--- a/vendor/github.com/prometheus/procfs/net_xfrm.go
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright 2017 Prometheus Team
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- "strings"
-)
-
-// XfrmStat models the contents of /proc/net/xfrm_stat.
-type XfrmStat struct {
- // All errors which are not matched by other
- XfrmInError int
- // No buffer is left
- XfrmInBufferError int
- // Header Error
- XfrmInHdrError int
- // No state found
- // i.e. either inbound SPI, address, or IPSEC protocol at SA is wrong
- XfrmInNoStates int
- // Transformation protocol specific error
- // e.g. SA Key is wrong
- XfrmInStateProtoError int
- // Transformation mode specific error
- XfrmInStateModeError int
- // Sequence error
- // e.g. sequence number is out of window
- XfrmInStateSeqError int
- // State is expired
- XfrmInStateExpired int
- // State has mismatch option
- // e.g. UDP encapsulation type is mismatched
- XfrmInStateMismatch int
- // State is invalid
- XfrmInStateInvalid int
- // No matching template for states
- // e.g. Inbound SAs are correct but SP rule is wrong
- XfrmInTmplMismatch int
- // No policy is found for states
- // e.g. Inbound SAs are correct but no SP is found
- XfrmInNoPols int
- // Policy discards
- XfrmInPolBlock int
- // Policy error
- XfrmInPolError int
- // All errors which are not matched by others
- XfrmOutError int
- // Bundle generation error
- XfrmOutBundleGenError int
- // Bundle check error
- XfrmOutBundleCheckError int
- // No state was found
- XfrmOutNoStates int
- // Transformation protocol specific error
- XfrmOutStateProtoError int
- // Transportation mode specific error
- XfrmOutStateModeError int
- // Sequence error
- // i.e sequence number overflow
- XfrmOutStateSeqError int
- // State is expired
- XfrmOutStateExpired int
- // Policy discads
- XfrmOutPolBlock int
- // Policy is dead
- XfrmOutPolDead int
- // Policy Error
- XfrmOutPolError int
- // Forward routing of a packet is not allowed
- XfrmFwdHdrError int
- // State is invalid, perhaps expired
- XfrmOutStateInvalid int
- // State hasn’t been fully acquired before use
- XfrmAcquireError int
-}
-
-// NewXfrmStat reads the xfrm_stat statistics.
-func NewXfrmStat() (XfrmStat, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return XfrmStat{}, err
- }
-
- return fs.NewXfrmStat()
-}
-
-// NewXfrmStat reads the xfrm_stat statistics from the 'proc' filesystem.
-func (fs FS) NewXfrmStat() (XfrmStat, error) {
- file, err := os.Open(fs.proc.Path("net/xfrm_stat"))
- if err != nil {
- return XfrmStat{}, err
- }
- defer file.Close()
-
- var (
- x = XfrmStat{}
- s = bufio.NewScanner(file)
- )
-
- for s.Scan() {
- fields := strings.Fields(s.Text())
-
- if len(fields) != 2 {
- return XfrmStat{}, fmt.Errorf("%w: %q line %q", ErrFileParse, file.Name(), s.Text())
- }
-
- name := fields[0]
- value, err := strconv.Atoi(fields[1])
- if err != nil {
- return XfrmStat{}, err
- }
-
- switch name {
- case "XfrmInError":
- x.XfrmInError = value
- case "XfrmInBufferError":
- x.XfrmInBufferError = value
- case "XfrmInHdrError":
- x.XfrmInHdrError = value
- case "XfrmInNoStates":
- x.XfrmInNoStates = value
- case "XfrmInStateProtoError":
- x.XfrmInStateProtoError = value
- case "XfrmInStateModeError":
- x.XfrmInStateModeError = value
- case "XfrmInStateSeqError":
- x.XfrmInStateSeqError = value
- case "XfrmInStateExpired":
- x.XfrmInStateExpired = value
- case "XfrmInStateInvalid":
- x.XfrmInStateInvalid = value
- case "XfrmInTmplMismatch":
- x.XfrmInTmplMismatch = value
- case "XfrmInNoPols":
- x.XfrmInNoPols = value
- case "XfrmInPolBlock":
- x.XfrmInPolBlock = value
- case "XfrmInPolError":
- x.XfrmInPolError = value
- case "XfrmOutError":
- x.XfrmOutError = value
- case "XfrmInStateMismatch":
- x.XfrmInStateMismatch = value
- case "XfrmOutBundleGenError":
- x.XfrmOutBundleGenError = value
- case "XfrmOutBundleCheckError":
- x.XfrmOutBundleCheckError = value
- case "XfrmOutNoStates":
- x.XfrmOutNoStates = value
- case "XfrmOutStateProtoError":
- x.XfrmOutStateProtoError = value
- case "XfrmOutStateModeError":
- x.XfrmOutStateModeError = value
- case "XfrmOutStateSeqError":
- x.XfrmOutStateSeqError = value
- case "XfrmOutStateExpired":
- x.XfrmOutStateExpired = value
- case "XfrmOutPolBlock":
- x.XfrmOutPolBlock = value
- case "XfrmOutPolDead":
- x.XfrmOutPolDead = value
- case "XfrmOutPolError":
- x.XfrmOutPolError = value
- case "XfrmFwdHdrError":
- x.XfrmFwdHdrError = value
- case "XfrmOutStateInvalid":
- x.XfrmOutStateInvalid = value
- case "XfrmAcquireError":
- x.XfrmAcquireError = value
- }
-
- }
-
- return x, s.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/netstat.go b/vendor/github.com/prometheus/procfs/netstat.go
deleted file mode 100644
index 742dff4..0000000
--- a/vendor/github.com/prometheus/procfs/netstat.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "os"
- "path/filepath"
- "strconv"
- "strings"
-)
-
-// NetStat contains statistics for all the counters from one file.
-type NetStat struct {
- Stats map[string][]uint64
- Filename string
-}
-
-// NetStat retrieves stats from `/proc/net/stat/`.
-func (fs FS) NetStat() ([]NetStat, error) {
- statFiles, err := filepath.Glob(fs.proc.Path("net/stat/*"))
- if err != nil {
- return nil, err
- }
-
- var netStatsTotal []NetStat
-
- for _, filePath := range statFiles {
- procNetstat, err := parseNetstat(filePath)
- if err != nil {
- return nil, err
- }
- procNetstat.Filename = filepath.Base(filePath)
-
- netStatsTotal = append(netStatsTotal, procNetstat)
- }
- return netStatsTotal, nil
-}
-
-// parseNetstat parses the metrics from `/proc/net/stat/` file
-// and returns a NetStat structure.
-func parseNetstat(filePath string) (NetStat, error) {
- netStat := NetStat{
- Stats: make(map[string][]uint64),
- }
- file, err := os.Open(filePath)
- if err != nil {
- return netStat, err
- }
- defer file.Close()
-
- scanner := bufio.NewScanner(file)
- scanner.Scan()
-
- // First string is always a header for stats
- var headers []string
- headers = append(headers, strings.Fields(scanner.Text())...)
-
- // Other strings represent per-CPU counters
- for scanner.Scan() {
- for num, counter := range strings.Fields(scanner.Text()) {
- value, err := strconv.ParseUint(counter, 16, 64)
- if err != nil {
- return NetStat{}, err
- }
- netStat.Stats[headers[num]] = append(netStat.Stats[headers[num]], value)
- }
- }
-
- return netStat, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go
deleted file mode 100644
index d1f71ca..0000000
--- a/vendor/github.com/prometheus/procfs/proc.go
+++ /dev/null
@@ -1,338 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "errors"
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Proc provides information about a running process.
-type Proc struct {
- // The process ID.
- PID int
-
- fs FS
-}
-
-// Procs represents a list of Proc structs.
-type Procs []Proc
-
-var (
- ErrFileParse = errors.New("Error Parsing File")
- ErrFileRead = errors.New("Error Reading File")
- ErrMountPoint = errors.New("Error Accessing Mount point")
-)
-
-func (p Procs) Len() int { return len(p) }
-func (p Procs) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID }
-
-// Self returns a process for the current process read via /proc/self.
-func Self() (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil || errors.Unwrap(err) == ErrMountPoint {
- return Proc{}, err
- }
- return fs.Self()
-}
-
-// NewProc returns a process for the given pid under /proc.
-func NewProc(pid int) (Proc, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Proc{}, err
- }
- return fs.Proc(pid)
-}
-
-// AllProcs returns a list of all currently available processes under /proc.
-func AllProcs() (Procs, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Procs{}, err
- }
- return fs.AllProcs()
-}
-
-// Self returns a process for the current process.
-func (fs FS) Self() (Proc, error) {
- p, err := os.Readlink(fs.proc.Path("self"))
- if err != nil {
- return Proc{}, err
- }
- pid, err := strconv.Atoi(strings.Replace(p, string(fs.proc), "", -1))
- if err != nil {
- return Proc{}, err
- }
- return fs.Proc(pid)
-}
-
-// NewProc returns a process for the given pid.
-//
-// Deprecated: Use fs.Proc() instead.
-func (fs FS) NewProc(pid int) (Proc, error) {
- return fs.Proc(pid)
-}
-
-// Proc returns a process for the given pid.
-func (fs FS) Proc(pid int) (Proc, error) {
- if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil {
- return Proc{}, err
- }
- return Proc{PID: pid, fs: fs}, nil
-}
-
-// AllProcs returns a list of all currently available processes.
-func (fs FS) AllProcs() (Procs, error) {
- d, err := os.Open(fs.proc.Path())
- if err != nil {
- return Procs{}, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return Procs{}, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, names, err)
- }
-
- p := Procs{}
- for _, n := range names {
- pid, err := strconv.ParseInt(n, 10, 64)
- if err != nil {
- continue
- }
- p = append(p, Proc{PID: int(pid), fs: fs})
- }
-
- return p, nil
-}
-
-// CmdLine returns the command line of a process.
-func (p Proc) CmdLine() ([]string, error) {
- data, err := util.ReadFileNoStat(p.path("cmdline"))
- if err != nil {
- return nil, err
- }
-
- if len(data) < 1 {
- return []string{}, nil
- }
-
- return strings.Split(string(bytes.TrimRight(data, string("\x00"))), string(byte(0))), nil
-}
-
-// Wchan returns the wchan (wait channel) of a process.
-func (p Proc) Wchan() (string, error) {
- f, err := os.Open(p.path("wchan"))
- if err != nil {
- return "", err
- }
- defer f.Close()
-
- data, err := io.ReadAll(f)
- if err != nil {
- return "", err
- }
-
- wchan := string(data)
- if wchan == "" || wchan == "0" {
- return "", nil
- }
-
- return wchan, nil
-}
-
-// Comm returns the command name of a process.
-func (p Proc) Comm() (string, error) {
- data, err := util.ReadFileNoStat(p.path("comm"))
- if err != nil {
- return "", err
- }
-
- return strings.TrimSpace(string(data)), nil
-}
-
-// Executable returns the absolute path of the executable command of a process.
-func (p Proc) Executable() (string, error) {
- exe, err := os.Readlink(p.path("exe"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return exe, err
-}
-
-// Cwd returns the absolute path to the current working directory of the process.
-func (p Proc) Cwd() (string, error) {
- wd, err := os.Readlink(p.path("cwd"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return wd, err
-}
-
-// RootDir returns the absolute path to the process's root directory (as set by chroot).
-func (p Proc) RootDir() (string, error) {
- rdir, err := os.Readlink(p.path("root"))
- if os.IsNotExist(err) {
- return "", nil
- }
-
- return rdir, err
-}
-
-// FileDescriptors returns the currently open file descriptors of a process.
-func (p Proc) FileDescriptors() ([]uintptr, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- fds := make([]uintptr, len(names))
- for i, n := range names {
- fd, err := strconv.ParseInt(n, 10, 32)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot parse line: %v: %w", ErrFileParse, i, err)
- }
- fds[i] = uintptr(fd)
- }
-
- return fds, nil
-}
-
-// FileDescriptorTargets returns the targets of all file descriptors of a process.
-// If a file descriptor is not a symlink to a file (like a socket), that value will be the empty string.
-func (p Proc) FileDescriptorTargets() ([]string, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- targets := make([]string, len(names))
-
- for i, name := range names {
- target, err := os.Readlink(p.path("fd", name))
- if err == nil {
- targets[i] = target
- }
- }
-
- return targets, nil
-}
-
-// FileDescriptorsLen returns the number of currently open file descriptors of
-// a process.
-func (p Proc) FileDescriptorsLen() (int, error) {
- // Use fast path if available (Linux v6.2): https://github.com/torvalds/linux/commit/f1f1f2569901
- if p.fs.isReal {
- stat, err := os.Stat(p.path("fd"))
- if err != nil {
- return 0, err
- }
-
- size := stat.Size()
- if size > 0 {
- return int(size), nil
- }
- }
-
- fds, err := p.fileDescriptors()
- if err != nil {
- return 0, err
- }
-
- return len(fds), nil
-}
-
-// MountStats retrieves statistics and configuration for mount points in a
-// process's namespace.
-func (p Proc) MountStats() ([]*Mount, error) {
- f, err := os.Open(p.path("mountstats"))
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- return parseMountStats(f)
-}
-
-// MountInfo retrieves mount information for mount points in a
-// process's namespace.
-// It supplies information missing in `/proc/self/mounts` and
-// fixes various other problems with that file too.
-func (p Proc) MountInfo() ([]*MountInfo, error) {
- data, err := util.ReadFileNoStat(p.path("mountinfo"))
- if err != nil {
- return nil, err
- }
- return parseMountInfo(data)
-}
-
-func (p Proc) fileDescriptors() ([]string, error) {
- d, err := os.Open(p.path("fd"))
- if err != nil {
- return nil, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return nil, fmt.Errorf("%s: Cannot read file: %v: %w", ErrFileRead, names, err)
- }
-
- return names, nil
-}
-
-func (p Proc) path(pa ...string) string {
- return p.fs.proc.Path(append([]string{strconv.Itoa(p.PID)}, pa...)...)
-}
-
-// FileDescriptorsInfo retrieves information about all file descriptors of
-// the process.
-func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error) {
- names, err := p.fileDescriptors()
- if err != nil {
- return nil, err
- }
-
- var fdinfos ProcFDInfos
-
- for _, n := range names {
- fdinfo, err := p.FDInfo(n)
- if err != nil {
- continue
- }
- fdinfos = append(fdinfos, *fdinfo)
- }
-
- return fdinfos, nil
-}
-
-// Schedstat returns task scheduling information for the process.
-func (p Proc) Schedstat() (ProcSchedstat, error) {
- contents, err := os.ReadFile(p.path("schedstat"))
- if err != nil {
- return ProcSchedstat{}, err
- }
- return parseProcSchedstat(string(contents))
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_cgroup.go b/vendor/github.com/prometheus/procfs/proc_cgroup.go
deleted file mode 100644
index daeed7f..0000000
--- a/vendor/github.com/prometheus/procfs/proc_cgroup.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Cgroup models one line from /proc/[pid]/cgroup. Each Cgroup struct describes the placement of a PID inside a
-// specific control hierarchy. The kernel has two cgroup APIs, v1 and v2. v1 has one hierarchy per available resource
-// controller, while v2 has one unified hierarchy shared by all controllers. Regardless of v1 or v2, all hierarchies
-// contain all running processes, so the question answerable with a Cgroup struct is 'where is this process in
-// this hierarchy' (where==what path on the specific cgroupfs). By prefixing this path with the mount point of
-// *this specific* hierarchy, you can locate the relevant pseudo-files needed to read/set the data for this PID
-// in this hierarchy
-//
-// Also see http://man7.org/linux/man-pages/man7/cgroups.7.html
-type Cgroup struct {
- // HierarchyID that can be matched to a named hierarchy using /proc/cgroups. Cgroups V2 only has one
- // hierarchy, so HierarchyID is always 0. For cgroups v1 this is a unique ID number
- HierarchyID int
- // Controllers using this hierarchy of processes. Controllers are also known as subsystems. For
- // Cgroups V2 this may be empty, as all active controllers use the same hierarchy
- Controllers []string
- // Path of this control group, relative to the mount point of the cgroupfs representing this specific
- // hierarchy
- Path string
-}
-
-// parseCgroupString parses each line of the /proc/[pid]/cgroup file
-// Line format is hierarchyID:[controller1,controller2]:path.
-func parseCgroupString(cgroupStr string) (*Cgroup, error) {
- var err error
-
- fields := strings.SplitN(cgroupStr, ":", 3)
- if len(fields) < 3 {
- return nil, fmt.Errorf("%w: 3+ fields required, found %d fields in cgroup string: %s", ErrFileParse, len(fields), cgroupStr)
- }
-
- cgroup := &Cgroup{
- Path: fields[2],
- Controllers: nil,
- }
- cgroup.HierarchyID, err = strconv.Atoi(fields[0])
- if err != nil {
- return nil, fmt.Errorf("%w: hierarchy ID: %q", ErrFileParse, cgroup.HierarchyID)
- }
- if fields[1] != "" {
- ssNames := strings.Split(fields[1], ",")
- cgroup.Controllers = append(cgroup.Controllers, ssNames...)
- }
- return cgroup, nil
-}
-
-// parseCgroups reads each line of the /proc/[pid]/cgroup file.
-func parseCgroups(data []byte) ([]Cgroup, error) {
- var cgroups []Cgroup
- scanner := bufio.NewScanner(bytes.NewReader(data))
- for scanner.Scan() {
- mountString := scanner.Text()
- parsedMounts, err := parseCgroupString(mountString)
- if err != nil {
- return nil, err
- }
- cgroups = append(cgroups, *parsedMounts)
- }
-
- err := scanner.Err()
- return cgroups, err
-}
-
-// Cgroups reads from /proc//cgroups and returns a []*Cgroup struct locating this PID in each process
-// control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes,
-// so the len of the returned struct is equal to the number of active hierarchies on this system.
-func (p Proc) Cgroups() ([]Cgroup, error) {
- data, err := util.ReadFileNoStat(p.path("cgroup"))
- if err != nil {
- return nil, err
- }
- return parseCgroups(data)
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_cgroups.go b/vendor/github.com/prometheus/procfs/proc_cgroups.go
deleted file mode 100644
index 5dd4938..0000000
--- a/vendor/github.com/prometheus/procfs/proc_cgroups.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2021 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CgroupSummary models one line from /proc/cgroups.
-// This file contains information about the controllers that are compiled into the kernel.
-//
-// Also see http://man7.org/linux/man-pages/man7/cgroups.7.html
-type CgroupSummary struct {
- // The name of the controller. controller is also known as subsystem.
- SubsysName string
- // The unique ID of the cgroup hierarchy on which this controller is mounted.
- Hierarchy int
- // The number of control groups in this hierarchy using this controller.
- Cgroups int
- // This field contains the value 1 if this controller is enabled, or 0 if it has been disabled
- Enabled int
-}
-
-// parseCgroupSummary parses each line of the /proc/cgroup file
-// Line format is `subsys_name hierarchy num_cgroups enabled`.
-func parseCgroupSummaryString(CgroupSummaryStr string) (*CgroupSummary, error) {
- var err error
-
- fields := strings.Fields(CgroupSummaryStr)
- // require at least 4 fields
- if len(fields) < 4 {
- return nil, fmt.Errorf("%w: 4+ fields required, found %d fields in cgroup info string: %s", ErrFileParse, len(fields), CgroupSummaryStr)
- }
-
- CgroupSummary := &CgroupSummary{
- SubsysName: fields[0],
- }
- CgroupSummary.Hierarchy, err = strconv.Atoi(fields[1])
- if err != nil {
- return nil, fmt.Errorf("%w: Unable to parse hierarchy ID from %q", ErrFileParse, fields[1])
- }
- CgroupSummary.Cgroups, err = strconv.Atoi(fields[2])
- if err != nil {
- return nil, fmt.Errorf("%w: Unable to parse Cgroup Num from %q", ErrFileParse, fields[2])
- }
- CgroupSummary.Enabled, err = strconv.Atoi(fields[3])
- if err != nil {
- return nil, fmt.Errorf("%w: Unable to parse Enabled from %q", ErrFileParse, fields[3])
- }
- return CgroupSummary, nil
-}
-
-// parseCgroupSummary reads each line of the /proc/cgroup file.
-func parseCgroupSummary(data []byte) ([]CgroupSummary, error) {
- var CgroupSummarys []CgroupSummary
- scanner := bufio.NewScanner(bytes.NewReader(data))
- for scanner.Scan() {
- CgroupSummaryString := scanner.Text()
- // ignore comment lines
- if strings.HasPrefix(CgroupSummaryString, "#") {
- continue
- }
- CgroupSummary, err := parseCgroupSummaryString(CgroupSummaryString)
- if err != nil {
- return nil, err
- }
- CgroupSummarys = append(CgroupSummarys, *CgroupSummary)
- }
-
- err := scanner.Err()
- return CgroupSummarys, err
-}
-
-// CgroupSummarys returns information about current /proc/cgroups.
-func (fs FS) CgroupSummarys() ([]CgroupSummary, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("cgroups"))
- if err != nil {
- return nil, err
- }
- return parseCgroupSummary(data)
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go
deleted file mode 100644
index 57a8989..0000000
--- a/vendor/github.com/prometheus/procfs/proc_environ.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Environ reads process environments from `/proc//environ`.
-func (p Proc) Environ() ([]string, error) {
- environments := make([]string, 0)
-
- data, err := util.ReadFileNoStat(p.path("environ"))
- if err != nil {
- return environments, err
- }
-
- environments = strings.Split(string(data), "\000")
- if len(environments) > 0 {
- environments = environments[:len(environments)-1]
- }
-
- return environments, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_fdinfo.go b/vendor/github.com/prometheus/procfs/proc_fdinfo.go
deleted file mode 100644
index fa761b3..0000000
--- a/vendor/github.com/prometheus/procfs/proc_fdinfo.go
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "regexp"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-var (
- rPos = regexp.MustCompile(`^pos:\s+(\d+)$`)
- rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`)
- rMntID = regexp.MustCompile(`^mnt_id:\s+(\d+)$`)
- rIno = regexp.MustCompile(`^ino:\s+(\d+)$`)
- rInotify = regexp.MustCompile(`^inotify`)
- rInotifyParts = regexp.MustCompile(`^inotify\s+wd:([0-9a-f]+)\s+ino:([0-9a-f]+)\s+sdev:([0-9a-f]+)(?:\s+mask:([0-9a-f]+))?`)
-)
-
-// ProcFDInfo contains represents file descriptor information.
-type ProcFDInfo struct {
- // File descriptor
- FD string
- // File offset
- Pos string
- // File access mode and status flags
- Flags string
- // Mount point ID
- MntID string
- // Inode number
- Ino string
- // List of inotify lines (structured) in the fdinfo file (kernel 3.8+ only)
- InotifyInfos []InotifyInfo
-}
-
-// FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty.
-func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) {
- data, err := util.ReadFileNoStat(p.path("fdinfo", fd))
- if err != nil {
- return nil, err
- }
-
- var text, pos, flags, mntid, ino string
- var inotify []InotifyInfo
-
- scanner := bufio.NewScanner(bytes.NewReader(data))
- for scanner.Scan() {
- text = scanner.Text()
- if rPos.MatchString(text) {
- pos = rPos.FindStringSubmatch(text)[1]
- } else if rFlags.MatchString(text) {
- flags = rFlags.FindStringSubmatch(text)[1]
- } else if rMntID.MatchString(text) {
- mntid = rMntID.FindStringSubmatch(text)[1]
- } else if rIno.MatchString(text) {
- ino = rIno.FindStringSubmatch(text)[1]
- } else if rInotify.MatchString(text) {
- newInotify, err := parseInotifyInfo(text)
- if err != nil {
- return nil, err
- }
- inotify = append(inotify, *newInotify)
- }
- }
-
- i := &ProcFDInfo{
- FD: fd,
- Pos: pos,
- Flags: flags,
- MntID: mntid,
- Ino: ino,
- InotifyInfos: inotify,
- }
-
- return i, nil
-}
-
-// InotifyInfo represents a single inotify line in the fdinfo file.
-type InotifyInfo struct {
- // Watch descriptor number
- WD string
- // Inode number
- Ino string
- // Device ID
- Sdev string
- // Mask of events being monitored
- Mask string
-}
-
-// InotifyInfo constructor. Only available on kernel 3.8+.
-func parseInotifyInfo(line string) (*InotifyInfo, error) {
- m := rInotifyParts.FindStringSubmatch(line)
- if len(m) >= 4 {
- var mask string
- if len(m) == 5 {
- mask = m[4]
- }
- i := &InotifyInfo{
- WD: m[1],
- Ino: m[2],
- Sdev: m[3],
- Mask: mask,
- }
- return i, nil
- }
- return nil, fmt.Errorf("%w: invalid inode entry: %q", ErrFileParse, line)
-}
-
-// ProcFDInfos represents a list of ProcFDInfo structs.
-type ProcFDInfos []ProcFDInfo
-
-func (p ProcFDInfos) Len() int { return len(p) }
-func (p ProcFDInfos) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
-func (p ProcFDInfos) Less(i, j int) bool { return p[i].FD < p[j].FD }
-
-// InotifyWatchLen returns the total number of inotify watches.
-func (p ProcFDInfos) InotifyWatchLen() (int, error) {
- length := 0
- for _, f := range p {
- length += len(f.InotifyInfos)
- }
-
- return length, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_interrupts.go b/vendor/github.com/prometheus/procfs/proc_interrupts.go
deleted file mode 100644
index 86b4b45..0000000
--- a/vendor/github.com/prometheus/procfs/proc_interrupts.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Interrupt represents a single interrupt line.
-type Interrupt struct {
- // Info is the type of interrupt.
- Info string
- // Devices is the name of the device that is located at that IRQ
- Devices string
- // Values is the number of interrupts per CPU.
- Values []string
-}
-
-// Interrupts models the content of /proc/interrupts. Key is the IRQ number.
-// - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-interrupts
-// - https://raspberrypi.stackexchange.com/questions/105802/explanation-of-proc-interrupts-output
-type Interrupts map[string]Interrupt
-
-// Interrupts creates a new instance from a given Proc instance.
-func (p Proc) Interrupts() (Interrupts, error) {
- data, err := util.ReadFileNoStat(p.path("interrupts"))
- if err != nil {
- return nil, err
- }
- return parseInterrupts(bytes.NewReader(data))
-}
-
-func parseInterrupts(r io.Reader) (Interrupts, error) {
- var (
- interrupts = Interrupts{}
- scanner = bufio.NewScanner(r)
- )
-
- if !scanner.Scan() {
- return nil, errors.New("interrupts empty")
- }
- cpuNum := len(strings.Fields(scanner.Text())) // one header per cpu
-
- for scanner.Scan() {
- parts := strings.Fields(scanner.Text())
- if len(parts) == 0 { // skip empty lines
- continue
- }
- if len(parts) < 2 {
- return nil, fmt.Errorf("%w: Not enough fields in interrupts (expected 2+ fields but got %d): %s", ErrFileParse, len(parts), parts)
- }
- intName := parts[0][:len(parts[0])-1] // remove trailing :
-
- if len(parts) == 2 {
- interrupts[intName] = Interrupt{
- Info: "",
- Devices: "",
- Values: []string{
- parts[1],
- },
- }
- continue
- }
-
- intr := Interrupt{
- Values: parts[1 : cpuNum+1],
- }
-
- if _, err := strconv.Atoi(intName); err == nil { // numeral interrupt
- intr.Info = parts[cpuNum+1]
- intr.Devices = strings.Join(parts[cpuNum+2:], " ")
- } else {
- intr.Info = strings.Join(parts[cpuNum+1:], " ")
- }
- interrupts[intName] = intr
- }
-
- return interrupts, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go
deleted file mode 100644
index 776f349..0000000
--- a/vendor/github.com/prometheus/procfs/proc_io.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcIO models the content of /proc//io.
-type ProcIO struct {
- // Chars read.
- RChar uint64
- // Chars written.
- WChar uint64
- // Read syscalls.
- SyscR uint64
- // Write syscalls.
- SyscW uint64
- // Bytes read.
- ReadBytes uint64
- // Bytes written.
- WriteBytes uint64
- // Bytes written, but taking into account truncation. See
- // Documentation/filesystems/proc.txt in the kernel sources for
- // detailed explanation.
- CancelledWriteBytes int64
-}
-
-// IO creates a new ProcIO instance from a given Proc instance.
-func (p Proc) IO() (ProcIO, error) {
- pio := ProcIO{}
-
- data, err := util.ReadFileNoStat(p.path("io"))
- if err != nil {
- return pio, err
- }
-
- ioFormat := "rchar: %d\nwchar: %d\nsyscr: %d\nsyscw: %d\n" +
- "read_bytes: %d\nwrite_bytes: %d\n" +
- "cancelled_write_bytes: %d\n"
-
- _, err = fmt.Sscanf(string(data), ioFormat, &pio.RChar, &pio.WChar, &pio.SyscR,
- &pio.SyscW, &pio.ReadBytes, &pio.WriteBytes, &pio.CancelledWriteBytes)
-
- return pio, err
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go
deleted file mode 100644
index c86d815..0000000
--- a/vendor/github.com/prometheus/procfs/proc_limits.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "os"
- "regexp"
- "strconv"
-)
-
-// ProcLimits represents the soft limits for each of the process's resource
-// limits. For more information see getrlimit(2):
-// http://man7.org/linux/man-pages/man2/getrlimit.2.html.
-type ProcLimits struct {
- // CPU time limit in seconds.
- CPUTime uint64
- // Maximum size of files that the process may create.
- FileSize uint64
- // Maximum size of the process's data segment (initialized data,
- // uninitialized data, and heap).
- DataSize uint64
- // Maximum size of the process stack in bytes.
- StackSize uint64
- // Maximum size of a core file.
- CoreFileSize uint64
- // Limit of the process's resident set in pages.
- ResidentSet uint64
- // Maximum number of processes that can be created for the real user ID of
- // the calling process.
- Processes uint64
- // Value one greater than the maximum file descriptor number that can be
- // opened by this process.
- OpenFiles uint64
- // Maximum number of bytes of memory that may be locked into RAM.
- LockedMemory uint64
- // Maximum size of the process's virtual memory address space in bytes.
- AddressSpace uint64
- // Limit on the combined number of flock(2) locks and fcntl(2) leases that
- // this process may establish.
- FileLocks uint64
- // Limit of signals that may be queued for the real user ID of the calling
- // process.
- PendingSignals uint64
- // Limit on the number of bytes that can be allocated for POSIX message
- // queues for the real user ID of the calling process.
- MsqqueueSize uint64
- // Limit of the nice priority set using setpriority(2) or nice(2).
- NicePriority uint64
- // Limit of the real-time priority set using sched_setscheduler(2) or
- // sched_setparam(2).
- RealtimePriority uint64
- // Limit (in microseconds) on the amount of CPU time that a process
- // scheduled under a real-time scheduling policy may consume without making
- // a blocking system call.
- RealtimeTimeout uint64
-}
-
-const (
- limitsFields = 4
- limitsUnlimited = "unlimited"
-)
-
-var (
- limitsMatch = regexp.MustCompile(`(Max \w+\s{0,1}?\w*\s{0,1}\w*)\s{2,}(\w+)\s+(\w+)`)
-)
-
-// NewLimits returns the current soft limits of the process.
-//
-// Deprecated: Use p.Limits() instead.
-func (p Proc) NewLimits() (ProcLimits, error) {
- return p.Limits()
-}
-
-// Limits returns the current soft limits of the process.
-func (p Proc) Limits() (ProcLimits, error) {
- f, err := os.Open(p.path("limits"))
- if err != nil {
- return ProcLimits{}, err
- }
- defer f.Close()
-
- var (
- l = ProcLimits{}
- s = bufio.NewScanner(f)
- )
-
- s.Scan() // Skip limits header
-
- for s.Scan() {
- //fields := limitsMatch.Split(s.Text(), limitsFields)
- fields := limitsMatch.FindStringSubmatch(s.Text())
- if len(fields) != limitsFields {
- return ProcLimits{}, fmt.Errorf("%w: couldn't parse %q line %q", ErrFileParse, f.Name(), s.Text())
- }
-
- switch fields[1] {
- case "Max cpu time":
- l.CPUTime, err = parseUint(fields[2])
- case "Max file size":
- l.FileSize, err = parseUint(fields[2])
- case "Max data size":
- l.DataSize, err = parseUint(fields[2])
- case "Max stack size":
- l.StackSize, err = parseUint(fields[2])
- case "Max core file size":
- l.CoreFileSize, err = parseUint(fields[2])
- case "Max resident set":
- l.ResidentSet, err = parseUint(fields[2])
- case "Max processes":
- l.Processes, err = parseUint(fields[2])
- case "Max open files":
- l.OpenFiles, err = parseUint(fields[2])
- case "Max locked memory":
- l.LockedMemory, err = parseUint(fields[2])
- case "Max address space":
- l.AddressSpace, err = parseUint(fields[2])
- case "Max file locks":
- l.FileLocks, err = parseUint(fields[2])
- case "Max pending signals":
- l.PendingSignals, err = parseUint(fields[2])
- case "Max msgqueue size":
- l.MsqqueueSize, err = parseUint(fields[2])
- case "Max nice priority":
- l.NicePriority, err = parseUint(fields[2])
- case "Max realtime priority":
- l.RealtimePriority, err = parseUint(fields[2])
- case "Max realtime timeout":
- l.RealtimeTimeout, err = parseUint(fields[2])
- }
- if err != nil {
- return ProcLimits{}, err
- }
- }
-
- return l, s.Err()
-}
-
-func parseUint(s string) (uint64, error) {
- if s == limitsUnlimited {
- return 18446744073709551615, nil
- }
- i, err := strconv.ParseUint(s, 10, 64)
- if err != nil {
- return 0, fmt.Errorf("%s: couldn't parse value %q: %w", ErrFileParse, s, err)
- }
- return i, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_maps.go b/vendor/github.com/prometheus/procfs/proc_maps.go
deleted file mode 100644
index 7e75c28..0000000
--- a/vendor/github.com/prometheus/procfs/proc_maps.go
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !js
-// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
-// +build !js
-
-package procfs
-
-import (
- "bufio"
- "fmt"
- "os"
- "strconv"
- "strings"
-
- "golang.org/x/sys/unix"
-)
-
-// ProcMapPermissions contains permission settings read from `/proc/[pid]/maps`.
-type ProcMapPermissions struct {
- // mapping has the [R]ead flag set
- Read bool
- // mapping has the [W]rite flag set
- Write bool
- // mapping has the [X]ecutable flag set
- Execute bool
- // mapping has the [S]hared flag set
- Shared bool
- // mapping is marked as [P]rivate (copy on write)
- Private bool
-}
-
-// ProcMap contains the process memory-mappings of the process
-// read from `/proc/[pid]/maps`.
-type ProcMap struct {
- // The start address of current mapping.
- StartAddr uintptr
- // The end address of the current mapping
- EndAddr uintptr
- // The permissions for this mapping
- Perms *ProcMapPermissions
- // The current offset into the file/fd (e.g., shared libs)
- Offset int64
- // Device owner of this mapping (major:minor) in Mkdev format.
- Dev uint64
- // The inode of the device above
- Inode uint64
- // The file or psuedofile (or empty==anonymous)
- Pathname string
-}
-
-// parseDevice parses the device token of a line and converts it to a dev_t
-// (mkdev) like structure.
-func parseDevice(s string) (uint64, error) {
- i := strings.Index(s, ":")
- if i == -1 {
- return 0, fmt.Errorf("%w: expected separator `:` in %s", ErrFileParse, s)
- }
-
- major, err := strconv.ParseUint(s[0:i], 16, 0)
- if err != nil {
- return 0, err
- }
-
- minor, err := strconv.ParseUint(s[i+1:], 16, 0)
- if err != nil {
- return 0, err
- }
-
- return unix.Mkdev(uint32(major), uint32(minor)), nil
-}
-
-// parseAddress converts a hex-string to a uintptr.
-func parseAddress(s string) (uintptr, error) {
- a, err := strconv.ParseUint(s, 16, 0)
- if err != nil {
- return 0, err
- }
-
- return uintptr(a), nil
-}
-
-// parseAddresses parses the start-end address.
-func parseAddresses(s string) (uintptr, uintptr, error) {
- idx := strings.Index(s, "-")
- if idx == -1 {
- return 0, 0, fmt.Errorf("%w: expected separator `-` in %s", ErrFileParse, s)
- }
-
- saddr, err := parseAddress(s[0:idx])
- if err != nil {
- return 0, 0, err
- }
-
- eaddr, err := parseAddress(s[idx+1:])
- if err != nil {
- return 0, 0, err
- }
-
- return saddr, eaddr, nil
-}
-
-// parsePermissions parses a token and returns any that are set.
-func parsePermissions(s string) (*ProcMapPermissions, error) {
- if len(s) < 4 {
- return nil, fmt.Errorf("%w: invalid permissions token", ErrFileParse)
- }
-
- perms := ProcMapPermissions{}
- for _, ch := range s {
- switch ch {
- case 'r':
- perms.Read = true
- case 'w':
- perms.Write = true
- case 'x':
- perms.Execute = true
- case 'p':
- perms.Private = true
- case 's':
- perms.Shared = true
- }
- }
-
- return &perms, nil
-}
-
-// parseProcMap will attempt to parse a single line within a proc/[pid]/maps
-// buffer.
-func parseProcMap(text string) (*ProcMap, error) {
- fields := strings.Fields(text)
- if len(fields) < 5 {
- return nil, fmt.Errorf("%w: truncated procmap entry", ErrFileParse)
- }
-
- saddr, eaddr, err := parseAddresses(fields[0])
- if err != nil {
- return nil, err
- }
-
- perms, err := parsePermissions(fields[1])
- if err != nil {
- return nil, err
- }
-
- offset, err := strconv.ParseInt(fields[2], 16, 0)
- if err != nil {
- return nil, err
- }
-
- device, err := parseDevice(fields[3])
- if err != nil {
- return nil, err
- }
-
- inode, err := strconv.ParseUint(fields[4], 10, 0)
- if err != nil {
- return nil, err
- }
-
- pathname := ""
-
- if len(fields) >= 5 {
- pathname = strings.Join(fields[5:], " ")
- }
-
- return &ProcMap{
- StartAddr: saddr,
- EndAddr: eaddr,
- Perms: perms,
- Offset: offset,
- Dev: device,
- Inode: inode,
- Pathname: pathname,
- }, nil
-}
-
-// ProcMaps reads from /proc/[pid]/maps to get the memory-mappings of the
-// process.
-func (p Proc) ProcMaps() ([]*ProcMap, error) {
- file, err := os.Open(p.path("maps"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- maps := []*ProcMap{}
- scan := bufio.NewScanner(file)
-
- for scan.Scan() {
- m, err := parseProcMap(scan.Text())
- if err != nil {
- return nil, err
- }
-
- maps = append(maps, m)
- }
-
- return maps, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_netstat.go b/vendor/github.com/prometheus/procfs/proc_netstat.go
deleted file mode 100644
index 8e3ff4d..0000000
--- a/vendor/github.com/prometheus/procfs/proc_netstat.go
+++ /dev/null
@@ -1,443 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcNetstat models the content of /proc//net/netstat.
-type ProcNetstat struct {
- // The process ID.
- PID int
- TcpExt
- IpExt
-}
-
-type TcpExt struct { // nolint:revive
- SyncookiesSent *float64
- SyncookiesRecv *float64
- SyncookiesFailed *float64
- EmbryonicRsts *float64
- PruneCalled *float64
- RcvPruned *float64
- OfoPruned *float64
- OutOfWindowIcmps *float64
- LockDroppedIcmps *float64
- ArpFilter *float64
- TW *float64
- TWRecycled *float64
- TWKilled *float64
- PAWSActive *float64
- PAWSEstab *float64
- DelayedACKs *float64
- DelayedACKLocked *float64
- DelayedACKLost *float64
- ListenOverflows *float64
- ListenDrops *float64
- TCPHPHits *float64
- TCPPureAcks *float64
- TCPHPAcks *float64
- TCPRenoRecovery *float64
- TCPSackRecovery *float64
- TCPSACKReneging *float64
- TCPSACKReorder *float64
- TCPRenoReorder *float64
- TCPTSReorder *float64
- TCPFullUndo *float64
- TCPPartialUndo *float64
- TCPDSACKUndo *float64
- TCPLossUndo *float64
- TCPLostRetransmit *float64
- TCPRenoFailures *float64
- TCPSackFailures *float64
- TCPLossFailures *float64
- TCPFastRetrans *float64
- TCPSlowStartRetrans *float64
- TCPTimeouts *float64
- TCPLossProbes *float64
- TCPLossProbeRecovery *float64
- TCPRenoRecoveryFail *float64
- TCPSackRecoveryFail *float64
- TCPRcvCollapsed *float64
- TCPDSACKOldSent *float64
- TCPDSACKOfoSent *float64
- TCPDSACKRecv *float64
- TCPDSACKOfoRecv *float64
- TCPAbortOnData *float64
- TCPAbortOnClose *float64
- TCPAbortOnMemory *float64
- TCPAbortOnTimeout *float64
- TCPAbortOnLinger *float64
- TCPAbortFailed *float64
- TCPMemoryPressures *float64
- TCPMemoryPressuresChrono *float64
- TCPSACKDiscard *float64
- TCPDSACKIgnoredOld *float64
- TCPDSACKIgnoredNoUndo *float64
- TCPSpuriousRTOs *float64
- TCPMD5NotFound *float64
- TCPMD5Unexpected *float64
- TCPMD5Failure *float64
- TCPSackShifted *float64
- TCPSackMerged *float64
- TCPSackShiftFallback *float64
- TCPBacklogDrop *float64
- PFMemallocDrop *float64
- TCPMinTTLDrop *float64
- TCPDeferAcceptDrop *float64
- IPReversePathFilter *float64
- TCPTimeWaitOverflow *float64
- TCPReqQFullDoCookies *float64
- TCPReqQFullDrop *float64
- TCPRetransFail *float64
- TCPRcvCoalesce *float64
- TCPRcvQDrop *float64
- TCPOFOQueue *float64
- TCPOFODrop *float64
- TCPOFOMerge *float64
- TCPChallengeACK *float64
- TCPSYNChallenge *float64
- TCPFastOpenActive *float64
- TCPFastOpenActiveFail *float64
- TCPFastOpenPassive *float64
- TCPFastOpenPassiveFail *float64
- TCPFastOpenListenOverflow *float64
- TCPFastOpenCookieReqd *float64
- TCPFastOpenBlackhole *float64
- TCPSpuriousRtxHostQueues *float64
- BusyPollRxPackets *float64
- TCPAutoCorking *float64
- TCPFromZeroWindowAdv *float64
- TCPToZeroWindowAdv *float64
- TCPWantZeroWindowAdv *float64
- TCPSynRetrans *float64
- TCPOrigDataSent *float64
- TCPHystartTrainDetect *float64
- TCPHystartTrainCwnd *float64
- TCPHystartDelayDetect *float64
- TCPHystartDelayCwnd *float64
- TCPACKSkippedSynRecv *float64
- TCPACKSkippedPAWS *float64
- TCPACKSkippedSeq *float64
- TCPACKSkippedFinWait2 *float64
- TCPACKSkippedTimeWait *float64
- TCPACKSkippedChallenge *float64
- TCPWinProbe *float64
- TCPKeepAlive *float64
- TCPMTUPFail *float64
- TCPMTUPSuccess *float64
- TCPWqueueTooBig *float64
-}
-
-type IpExt struct { // nolint:revive
- InNoRoutes *float64
- InTruncatedPkts *float64
- InMcastPkts *float64
- OutMcastPkts *float64
- InBcastPkts *float64
- OutBcastPkts *float64
- InOctets *float64
- OutOctets *float64
- InMcastOctets *float64
- OutMcastOctets *float64
- InBcastOctets *float64
- OutBcastOctets *float64
- InCsumErrors *float64
- InNoECTPkts *float64
- InECT1Pkts *float64
- InECT0Pkts *float64
- InCEPkts *float64
- ReasmOverlaps *float64
-}
-
-func (p Proc) Netstat() (ProcNetstat, error) {
- filename := p.path("net/netstat")
- data, err := util.ReadFileNoStat(filename)
- if err != nil {
- return ProcNetstat{PID: p.PID}, err
- }
- procNetstat, err := parseProcNetstat(bytes.NewReader(data), filename)
- procNetstat.PID = p.PID
- return procNetstat, err
-}
-
-// parseProcNetstat parses the metrics from proc//net/netstat file
-// and returns a ProcNetstat structure.
-func parseProcNetstat(r io.Reader, fileName string) (ProcNetstat, error) {
- var (
- scanner = bufio.NewScanner(r)
- procNetstat = ProcNetstat{}
- )
-
- for scanner.Scan() {
- nameParts := strings.Split(scanner.Text(), " ")
- scanner.Scan()
- valueParts := strings.Split(scanner.Text(), " ")
- // Remove trailing :.
- protocol := strings.TrimSuffix(nameParts[0], ":")
- if len(nameParts) != len(valueParts) {
- return procNetstat, fmt.Errorf("%w: mismatch field count mismatch in %s: %s",
- ErrFileParse, fileName, protocol)
- }
- for i := 1; i < len(nameParts); i++ {
- value, err := strconv.ParseFloat(valueParts[i], 64)
- if err != nil {
- return procNetstat, err
- }
- key := nameParts[i]
-
- switch protocol {
- case "TcpExt":
- switch key {
- case "SyncookiesSent":
- procNetstat.TcpExt.SyncookiesSent = &value
- case "SyncookiesRecv":
- procNetstat.TcpExt.SyncookiesRecv = &value
- case "SyncookiesFailed":
- procNetstat.TcpExt.SyncookiesFailed = &value
- case "EmbryonicRsts":
- procNetstat.TcpExt.EmbryonicRsts = &value
- case "PruneCalled":
- procNetstat.TcpExt.PruneCalled = &value
- case "RcvPruned":
- procNetstat.TcpExt.RcvPruned = &value
- case "OfoPruned":
- procNetstat.TcpExt.OfoPruned = &value
- case "OutOfWindowIcmps":
- procNetstat.TcpExt.OutOfWindowIcmps = &value
- case "LockDroppedIcmps":
- procNetstat.TcpExt.LockDroppedIcmps = &value
- case "ArpFilter":
- procNetstat.TcpExt.ArpFilter = &value
- case "TW":
- procNetstat.TcpExt.TW = &value
- case "TWRecycled":
- procNetstat.TcpExt.TWRecycled = &value
- case "TWKilled":
- procNetstat.TcpExt.TWKilled = &value
- case "PAWSActive":
- procNetstat.TcpExt.PAWSActive = &value
- case "PAWSEstab":
- procNetstat.TcpExt.PAWSEstab = &value
- case "DelayedACKs":
- procNetstat.TcpExt.DelayedACKs = &value
- case "DelayedACKLocked":
- procNetstat.TcpExt.DelayedACKLocked = &value
- case "DelayedACKLost":
- procNetstat.TcpExt.DelayedACKLost = &value
- case "ListenOverflows":
- procNetstat.TcpExt.ListenOverflows = &value
- case "ListenDrops":
- procNetstat.TcpExt.ListenDrops = &value
- case "TCPHPHits":
- procNetstat.TcpExt.TCPHPHits = &value
- case "TCPPureAcks":
- procNetstat.TcpExt.TCPPureAcks = &value
- case "TCPHPAcks":
- procNetstat.TcpExt.TCPHPAcks = &value
- case "TCPRenoRecovery":
- procNetstat.TcpExt.TCPRenoRecovery = &value
- case "TCPSackRecovery":
- procNetstat.TcpExt.TCPSackRecovery = &value
- case "TCPSACKReneging":
- procNetstat.TcpExt.TCPSACKReneging = &value
- case "TCPSACKReorder":
- procNetstat.TcpExt.TCPSACKReorder = &value
- case "TCPRenoReorder":
- procNetstat.TcpExt.TCPRenoReorder = &value
- case "TCPTSReorder":
- procNetstat.TcpExt.TCPTSReorder = &value
- case "TCPFullUndo":
- procNetstat.TcpExt.TCPFullUndo = &value
- case "TCPPartialUndo":
- procNetstat.TcpExt.TCPPartialUndo = &value
- case "TCPDSACKUndo":
- procNetstat.TcpExt.TCPDSACKUndo = &value
- case "TCPLossUndo":
- procNetstat.TcpExt.TCPLossUndo = &value
- case "TCPLostRetransmit":
- procNetstat.TcpExt.TCPLostRetransmit = &value
- case "TCPRenoFailures":
- procNetstat.TcpExt.TCPRenoFailures = &value
- case "TCPSackFailures":
- procNetstat.TcpExt.TCPSackFailures = &value
- case "TCPLossFailures":
- procNetstat.TcpExt.TCPLossFailures = &value
- case "TCPFastRetrans":
- procNetstat.TcpExt.TCPFastRetrans = &value
- case "TCPSlowStartRetrans":
- procNetstat.TcpExt.TCPSlowStartRetrans = &value
- case "TCPTimeouts":
- procNetstat.TcpExt.TCPTimeouts = &value
- case "TCPLossProbes":
- procNetstat.TcpExt.TCPLossProbes = &value
- case "TCPLossProbeRecovery":
- procNetstat.TcpExt.TCPLossProbeRecovery = &value
- case "TCPRenoRecoveryFail":
- procNetstat.TcpExt.TCPRenoRecoveryFail = &value
- case "TCPSackRecoveryFail":
- procNetstat.TcpExt.TCPSackRecoveryFail = &value
- case "TCPRcvCollapsed":
- procNetstat.TcpExt.TCPRcvCollapsed = &value
- case "TCPDSACKOldSent":
- procNetstat.TcpExt.TCPDSACKOldSent = &value
- case "TCPDSACKOfoSent":
- procNetstat.TcpExt.TCPDSACKOfoSent = &value
- case "TCPDSACKRecv":
- procNetstat.TcpExt.TCPDSACKRecv = &value
- case "TCPDSACKOfoRecv":
- procNetstat.TcpExt.TCPDSACKOfoRecv = &value
- case "TCPAbortOnData":
- procNetstat.TcpExt.TCPAbortOnData = &value
- case "TCPAbortOnClose":
- procNetstat.TcpExt.TCPAbortOnClose = &value
- case "TCPDeferAcceptDrop":
- procNetstat.TcpExt.TCPDeferAcceptDrop = &value
- case "IPReversePathFilter":
- procNetstat.TcpExt.IPReversePathFilter = &value
- case "TCPTimeWaitOverflow":
- procNetstat.TcpExt.TCPTimeWaitOverflow = &value
- case "TCPReqQFullDoCookies":
- procNetstat.TcpExt.TCPReqQFullDoCookies = &value
- case "TCPReqQFullDrop":
- procNetstat.TcpExt.TCPReqQFullDrop = &value
- case "TCPRetransFail":
- procNetstat.TcpExt.TCPRetransFail = &value
- case "TCPRcvCoalesce":
- procNetstat.TcpExt.TCPRcvCoalesce = &value
- case "TCPRcvQDrop":
- procNetstat.TcpExt.TCPRcvQDrop = &value
- case "TCPOFOQueue":
- procNetstat.TcpExt.TCPOFOQueue = &value
- case "TCPOFODrop":
- procNetstat.TcpExt.TCPOFODrop = &value
- case "TCPOFOMerge":
- procNetstat.TcpExt.TCPOFOMerge = &value
- case "TCPChallengeACK":
- procNetstat.TcpExt.TCPChallengeACK = &value
- case "TCPSYNChallenge":
- procNetstat.TcpExt.TCPSYNChallenge = &value
- case "TCPFastOpenActive":
- procNetstat.TcpExt.TCPFastOpenActive = &value
- case "TCPFastOpenActiveFail":
- procNetstat.TcpExt.TCPFastOpenActiveFail = &value
- case "TCPFastOpenPassive":
- procNetstat.TcpExt.TCPFastOpenPassive = &value
- case "TCPFastOpenPassiveFail":
- procNetstat.TcpExt.TCPFastOpenPassiveFail = &value
- case "TCPFastOpenListenOverflow":
- procNetstat.TcpExt.TCPFastOpenListenOverflow = &value
- case "TCPFastOpenCookieReqd":
- procNetstat.TcpExt.TCPFastOpenCookieReqd = &value
- case "TCPFastOpenBlackhole":
- procNetstat.TcpExt.TCPFastOpenBlackhole = &value
- case "TCPSpuriousRtxHostQueues":
- procNetstat.TcpExt.TCPSpuriousRtxHostQueues = &value
- case "BusyPollRxPackets":
- procNetstat.TcpExt.BusyPollRxPackets = &value
- case "TCPAutoCorking":
- procNetstat.TcpExt.TCPAutoCorking = &value
- case "TCPFromZeroWindowAdv":
- procNetstat.TcpExt.TCPFromZeroWindowAdv = &value
- case "TCPToZeroWindowAdv":
- procNetstat.TcpExt.TCPToZeroWindowAdv = &value
- case "TCPWantZeroWindowAdv":
- procNetstat.TcpExt.TCPWantZeroWindowAdv = &value
- case "TCPSynRetrans":
- procNetstat.TcpExt.TCPSynRetrans = &value
- case "TCPOrigDataSent":
- procNetstat.TcpExt.TCPOrigDataSent = &value
- case "TCPHystartTrainDetect":
- procNetstat.TcpExt.TCPHystartTrainDetect = &value
- case "TCPHystartTrainCwnd":
- procNetstat.TcpExt.TCPHystartTrainCwnd = &value
- case "TCPHystartDelayDetect":
- procNetstat.TcpExt.TCPHystartDelayDetect = &value
- case "TCPHystartDelayCwnd":
- procNetstat.TcpExt.TCPHystartDelayCwnd = &value
- case "TCPACKSkippedSynRecv":
- procNetstat.TcpExt.TCPACKSkippedSynRecv = &value
- case "TCPACKSkippedPAWS":
- procNetstat.TcpExt.TCPACKSkippedPAWS = &value
- case "TCPACKSkippedSeq":
- procNetstat.TcpExt.TCPACKSkippedSeq = &value
- case "TCPACKSkippedFinWait2":
- procNetstat.TcpExt.TCPACKSkippedFinWait2 = &value
- case "TCPACKSkippedTimeWait":
- procNetstat.TcpExt.TCPACKSkippedTimeWait = &value
- case "TCPACKSkippedChallenge":
- procNetstat.TcpExt.TCPACKSkippedChallenge = &value
- case "TCPWinProbe":
- procNetstat.TcpExt.TCPWinProbe = &value
- case "TCPKeepAlive":
- procNetstat.TcpExt.TCPKeepAlive = &value
- case "TCPMTUPFail":
- procNetstat.TcpExt.TCPMTUPFail = &value
- case "TCPMTUPSuccess":
- procNetstat.TcpExt.TCPMTUPSuccess = &value
- case "TCPWqueueTooBig":
- procNetstat.TcpExt.TCPWqueueTooBig = &value
- }
- case "IpExt":
- switch key {
- case "InNoRoutes":
- procNetstat.IpExt.InNoRoutes = &value
- case "InTruncatedPkts":
- procNetstat.IpExt.InTruncatedPkts = &value
- case "InMcastPkts":
- procNetstat.IpExt.InMcastPkts = &value
- case "OutMcastPkts":
- procNetstat.IpExt.OutMcastPkts = &value
- case "InBcastPkts":
- procNetstat.IpExt.InBcastPkts = &value
- case "OutBcastPkts":
- procNetstat.IpExt.OutBcastPkts = &value
- case "InOctets":
- procNetstat.IpExt.InOctets = &value
- case "OutOctets":
- procNetstat.IpExt.OutOctets = &value
- case "InMcastOctets":
- procNetstat.IpExt.InMcastOctets = &value
- case "OutMcastOctets":
- procNetstat.IpExt.OutMcastOctets = &value
- case "InBcastOctets":
- procNetstat.IpExt.InBcastOctets = &value
- case "OutBcastOctets":
- procNetstat.IpExt.OutBcastOctets = &value
- case "InCsumErrors":
- procNetstat.IpExt.InCsumErrors = &value
- case "InNoECTPkts":
- procNetstat.IpExt.InNoECTPkts = &value
- case "InECT1Pkts":
- procNetstat.IpExt.InECT1Pkts = &value
- case "InECT0Pkts":
- procNetstat.IpExt.InECT0Pkts = &value
- case "InCEPkts":
- procNetstat.IpExt.InCEPkts = &value
- case "ReasmOverlaps":
- procNetstat.IpExt.ReasmOverlaps = &value
- }
- }
- }
- }
- return procNetstat, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go
deleted file mode 100644
index c226667..0000000
--- a/vendor/github.com/prometheus/procfs/proc_ns.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "os"
- "strconv"
- "strings"
-)
-
-// Namespace represents a single namespace of a process.
-type Namespace struct {
- Type string // Namespace type.
- Inode uint32 // Inode number of the namespace. If two processes are in the same namespace their inodes will match.
-}
-
-// Namespaces contains all of the namespaces that the process is contained in.
-type Namespaces map[string]Namespace
-
-// Namespaces reads from /proc//ns/* to get the namespaces of which the
-// process is a member.
-func (p Proc) Namespaces() (Namespaces, error) {
- d, err := os.Open(p.path("ns"))
- if err != nil {
- return nil, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return nil, fmt.Errorf("%s: failed to read contents of ns dir: %w", ErrFileRead, err)
- }
-
- ns := make(Namespaces, len(names))
- for _, name := range names {
- target, err := os.Readlink(p.path("ns", name))
- if err != nil {
- return nil, err
- }
-
- fields := strings.SplitN(target, ":", 2)
- if len(fields) != 2 {
- return nil, fmt.Errorf("%w: namespace type and inode from %q", ErrFileParse, target)
- }
-
- typ := fields[0]
- inode, err := strconv.ParseUint(strings.Trim(fields[1], "[]"), 10, 32)
- if err != nil {
- return nil, fmt.Errorf("%s: inode from %q: %w", ErrFileParse, fields[1], err)
- }
-
- ns[name] = Namespace{typ, uint32(inode)}
- }
-
- return ns, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go
deleted file mode 100644
index fe9dbb4..0000000
--- a/vendor/github.com/prometheus/procfs/proc_psi.go
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-// The PSI / pressure interface is described at
-// https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/accounting/psi.txt
-// Each resource (cpu, io, memory, ...) is exposed as a single file.
-// Each file may contain up to two lines, one for "some" pressure and one for "full" pressure.
-// Each line contains several averages (over n seconds) and a total in µs.
-//
-// Example io pressure file:
-// > some avg10=0.06 avg60=0.21 avg300=0.99 total=8537362
-// > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d"
-
-// PSILine is a single line of values as returned by `/proc/pressure/*`.
-//
-// The Avg entries are averages over n seconds, as a percentage.
-// The Total line is in microseconds.
-type PSILine struct {
- Avg10 float64
- Avg60 float64
- Avg300 float64
- Total uint64
-}
-
-// PSIStats represent pressure stall information from /proc/pressure/*
-//
-// "Some" indicates the share of time in which at least some tasks are stalled.
-// "Full" indicates the share of time in which all non-idle tasks are stalled simultaneously.
-type PSIStats struct {
- Some *PSILine
- Full *PSILine
-}
-
-// PSIStatsForResource reads pressure stall information for the specified
-// resource from /proc/pressure/. At time of writing this can be
-// either "cpu", "memory" or "io".
-func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource)))
- if err != nil {
- return PSIStats{}, fmt.Errorf("%s: psi_stats: unavailable for %q: %w", ErrFileRead, resource, err)
- }
-
- return parsePSIStats(bytes.NewReader(data))
-}
-
-// parsePSIStats parses the specified file for pressure stall information.
-func parsePSIStats(r io.Reader) (PSIStats, error) {
- psiStats := PSIStats{}
-
- scanner := bufio.NewScanner(r)
- for scanner.Scan() {
- l := scanner.Text()
- prefix := strings.Split(l, " ")[0]
- switch prefix {
- case "some":
- psi := PSILine{}
- _, err := fmt.Sscanf(l, fmt.Sprintf("some %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total)
- if err != nil {
- return PSIStats{}, err
- }
- psiStats.Some = &psi
- case "full":
- psi := PSILine{}
- _, err := fmt.Sscanf(l, fmt.Sprintf("full %s", lineFormat), &psi.Avg10, &psi.Avg60, &psi.Avg300, &psi.Total)
- if err != nil {
- return PSIStats{}, err
- }
- psiStats.Full = &psi
- default:
- // If we encounter a line with an unknown prefix, ignore it and move on
- // Should new measurement types be added in the future we'll simply ignore them instead
- // of erroring on retrieval
- continue
- }
- }
-
- return psiStats, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_smaps.go b/vendor/github.com/prometheus/procfs/proc_smaps.go
deleted file mode 100644
index ad8785a..0000000
--- a/vendor/github.com/prometheus/procfs/proc_smaps.go
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows
-// +build !windows
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "fmt"
- "os"
- "regexp"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-var (
- // match the header line before each mapped zone in `/proc/pid/smaps`.
- procSMapsHeaderLine = regexp.MustCompile(`^[a-f0-9].*$`)
-)
-
-type ProcSMapsRollup struct {
- // Amount of the mapping that is currently resident in RAM.
- Rss uint64
- // Process's proportional share of this mapping.
- Pss uint64
- // Size in bytes of clean shared pages.
- SharedClean uint64
- // Size in bytes of dirty shared pages.
- SharedDirty uint64
- // Size in bytes of clean private pages.
- PrivateClean uint64
- // Size in bytes of dirty private pages.
- PrivateDirty uint64
- // Amount of memory currently marked as referenced or accessed.
- Referenced uint64
- // Amount of memory that does not belong to any file.
- Anonymous uint64
- // Amount would-be-anonymous memory currently on swap.
- Swap uint64
- // Process's proportional memory on swap.
- SwapPss uint64
-}
-
-// ProcSMapsRollup reads from /proc/[pid]/smaps_rollup to get summed memory information of the
-// process.
-//
-// If smaps_rollup does not exists (require kernel >= 4.15), the content of /proc/pid/smaps will
-// we read and summed.
-func (p Proc) ProcSMapsRollup() (ProcSMapsRollup, error) {
- data, err := util.ReadFileNoStat(p.path("smaps_rollup"))
- if err != nil && os.IsNotExist(err) {
- return p.procSMapsRollupManual()
- }
- if err != nil {
- return ProcSMapsRollup{}, err
- }
-
- lines := strings.Split(string(data), "\n")
- smaps := ProcSMapsRollup{}
-
- // skip first line which don't contains information we need
- lines = lines[1:]
- for _, line := range lines {
- if line == "" {
- continue
- }
-
- if err := smaps.parseLine(line); err != nil {
- return ProcSMapsRollup{}, err
- }
- }
-
- return smaps, nil
-}
-
-// Read /proc/pid/smaps and do the roll-up in Go code.
-func (p Proc) procSMapsRollupManual() (ProcSMapsRollup, error) {
- file, err := os.Open(p.path("smaps"))
- if err != nil {
- return ProcSMapsRollup{}, err
- }
- defer file.Close()
-
- smaps := ProcSMapsRollup{}
- scan := bufio.NewScanner(file)
-
- for scan.Scan() {
- line := scan.Text()
-
- if procSMapsHeaderLine.MatchString(line) {
- continue
- }
-
- if err := smaps.parseLine(line); err != nil {
- return ProcSMapsRollup{}, err
- }
- }
-
- return smaps, nil
-}
-
-func (s *ProcSMapsRollup) parseLine(line string) error {
- kv := strings.SplitN(line, ":", 2)
- if len(kv) != 2 {
- fmt.Println(line)
- return errors.New("invalid net/dev line, missing colon")
- }
-
- k := kv[0]
- if k == "VmFlags" {
- return nil
- }
-
- v := strings.TrimSpace(kv[1])
- v = strings.TrimRight(v, " kB")
-
- vKBytes, err := strconv.ParseUint(v, 10, 64)
- if err != nil {
- return err
- }
- vBytes := vKBytes * 1024
-
- s.addValue(k, vBytes)
-
- return nil
-}
-
-func (s *ProcSMapsRollup) addValue(k string, vUintBytes uint64) {
- switch k {
- case "Rss":
- s.Rss += vUintBytes
- case "Pss":
- s.Pss += vUintBytes
- case "Shared_Clean":
- s.SharedClean += vUintBytes
- case "Shared_Dirty":
- s.SharedDirty += vUintBytes
- case "Private_Clean":
- s.PrivateClean += vUintBytes
- case "Private_Dirty":
- s.PrivateDirty += vUintBytes
- case "Referenced":
- s.Referenced += vUintBytes
- case "Anonymous":
- s.Anonymous += vUintBytes
- case "Swap":
- s.Swap += vUintBytes
- case "SwapPss":
- s.SwapPss += vUintBytes
- }
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_snmp.go b/vendor/github.com/prometheus/procfs/proc_snmp.go
deleted file mode 100644
index b9d2cf6..0000000
--- a/vendor/github.com/prometheus/procfs/proc_snmp.go
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcSnmp models the content of /proc//net/snmp.
-type ProcSnmp struct {
- // The process ID.
- PID int
- Ip
- Icmp
- IcmpMsg
- Tcp
- Udp
- UdpLite
-}
-
-type Ip struct { // nolint:revive
- Forwarding *float64
- DefaultTTL *float64
- InReceives *float64
- InHdrErrors *float64
- InAddrErrors *float64
- ForwDatagrams *float64
- InUnknownProtos *float64
- InDiscards *float64
- InDelivers *float64
- OutRequests *float64
- OutDiscards *float64
- OutNoRoutes *float64
- ReasmTimeout *float64
- ReasmReqds *float64
- ReasmOKs *float64
- ReasmFails *float64
- FragOKs *float64
- FragFails *float64
- FragCreates *float64
-}
-
-type Icmp struct { // nolint:revive
- InMsgs *float64
- InErrors *float64
- InCsumErrors *float64
- InDestUnreachs *float64
- InTimeExcds *float64
- InParmProbs *float64
- InSrcQuenchs *float64
- InRedirects *float64
- InEchos *float64
- InEchoReps *float64
- InTimestamps *float64
- InTimestampReps *float64
- InAddrMasks *float64
- InAddrMaskReps *float64
- OutMsgs *float64
- OutErrors *float64
- OutDestUnreachs *float64
- OutTimeExcds *float64
- OutParmProbs *float64
- OutSrcQuenchs *float64
- OutRedirects *float64
- OutEchos *float64
- OutEchoReps *float64
- OutTimestamps *float64
- OutTimestampReps *float64
- OutAddrMasks *float64
- OutAddrMaskReps *float64
-}
-
-type IcmpMsg struct {
- InType3 *float64
- OutType3 *float64
-}
-
-type Tcp struct { // nolint:revive
- RtoAlgorithm *float64
- RtoMin *float64
- RtoMax *float64
- MaxConn *float64
- ActiveOpens *float64
- PassiveOpens *float64
- AttemptFails *float64
- EstabResets *float64
- CurrEstab *float64
- InSegs *float64
- OutSegs *float64
- RetransSegs *float64
- InErrs *float64
- OutRsts *float64
- InCsumErrors *float64
-}
-
-type Udp struct { // nolint:revive
- InDatagrams *float64
- NoPorts *float64
- InErrors *float64
- OutDatagrams *float64
- RcvbufErrors *float64
- SndbufErrors *float64
- InCsumErrors *float64
- IgnoredMulti *float64
-}
-
-type UdpLite struct { // nolint:revive
- InDatagrams *float64
- NoPorts *float64
- InErrors *float64
- OutDatagrams *float64
- RcvbufErrors *float64
- SndbufErrors *float64
- InCsumErrors *float64
- IgnoredMulti *float64
-}
-
-func (p Proc) Snmp() (ProcSnmp, error) {
- filename := p.path("net/snmp")
- data, err := util.ReadFileNoStat(filename)
- if err != nil {
- return ProcSnmp{PID: p.PID}, err
- }
- procSnmp, err := parseSnmp(bytes.NewReader(data), filename)
- procSnmp.PID = p.PID
- return procSnmp, err
-}
-
-// parseSnmp parses the metrics from proc//net/snmp file
-// and returns a map contains those metrics (e.g. {"Ip": {"Forwarding": 2}}).
-func parseSnmp(r io.Reader, fileName string) (ProcSnmp, error) {
- var (
- scanner = bufio.NewScanner(r)
- procSnmp = ProcSnmp{}
- )
-
- for scanner.Scan() {
- nameParts := strings.Split(scanner.Text(), " ")
- scanner.Scan()
- valueParts := strings.Split(scanner.Text(), " ")
- // Remove trailing :.
- protocol := strings.TrimSuffix(nameParts[0], ":")
- if len(nameParts) != len(valueParts) {
- return procSnmp, fmt.Errorf("%w: mismatch field count mismatch in %s: %s",
- ErrFileParse, fileName, protocol)
- }
- for i := 1; i < len(nameParts); i++ {
- value, err := strconv.ParseFloat(valueParts[i], 64)
- if err != nil {
- return procSnmp, err
- }
- key := nameParts[i]
-
- switch protocol {
- case "Ip":
- switch key {
- case "Forwarding":
- procSnmp.Ip.Forwarding = &value
- case "DefaultTTL":
- procSnmp.Ip.DefaultTTL = &value
- case "InReceives":
- procSnmp.Ip.InReceives = &value
- case "InHdrErrors":
- procSnmp.Ip.InHdrErrors = &value
- case "InAddrErrors":
- procSnmp.Ip.InAddrErrors = &value
- case "ForwDatagrams":
- procSnmp.Ip.ForwDatagrams = &value
- case "InUnknownProtos":
- procSnmp.Ip.InUnknownProtos = &value
- case "InDiscards":
- procSnmp.Ip.InDiscards = &value
- case "InDelivers":
- procSnmp.Ip.InDelivers = &value
- case "OutRequests":
- procSnmp.Ip.OutRequests = &value
- case "OutDiscards":
- procSnmp.Ip.OutDiscards = &value
- case "OutNoRoutes":
- procSnmp.Ip.OutNoRoutes = &value
- case "ReasmTimeout":
- procSnmp.Ip.ReasmTimeout = &value
- case "ReasmReqds":
- procSnmp.Ip.ReasmReqds = &value
- case "ReasmOKs":
- procSnmp.Ip.ReasmOKs = &value
- case "ReasmFails":
- procSnmp.Ip.ReasmFails = &value
- case "FragOKs":
- procSnmp.Ip.FragOKs = &value
- case "FragFails":
- procSnmp.Ip.FragFails = &value
- case "FragCreates":
- procSnmp.Ip.FragCreates = &value
- }
- case "Icmp":
- switch key {
- case "InMsgs":
- procSnmp.Icmp.InMsgs = &value
- case "InErrors":
- procSnmp.Icmp.InErrors = &value
- case "InCsumErrors":
- procSnmp.Icmp.InCsumErrors = &value
- case "InDestUnreachs":
- procSnmp.Icmp.InDestUnreachs = &value
- case "InTimeExcds":
- procSnmp.Icmp.InTimeExcds = &value
- case "InParmProbs":
- procSnmp.Icmp.InParmProbs = &value
- case "InSrcQuenchs":
- procSnmp.Icmp.InSrcQuenchs = &value
- case "InRedirects":
- procSnmp.Icmp.InRedirects = &value
- case "InEchos":
- procSnmp.Icmp.InEchos = &value
- case "InEchoReps":
- procSnmp.Icmp.InEchoReps = &value
- case "InTimestamps":
- procSnmp.Icmp.InTimestamps = &value
- case "InTimestampReps":
- procSnmp.Icmp.InTimestampReps = &value
- case "InAddrMasks":
- procSnmp.Icmp.InAddrMasks = &value
- case "InAddrMaskReps":
- procSnmp.Icmp.InAddrMaskReps = &value
- case "OutMsgs":
- procSnmp.Icmp.OutMsgs = &value
- case "OutErrors":
- procSnmp.Icmp.OutErrors = &value
- case "OutDestUnreachs":
- procSnmp.Icmp.OutDestUnreachs = &value
- case "OutTimeExcds":
- procSnmp.Icmp.OutTimeExcds = &value
- case "OutParmProbs":
- procSnmp.Icmp.OutParmProbs = &value
- case "OutSrcQuenchs":
- procSnmp.Icmp.OutSrcQuenchs = &value
- case "OutRedirects":
- procSnmp.Icmp.OutRedirects = &value
- case "OutEchos":
- procSnmp.Icmp.OutEchos = &value
- case "OutEchoReps":
- procSnmp.Icmp.OutEchoReps = &value
- case "OutTimestamps":
- procSnmp.Icmp.OutTimestamps = &value
- case "OutTimestampReps":
- procSnmp.Icmp.OutTimestampReps = &value
- case "OutAddrMasks":
- procSnmp.Icmp.OutAddrMasks = &value
- case "OutAddrMaskReps":
- procSnmp.Icmp.OutAddrMaskReps = &value
- }
- case "IcmpMsg":
- switch key {
- case "InType3":
- procSnmp.IcmpMsg.InType3 = &value
- case "OutType3":
- procSnmp.IcmpMsg.OutType3 = &value
- }
- case "Tcp":
- switch key {
- case "RtoAlgorithm":
- procSnmp.Tcp.RtoAlgorithm = &value
- case "RtoMin":
- procSnmp.Tcp.RtoMin = &value
- case "RtoMax":
- procSnmp.Tcp.RtoMax = &value
- case "MaxConn":
- procSnmp.Tcp.MaxConn = &value
- case "ActiveOpens":
- procSnmp.Tcp.ActiveOpens = &value
- case "PassiveOpens":
- procSnmp.Tcp.PassiveOpens = &value
- case "AttemptFails":
- procSnmp.Tcp.AttemptFails = &value
- case "EstabResets":
- procSnmp.Tcp.EstabResets = &value
- case "CurrEstab":
- procSnmp.Tcp.CurrEstab = &value
- case "InSegs":
- procSnmp.Tcp.InSegs = &value
- case "OutSegs":
- procSnmp.Tcp.OutSegs = &value
- case "RetransSegs":
- procSnmp.Tcp.RetransSegs = &value
- case "InErrs":
- procSnmp.Tcp.InErrs = &value
- case "OutRsts":
- procSnmp.Tcp.OutRsts = &value
- case "InCsumErrors":
- procSnmp.Tcp.InCsumErrors = &value
- }
- case "Udp":
- switch key {
- case "InDatagrams":
- procSnmp.Udp.InDatagrams = &value
- case "NoPorts":
- procSnmp.Udp.NoPorts = &value
- case "InErrors":
- procSnmp.Udp.InErrors = &value
- case "OutDatagrams":
- procSnmp.Udp.OutDatagrams = &value
- case "RcvbufErrors":
- procSnmp.Udp.RcvbufErrors = &value
- case "SndbufErrors":
- procSnmp.Udp.SndbufErrors = &value
- case "InCsumErrors":
- procSnmp.Udp.InCsumErrors = &value
- case "IgnoredMulti":
- procSnmp.Udp.IgnoredMulti = &value
- }
- case "UdpLite":
- switch key {
- case "InDatagrams":
- procSnmp.UdpLite.InDatagrams = &value
- case "NoPorts":
- procSnmp.UdpLite.NoPorts = &value
- case "InErrors":
- procSnmp.UdpLite.InErrors = &value
- case "OutDatagrams":
- procSnmp.UdpLite.OutDatagrams = &value
- case "RcvbufErrors":
- procSnmp.UdpLite.RcvbufErrors = &value
- case "SndbufErrors":
- procSnmp.UdpLite.SndbufErrors = &value
- case "InCsumErrors":
- procSnmp.UdpLite.InCsumErrors = &value
- case "IgnoredMulti":
- procSnmp.UdpLite.IgnoredMulti = &value
- }
- }
- }
- }
- return procSnmp, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_snmp6.go b/vendor/github.com/prometheus/procfs/proc_snmp6.go
deleted file mode 100644
index 3059cc6..0000000
--- a/vendor/github.com/prometheus/procfs/proc_snmp6.go
+++ /dev/null
@@ -1,381 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "errors"
- "io"
- "os"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcSnmp6 models the content of /proc//net/snmp6.
-type ProcSnmp6 struct {
- // The process ID.
- PID int
- Ip6
- Icmp6
- Udp6
- UdpLite6
-}
-
-type Ip6 struct { // nolint:revive
- InReceives *float64
- InHdrErrors *float64
- InTooBigErrors *float64
- InNoRoutes *float64
- InAddrErrors *float64
- InUnknownProtos *float64
- InTruncatedPkts *float64
- InDiscards *float64
- InDelivers *float64
- OutForwDatagrams *float64
- OutRequests *float64
- OutDiscards *float64
- OutNoRoutes *float64
- ReasmTimeout *float64
- ReasmReqds *float64
- ReasmOKs *float64
- ReasmFails *float64
- FragOKs *float64
- FragFails *float64
- FragCreates *float64
- InMcastPkts *float64
- OutMcastPkts *float64
- InOctets *float64
- OutOctets *float64
- InMcastOctets *float64
- OutMcastOctets *float64
- InBcastOctets *float64
- OutBcastOctets *float64
- InNoECTPkts *float64
- InECT1Pkts *float64
- InECT0Pkts *float64
- InCEPkts *float64
-}
-
-type Icmp6 struct {
- InMsgs *float64
- InErrors *float64
- OutMsgs *float64
- OutErrors *float64
- InCsumErrors *float64
- InDestUnreachs *float64
- InPktTooBigs *float64
- InTimeExcds *float64
- InParmProblems *float64
- InEchos *float64
- InEchoReplies *float64
- InGroupMembQueries *float64
- InGroupMembResponses *float64
- InGroupMembReductions *float64
- InRouterSolicits *float64
- InRouterAdvertisements *float64
- InNeighborSolicits *float64
- InNeighborAdvertisements *float64
- InRedirects *float64
- InMLDv2Reports *float64
- OutDestUnreachs *float64
- OutPktTooBigs *float64
- OutTimeExcds *float64
- OutParmProblems *float64
- OutEchos *float64
- OutEchoReplies *float64
- OutGroupMembQueries *float64
- OutGroupMembResponses *float64
- OutGroupMembReductions *float64
- OutRouterSolicits *float64
- OutRouterAdvertisements *float64
- OutNeighborSolicits *float64
- OutNeighborAdvertisements *float64
- OutRedirects *float64
- OutMLDv2Reports *float64
- InType1 *float64
- InType134 *float64
- InType135 *float64
- InType136 *float64
- InType143 *float64
- OutType133 *float64
- OutType135 *float64
- OutType136 *float64
- OutType143 *float64
-}
-
-type Udp6 struct { // nolint:revive
- InDatagrams *float64
- NoPorts *float64
- InErrors *float64
- OutDatagrams *float64
- RcvbufErrors *float64
- SndbufErrors *float64
- InCsumErrors *float64
- IgnoredMulti *float64
-}
-
-type UdpLite6 struct { // nolint:revive
- InDatagrams *float64
- NoPorts *float64
- InErrors *float64
- OutDatagrams *float64
- RcvbufErrors *float64
- SndbufErrors *float64
- InCsumErrors *float64
-}
-
-func (p Proc) Snmp6() (ProcSnmp6, error) {
- filename := p.path("net/snmp6")
- data, err := util.ReadFileNoStat(filename)
- if err != nil {
- // On systems with IPv6 disabled, this file won't exist.
- // Do nothing.
- if errors.Is(err, os.ErrNotExist) {
- return ProcSnmp6{PID: p.PID}, nil
- }
-
- return ProcSnmp6{PID: p.PID}, err
- }
-
- procSnmp6, err := parseSNMP6Stats(bytes.NewReader(data))
- procSnmp6.PID = p.PID
- return procSnmp6, err
-}
-
-// parseSnmp6 parses the metrics from proc//net/snmp6 file
-// and returns a map contains those metrics.
-func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) {
- var (
- scanner = bufio.NewScanner(r)
- procSnmp6 = ProcSnmp6{}
- )
-
- for scanner.Scan() {
- stat := strings.Fields(scanner.Text())
- if len(stat) < 2 {
- continue
- }
- // Expect to have "6" in metric name, skip line otherwise
- if sixIndex := strings.Index(stat[0], "6"); sixIndex != -1 {
- protocol := stat[0][:sixIndex+1]
- key := stat[0][sixIndex+1:]
- value, err := strconv.ParseFloat(stat[1], 64)
- if err != nil {
- return procSnmp6, err
- }
-
- switch protocol {
- case "Ip6":
- switch key {
- case "InReceives":
- procSnmp6.Ip6.InReceives = &value
- case "InHdrErrors":
- procSnmp6.Ip6.InHdrErrors = &value
- case "InTooBigErrors":
- procSnmp6.Ip6.InTooBigErrors = &value
- case "InNoRoutes":
- procSnmp6.Ip6.InNoRoutes = &value
- case "InAddrErrors":
- procSnmp6.Ip6.InAddrErrors = &value
- case "InUnknownProtos":
- procSnmp6.Ip6.InUnknownProtos = &value
- case "InTruncatedPkts":
- procSnmp6.Ip6.InTruncatedPkts = &value
- case "InDiscards":
- procSnmp6.Ip6.InDiscards = &value
- case "InDelivers":
- procSnmp6.Ip6.InDelivers = &value
- case "OutForwDatagrams":
- procSnmp6.Ip6.OutForwDatagrams = &value
- case "OutRequests":
- procSnmp6.Ip6.OutRequests = &value
- case "OutDiscards":
- procSnmp6.Ip6.OutDiscards = &value
- case "OutNoRoutes":
- procSnmp6.Ip6.OutNoRoutes = &value
- case "ReasmTimeout":
- procSnmp6.Ip6.ReasmTimeout = &value
- case "ReasmReqds":
- procSnmp6.Ip6.ReasmReqds = &value
- case "ReasmOKs":
- procSnmp6.Ip6.ReasmOKs = &value
- case "ReasmFails":
- procSnmp6.Ip6.ReasmFails = &value
- case "FragOKs":
- procSnmp6.Ip6.FragOKs = &value
- case "FragFails":
- procSnmp6.Ip6.FragFails = &value
- case "FragCreates":
- procSnmp6.Ip6.FragCreates = &value
- case "InMcastPkts":
- procSnmp6.Ip6.InMcastPkts = &value
- case "OutMcastPkts":
- procSnmp6.Ip6.OutMcastPkts = &value
- case "InOctets":
- procSnmp6.Ip6.InOctets = &value
- case "OutOctets":
- procSnmp6.Ip6.OutOctets = &value
- case "InMcastOctets":
- procSnmp6.Ip6.InMcastOctets = &value
- case "OutMcastOctets":
- procSnmp6.Ip6.OutMcastOctets = &value
- case "InBcastOctets":
- procSnmp6.Ip6.InBcastOctets = &value
- case "OutBcastOctets":
- procSnmp6.Ip6.OutBcastOctets = &value
- case "InNoECTPkts":
- procSnmp6.Ip6.InNoECTPkts = &value
- case "InECT1Pkts":
- procSnmp6.Ip6.InECT1Pkts = &value
- case "InECT0Pkts":
- procSnmp6.Ip6.InECT0Pkts = &value
- case "InCEPkts":
- procSnmp6.Ip6.InCEPkts = &value
-
- }
- case "Icmp6":
- switch key {
- case "InMsgs":
- procSnmp6.Icmp6.InMsgs = &value
- case "InErrors":
- procSnmp6.Icmp6.InErrors = &value
- case "OutMsgs":
- procSnmp6.Icmp6.OutMsgs = &value
- case "OutErrors":
- procSnmp6.Icmp6.OutErrors = &value
- case "InCsumErrors":
- procSnmp6.Icmp6.InCsumErrors = &value
- case "InDestUnreachs":
- procSnmp6.Icmp6.InDestUnreachs = &value
- case "InPktTooBigs":
- procSnmp6.Icmp6.InPktTooBigs = &value
- case "InTimeExcds":
- procSnmp6.Icmp6.InTimeExcds = &value
- case "InParmProblems":
- procSnmp6.Icmp6.InParmProblems = &value
- case "InEchos":
- procSnmp6.Icmp6.InEchos = &value
- case "InEchoReplies":
- procSnmp6.Icmp6.InEchoReplies = &value
- case "InGroupMembQueries":
- procSnmp6.Icmp6.InGroupMembQueries = &value
- case "InGroupMembResponses":
- procSnmp6.Icmp6.InGroupMembResponses = &value
- case "InGroupMembReductions":
- procSnmp6.Icmp6.InGroupMembReductions = &value
- case "InRouterSolicits":
- procSnmp6.Icmp6.InRouterSolicits = &value
- case "InRouterAdvertisements":
- procSnmp6.Icmp6.InRouterAdvertisements = &value
- case "InNeighborSolicits":
- procSnmp6.Icmp6.InNeighborSolicits = &value
- case "InNeighborAdvertisements":
- procSnmp6.Icmp6.InNeighborAdvertisements = &value
- case "InRedirects":
- procSnmp6.Icmp6.InRedirects = &value
- case "InMLDv2Reports":
- procSnmp6.Icmp6.InMLDv2Reports = &value
- case "OutDestUnreachs":
- procSnmp6.Icmp6.OutDestUnreachs = &value
- case "OutPktTooBigs":
- procSnmp6.Icmp6.OutPktTooBigs = &value
- case "OutTimeExcds":
- procSnmp6.Icmp6.OutTimeExcds = &value
- case "OutParmProblems":
- procSnmp6.Icmp6.OutParmProblems = &value
- case "OutEchos":
- procSnmp6.Icmp6.OutEchos = &value
- case "OutEchoReplies":
- procSnmp6.Icmp6.OutEchoReplies = &value
- case "OutGroupMembQueries":
- procSnmp6.Icmp6.OutGroupMembQueries = &value
- case "OutGroupMembResponses":
- procSnmp6.Icmp6.OutGroupMembResponses = &value
- case "OutGroupMembReductions":
- procSnmp6.Icmp6.OutGroupMembReductions = &value
- case "OutRouterSolicits":
- procSnmp6.Icmp6.OutRouterSolicits = &value
- case "OutRouterAdvertisements":
- procSnmp6.Icmp6.OutRouterAdvertisements = &value
- case "OutNeighborSolicits":
- procSnmp6.Icmp6.OutNeighborSolicits = &value
- case "OutNeighborAdvertisements":
- procSnmp6.Icmp6.OutNeighborAdvertisements = &value
- case "OutRedirects":
- procSnmp6.Icmp6.OutRedirects = &value
- case "OutMLDv2Reports":
- procSnmp6.Icmp6.OutMLDv2Reports = &value
- case "InType1":
- procSnmp6.Icmp6.InType1 = &value
- case "InType134":
- procSnmp6.Icmp6.InType134 = &value
- case "InType135":
- procSnmp6.Icmp6.InType135 = &value
- case "InType136":
- procSnmp6.Icmp6.InType136 = &value
- case "InType143":
- procSnmp6.Icmp6.InType143 = &value
- case "OutType133":
- procSnmp6.Icmp6.OutType133 = &value
- case "OutType135":
- procSnmp6.Icmp6.OutType135 = &value
- case "OutType136":
- procSnmp6.Icmp6.OutType136 = &value
- case "OutType143":
- procSnmp6.Icmp6.OutType143 = &value
- }
- case "Udp6":
- switch key {
- case "InDatagrams":
- procSnmp6.Udp6.InDatagrams = &value
- case "NoPorts":
- procSnmp6.Udp6.NoPorts = &value
- case "InErrors":
- procSnmp6.Udp6.InErrors = &value
- case "OutDatagrams":
- procSnmp6.Udp6.OutDatagrams = &value
- case "RcvbufErrors":
- procSnmp6.Udp6.RcvbufErrors = &value
- case "SndbufErrors":
- procSnmp6.Udp6.SndbufErrors = &value
- case "InCsumErrors":
- procSnmp6.Udp6.InCsumErrors = &value
- case "IgnoredMulti":
- procSnmp6.Udp6.IgnoredMulti = &value
- }
- case "UdpLite6":
- switch key {
- case "InDatagrams":
- procSnmp6.UdpLite6.InDatagrams = &value
- case "NoPorts":
- procSnmp6.UdpLite6.NoPorts = &value
- case "InErrors":
- procSnmp6.UdpLite6.InErrors = &value
- case "OutDatagrams":
- procSnmp6.UdpLite6.OutDatagrams = &value
- case "RcvbufErrors":
- procSnmp6.UdpLite6.RcvbufErrors = &value
- case "SndbufErrors":
- procSnmp6.UdpLite6.SndbufErrors = &value
- case "InCsumErrors":
- procSnmp6.UdpLite6.InCsumErrors = &value
- }
- }
- }
- }
- return procSnmp6, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go
deleted file mode 100644
index 923e550..0000000
--- a/vendor/github.com/prometheus/procfs/proc_stat.go
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "os"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Originally, this USER_HZ value was dynamically retrieved via a sysconf call
-// which required cgo. However, that caused a lot of problems regarding
-// cross-compilation. Alternatives such as running a binary to determine the
-// value, or trying to derive it in some other way were all problematic. After
-// much research it was determined that USER_HZ is actually hardcoded to 100 on
-// all Go-supported platforms as of the time of this writing. This is why we
-// decided to hardcode it here as well. It is not impossible that there could
-// be systems with exceptions, but they should be very exotic edge cases, and
-// in that case, the worst outcome will be two misreported metrics.
-//
-// See also the following discussions:
-//
-// - https://github.com/prometheus/node_exporter/issues/52
-// - https://github.com/prometheus/procfs/pull/2
-// - http://stackoverflow.com/questions/17410841/how-does-user-hz-solve-the-jiffy-scaling-issue
-const userHZ = 100
-
-// ProcStat provides status information about the process,
-// read from /proc/[pid]/stat.
-type ProcStat struct {
- // The process ID.
- PID int
- // The filename of the executable.
- Comm string
- // The process state.
- State string
- // The PID of the parent of this process.
- PPID int
- // The process group ID of the process.
- PGRP int
- // The session ID of the process.
- Session int
- // The controlling terminal of the process.
- TTY int
- // The ID of the foreground process group of the controlling terminal of
- // the process.
- TPGID int
- // The kernel flags word of the process.
- Flags uint
- // The number of minor faults the process has made which have not required
- // loading a memory page from disk.
- MinFlt uint
- // The number of minor faults that the process's waited-for children have
- // made.
- CMinFlt uint
- // The number of major faults the process has made which have required
- // loading a memory page from disk.
- MajFlt uint
- // The number of major faults that the process's waited-for children have
- // made.
- CMajFlt uint
- // Amount of time that this process has been scheduled in user mode,
- // measured in clock ticks.
- UTime uint
- // Amount of time that this process has been scheduled in kernel mode,
- // measured in clock ticks.
- STime uint
- // Amount of time that this process's waited-for children have been
- // scheduled in user mode, measured in clock ticks.
- CUTime int
- // Amount of time that this process's waited-for children have been
- // scheduled in kernel mode, measured in clock ticks.
- CSTime int
- // For processes running a real-time scheduling policy, this is the negated
- // scheduling priority, minus one.
- Priority int
- // The nice value, a value in the range 19 (low priority) to -20 (high
- // priority).
- Nice int
- // Number of threads in this process.
- NumThreads int
- // The time the process started after system boot, the value is expressed
- // in clock ticks.
- Starttime uint64
- // Virtual memory size in bytes.
- VSize uint
- // Resident set size in pages.
- RSS int
- // Soft limit in bytes on the rss of the process.
- RSSLimit uint64
- // CPU number last executed on.
- Processor uint
- // Real-time scheduling priority, a number in the range 1 to 99 for processes
- // scheduled under a real-time policy, or 0, for non-real-time processes.
- RTPriority uint
- // Scheduling policy.
- Policy uint
- // Aggregated block I/O delays, measured in clock ticks (centiseconds).
- DelayAcctBlkIOTicks uint64
-
- proc FS
-}
-
-// NewStat returns the current status information of the process.
-//
-// Deprecated: Use p.Stat() instead.
-func (p Proc) NewStat() (ProcStat, error) {
- return p.Stat()
-}
-
-// Stat returns the current status information of the process.
-func (p Proc) Stat() (ProcStat, error) {
- data, err := util.ReadFileNoStat(p.path("stat"))
- if err != nil {
- return ProcStat{}, err
- }
-
- var (
- ignoreInt64 int64
- ignoreUint64 uint64
-
- s = ProcStat{PID: p.PID, proc: p.fs}
- l = bytes.Index(data, []byte("("))
- r = bytes.LastIndex(data, []byte(")"))
- )
-
- if l < 0 || r < 0 {
- return ProcStat{}, fmt.Errorf("%w: unexpected format, couldn't extract comm %q", ErrFileParse, data)
- }
-
- s.Comm = string(data[l+1 : r])
-
- // Check the following resources for the details about the particular stat
- // fields and their data types:
- // * https://man7.org/linux/man-pages/man5/proc.5.html
- // * https://man7.org/linux/man-pages/man3/scanf.3.html
- _, err = fmt.Fscan(
- bytes.NewBuffer(data[r+2:]),
- &s.State,
- &s.PPID,
- &s.PGRP,
- &s.Session,
- &s.TTY,
- &s.TPGID,
- &s.Flags,
- &s.MinFlt,
- &s.CMinFlt,
- &s.MajFlt,
- &s.CMajFlt,
- &s.UTime,
- &s.STime,
- &s.CUTime,
- &s.CSTime,
- &s.Priority,
- &s.Nice,
- &s.NumThreads,
- &ignoreInt64,
- &s.Starttime,
- &s.VSize,
- &s.RSS,
- &s.RSSLimit,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreUint64,
- &ignoreInt64,
- &s.Processor,
- &s.RTPriority,
- &s.Policy,
- &s.DelayAcctBlkIOTicks,
- )
- if err != nil {
- return ProcStat{}, err
- }
-
- return s, nil
-}
-
-// VirtualMemory returns the virtual memory size in bytes.
-func (s ProcStat) VirtualMemory() uint {
- return s.VSize
-}
-
-// ResidentMemory returns the resident memory size in bytes.
-func (s ProcStat) ResidentMemory() int {
- return s.RSS * os.Getpagesize()
-}
-
-// StartTime returns the unix timestamp of the process in seconds.
-func (s ProcStat) StartTime() (float64, error) {
- stat, err := s.proc.Stat()
- if err != nil {
- return 0, err
- }
- return float64(stat.BootTime) + (float64(s.Starttime) / userHZ), nil
-}
-
-// CPUTime returns the total CPU user and system time in seconds.
-func (s ProcStat) CPUTime() float64 {
- return float64(s.UTime+s.STime) / userHZ
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go
deleted file mode 100644
index 46307f5..0000000
--- a/vendor/github.com/prometheus/procfs/proc_status.go
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bytes"
- "sort"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// ProcStatus provides status information about the process,
-// read from /proc/[pid]/status.
-type ProcStatus struct {
- // The process ID.
- PID int
- // The process name.
- Name string
-
- // Thread group ID.
- TGID int
- // List of Pid namespace.
- NSpids []uint64
-
- // Peak virtual memory size.
- VmPeak uint64 // nolint:revive
- // Virtual memory size.
- VmSize uint64 // nolint:revive
- // Locked memory size.
- VmLck uint64 // nolint:revive
- // Pinned memory size.
- VmPin uint64 // nolint:revive
- // Peak resident set size.
- VmHWM uint64 // nolint:revive
- // Resident set size (sum of RssAnnon RssFile and RssShmem).
- VmRSS uint64 // nolint:revive
- // Size of resident anonymous memory.
- RssAnon uint64 // nolint:revive
- // Size of resident file mappings.
- RssFile uint64 // nolint:revive
- // Size of resident shared memory.
- RssShmem uint64 // nolint:revive
- // Size of data segments.
- VmData uint64 // nolint:revive
- // Size of stack segments.
- VmStk uint64 // nolint:revive
- // Size of text segments.
- VmExe uint64 // nolint:revive
- // Shared library code size.
- VmLib uint64 // nolint:revive
- // Page table entries size.
- VmPTE uint64 // nolint:revive
- // Size of second-level page tables.
- VmPMD uint64 // nolint:revive
- // Swapped-out virtual memory size by anonymous private.
- VmSwap uint64 // nolint:revive
- // Size of hugetlb memory portions
- HugetlbPages uint64
-
- // Number of voluntary context switches.
- VoluntaryCtxtSwitches uint64
- // Number of involuntary context switches.
- NonVoluntaryCtxtSwitches uint64
-
- // UIDs of the process (Real, effective, saved set, and filesystem UIDs)
- UIDs [4]string
- // GIDs of the process (Real, effective, saved set, and filesystem GIDs)
- GIDs [4]string
-
- // CpusAllowedList: List of cpu cores processes are allowed to run on.
- CpusAllowedList []uint64
-}
-
-// NewStatus returns the current status information of the process.
-func (p Proc) NewStatus() (ProcStatus, error) {
- data, err := util.ReadFileNoStat(p.path("status"))
- if err != nil {
- return ProcStatus{}, err
- }
-
- s := ProcStatus{PID: p.PID}
-
- lines := strings.Split(string(data), "\n")
- for _, line := range lines {
- if !bytes.Contains([]byte(line), []byte(":")) {
- continue
- }
-
- kv := strings.SplitN(line, ":", 2)
-
- // removes spaces
- k := strings.TrimSpace(kv[0])
- v := strings.TrimSpace(kv[1])
- // removes "kB"
- v = strings.TrimSuffix(v, " kB")
-
- // value to int when possible
- // we can skip error check here, 'cause vKBytes is not used when value is a string
- vKBytes, _ := strconv.ParseUint(v, 10, 64)
- // convert kB to B
- vBytes := vKBytes * 1024
-
- s.fillStatus(k, v, vKBytes, vBytes)
- }
-
- return s, nil
-}
-
-func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) {
- switch k {
- case "Tgid":
- s.TGID = int(vUint)
- case "Name":
- s.Name = vString
- case "Uid":
- copy(s.UIDs[:], strings.Split(vString, "\t"))
- case "Gid":
- copy(s.GIDs[:], strings.Split(vString, "\t"))
- case "NSpid":
- s.NSpids = calcNSPidsList(vString)
- case "VmPeak":
- s.VmPeak = vUintBytes
- case "VmSize":
- s.VmSize = vUintBytes
- case "VmLck":
- s.VmLck = vUintBytes
- case "VmPin":
- s.VmPin = vUintBytes
- case "VmHWM":
- s.VmHWM = vUintBytes
- case "VmRSS":
- s.VmRSS = vUintBytes
- case "RssAnon":
- s.RssAnon = vUintBytes
- case "RssFile":
- s.RssFile = vUintBytes
- case "RssShmem":
- s.RssShmem = vUintBytes
- case "VmData":
- s.VmData = vUintBytes
- case "VmStk":
- s.VmStk = vUintBytes
- case "VmExe":
- s.VmExe = vUintBytes
- case "VmLib":
- s.VmLib = vUintBytes
- case "VmPTE":
- s.VmPTE = vUintBytes
- case "VmPMD":
- s.VmPMD = vUintBytes
- case "VmSwap":
- s.VmSwap = vUintBytes
- case "HugetlbPages":
- s.HugetlbPages = vUintBytes
- case "voluntary_ctxt_switches":
- s.VoluntaryCtxtSwitches = vUint
- case "nonvoluntary_ctxt_switches":
- s.NonVoluntaryCtxtSwitches = vUint
- case "Cpus_allowed_list":
- s.CpusAllowedList = calcCpusAllowedList(vString)
- }
-
-}
-
-// TotalCtxtSwitches returns the total context switch.
-func (s ProcStatus) TotalCtxtSwitches() uint64 {
- return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches
-}
-
-func calcCpusAllowedList(cpuString string) []uint64 {
- s := strings.Split(cpuString, ",")
-
- var g []uint64
-
- for _, cpu := range s {
- // parse cpu ranges, example: 1-3=[1,2,3]
- if l := strings.Split(strings.TrimSpace(cpu), "-"); len(l) > 1 {
- startCPU, _ := strconv.ParseUint(l[0], 10, 64)
- endCPU, _ := strconv.ParseUint(l[1], 10, 64)
-
- for i := startCPU; i <= endCPU; i++ {
- g = append(g, i)
- }
- } else if len(l) == 1 {
- cpu, _ := strconv.ParseUint(l[0], 10, 64)
- g = append(g, cpu)
- }
-
- }
-
- sort.Slice(g, func(i, j int) bool { return g[i] < g[j] })
- return g
-}
-
-func calcNSPidsList(nspidsString string) []uint64 {
- s := strings.Split(nspidsString, " ")
- var nspids []uint64
-
- for _, nspid := range s {
- nspid, _ := strconv.ParseUint(nspid, 10, 64)
- if nspid == 0 {
- continue
- }
- nspids = append(nspids, nspid)
- }
-
- return nspids
-}
diff --git a/vendor/github.com/prometheus/procfs/proc_sys.go b/vendor/github.com/prometheus/procfs/proc_sys.go
deleted file mode 100644
index 12c5bf0..0000000
--- a/vendor/github.com/prometheus/procfs/proc_sys.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-func sysctlToPath(sysctl string) string {
- return strings.Replace(sysctl, ".", "/", -1)
-}
-
-func (fs FS) SysctlStrings(sysctl string) ([]string, error) {
- value, err := util.SysReadFile(fs.proc.Path("sys", sysctlToPath(sysctl)))
- if err != nil {
- return nil, err
- }
- return strings.Fields(value), nil
-
-}
-
-func (fs FS) SysctlInts(sysctl string) ([]int, error) {
- fields, err := fs.SysctlStrings(sysctl)
- if err != nil {
- return nil, err
- }
-
- values := make([]int, len(fields))
- for i, f := range fields {
- vp := util.NewValueParser(f)
- values[i] = vp.Int()
- if err := vp.Err(); err != nil {
- return nil, fmt.Errorf("%s: field %d in sysctl %s is not a valid int: %w", ErrFileParse, i, sysctl, err)
- }
- }
- return values, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/schedstat.go b/vendor/github.com/prometheus/procfs/schedstat.go
deleted file mode 100644
index 5f7f32d..0000000
--- a/vendor/github.com/prometheus/procfs/schedstat.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "errors"
- "os"
- "regexp"
- "strconv"
-)
-
-var (
- cpuLineRE = regexp.MustCompile(`cpu(\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)`)
- procLineRE = regexp.MustCompile(`(\d+) (\d+) (\d+)`)
-)
-
-// Schedstat contains scheduler statistics from /proc/schedstat
-//
-// See
-// https://www.kernel.org/doc/Documentation/scheduler/sched-stats.txt
-// for a detailed description of what these numbers mean.
-//
-// Note the current kernel documentation claims some of the time units are in
-// jiffies when they are actually in nanoseconds since 2.6.23 with the
-// introduction of CFS. A fix to the documentation is pending. See
-// https://lore.kernel.org/patchwork/project/lkml/list/?series=403473
-type Schedstat struct {
- CPUs []*SchedstatCPU
-}
-
-// SchedstatCPU contains the values from one "cpu" line.
-type SchedstatCPU struct {
- CPUNum string
-
- RunningNanoseconds uint64
- WaitingNanoseconds uint64
- RunTimeslices uint64
-}
-
-// ProcSchedstat contains the values from `/proc//schedstat`.
-type ProcSchedstat struct {
- RunningNanoseconds uint64
- WaitingNanoseconds uint64
- RunTimeslices uint64
-}
-
-// Schedstat reads data from `/proc/schedstat`.
-func (fs FS) Schedstat() (*Schedstat, error) {
- file, err := os.Open(fs.proc.Path("schedstat"))
- if err != nil {
- return nil, err
- }
- defer file.Close()
-
- stats := &Schedstat{}
- scanner := bufio.NewScanner(file)
-
- for scanner.Scan() {
- match := cpuLineRE.FindStringSubmatch(scanner.Text())
- if match != nil {
- cpu := &SchedstatCPU{}
- cpu.CPUNum = match[1]
-
- cpu.RunningNanoseconds, err = strconv.ParseUint(match[8], 10, 64)
- if err != nil {
- continue
- }
-
- cpu.WaitingNanoseconds, err = strconv.ParseUint(match[9], 10, 64)
- if err != nil {
- continue
- }
-
- cpu.RunTimeslices, err = strconv.ParseUint(match[10], 10, 64)
- if err != nil {
- continue
- }
-
- stats.CPUs = append(stats.CPUs, cpu)
- }
- }
-
- return stats, nil
-}
-
-func parseProcSchedstat(contents string) (ProcSchedstat, error) {
- var (
- stats ProcSchedstat
- err error
- )
- match := procLineRE.FindStringSubmatch(contents)
-
- if match != nil {
- stats.RunningNanoseconds, err = strconv.ParseUint(match[1], 10, 64)
- if err != nil {
- return stats, err
- }
-
- stats.WaitingNanoseconds, err = strconv.ParseUint(match[2], 10, 64)
- if err != nil {
- return stats, err
- }
-
- stats.RunTimeslices, err = strconv.ParseUint(match[3], 10, 64)
- return stats, err
- }
-
- return stats, errors.New("could not parse schedstat")
-}
diff --git a/vendor/github.com/prometheus/procfs/slab.go b/vendor/github.com/prometheus/procfs/slab.go
deleted file mode 100644
index 8611c90..0000000
--- a/vendor/github.com/prometheus/procfs/slab.go
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2020 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-var (
- slabSpace = regexp.MustCompile(`\s+`)
- slabVer = regexp.MustCompile(`slabinfo -`)
- slabHeader = regexp.MustCompile(`# name`)
-)
-
-// Slab represents a slab pool in the kernel.
-type Slab struct {
- Name string
- ObjActive int64
- ObjNum int64
- ObjSize int64
- ObjPerSlab int64
- PagesPerSlab int64
- // tunables
- Limit int64
- Batch int64
- SharedFactor int64
- SlabActive int64
- SlabNum int64
- SharedAvail int64
-}
-
-// SlabInfo represents info for all slabs.
-type SlabInfo struct {
- Slabs []*Slab
-}
-
-func shouldParseSlab(line string) bool {
- if slabVer.MatchString(line) {
- return false
- }
- if slabHeader.MatchString(line) {
- return false
- }
- return true
-}
-
-// parseV21SlabEntry is used to parse a line from /proc/slabinfo version 2.1.
-func parseV21SlabEntry(line string) (*Slab, error) {
- // First cleanup whitespace.
- l := slabSpace.ReplaceAllString(line, " ")
- s := strings.Split(l, " ")
- if len(s) != 16 {
- return nil, fmt.Errorf("%w: unable to parse: %q", ErrFileParse, line)
- }
- var err error
- i := &Slab{Name: s[0]}
- i.ObjActive, err = strconv.ParseInt(s[1], 10, 64)
- if err != nil {
- return nil, err
- }
- i.ObjNum, err = strconv.ParseInt(s[2], 10, 64)
- if err != nil {
- return nil, err
- }
- i.ObjSize, err = strconv.ParseInt(s[3], 10, 64)
- if err != nil {
- return nil, err
- }
- i.ObjPerSlab, err = strconv.ParseInt(s[4], 10, 64)
- if err != nil {
- return nil, err
- }
- i.PagesPerSlab, err = strconv.ParseInt(s[5], 10, 64)
- if err != nil {
- return nil, err
- }
- i.Limit, err = strconv.ParseInt(s[8], 10, 64)
- if err != nil {
- return nil, err
- }
- i.Batch, err = strconv.ParseInt(s[9], 10, 64)
- if err != nil {
- return nil, err
- }
- i.SharedFactor, err = strconv.ParseInt(s[10], 10, 64)
- if err != nil {
- return nil, err
- }
- i.SlabActive, err = strconv.ParseInt(s[13], 10, 64)
- if err != nil {
- return nil, err
- }
- i.SlabNum, err = strconv.ParseInt(s[14], 10, 64)
- if err != nil {
- return nil, err
- }
- i.SharedAvail, err = strconv.ParseInt(s[15], 10, 64)
- if err != nil {
- return nil, err
- }
- return i, nil
-}
-
-// parseSlabInfo21 is used to parse a slabinfo 2.1 file.
-func parseSlabInfo21(r *bytes.Reader) (SlabInfo, error) {
- scanner := bufio.NewScanner(r)
- s := SlabInfo{Slabs: []*Slab{}}
- for scanner.Scan() {
- line := scanner.Text()
- if !shouldParseSlab(line) {
- continue
- }
- slab, err := parseV21SlabEntry(line)
- if err != nil {
- return s, err
- }
- s.Slabs = append(s.Slabs, slab)
- }
- return s, nil
-}
-
-// SlabInfo reads data from `/proc/slabinfo`.
-func (fs FS) SlabInfo() (SlabInfo, error) {
- // TODO: Consider passing options to allow for parsing different
- // slabinfo versions. However, slabinfo 2.1 has been stable since
- // kernel 2.6.10 and later.
- data, err := util.ReadFileNoStat(fs.proc.Path("slabinfo"))
- if err != nil {
- return SlabInfo{}, err
- }
-
- return parseSlabInfo21(bytes.NewReader(data))
-}
diff --git a/vendor/github.com/prometheus/procfs/softirqs.go b/vendor/github.com/prometheus/procfs/softirqs.go
deleted file mode 100644
index b8fad67..0000000
--- a/vendor/github.com/prometheus/procfs/softirqs.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Softirqs represents the softirq statistics.
-type Softirqs struct {
- Hi []uint64
- Timer []uint64
- NetTx []uint64
- NetRx []uint64
- Block []uint64
- IRQPoll []uint64
- Tasklet []uint64
- Sched []uint64
- HRTimer []uint64
- RCU []uint64
-}
-
-func (fs FS) Softirqs() (Softirqs, error) {
- fileName := fs.proc.Path("softirqs")
- data, err := util.ReadFileNoStat(fileName)
- if err != nil {
- return Softirqs{}, err
- }
-
- reader := bytes.NewReader(data)
-
- return parseSoftirqs(reader)
-}
-
-func parseSoftirqs(r io.Reader) (Softirqs, error) {
- var (
- softirqs = Softirqs{}
- scanner = bufio.NewScanner(r)
- )
-
- if !scanner.Scan() {
- return Softirqs{}, fmt.Errorf("%w: softirqs empty", ErrFileRead)
- }
-
- for scanner.Scan() {
- parts := strings.Fields(scanner.Text())
- var err error
-
- // require at least one cpu
- if len(parts) < 2 {
- continue
- }
- switch {
- case parts[0] == "HI:":
- perCPU := parts[1:]
- softirqs.Hi = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.Hi[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (HI%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "TIMER:":
- perCPU := parts[1:]
- softirqs.Timer = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.Timer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (TIMER%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "NET_TX:":
- perCPU := parts[1:]
- softirqs.NetTx = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.NetTx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (NET_TX%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "NET_RX:":
- perCPU := parts[1:]
- softirqs.NetRx = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.NetRx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (NET_RX%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "BLOCK:":
- perCPU := parts[1:]
- softirqs.Block = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.Block[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (BLOCK%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "IRQ_POLL:":
- perCPU := parts[1:]
- softirqs.IRQPoll = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.IRQPoll[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (IRQ_POLL%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "TASKLET:":
- perCPU := parts[1:]
- softirqs.Tasklet = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.Tasklet[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (TASKLET%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "SCHED:":
- perCPU := parts[1:]
- softirqs.Sched = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.Sched[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (SCHED%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "HRTIMER:":
- perCPU := parts[1:]
- softirqs.HRTimer = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.HRTimer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (HRTIMER%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "RCU:":
- perCPU := parts[1:]
- softirqs.RCU = make([]uint64, len(perCPU))
- for i, count := range perCPU {
- if softirqs.RCU[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse %q (RCU%d): %w", ErrFileParse, count, i, err)
- }
- }
- }
- }
-
- if err := scanner.Err(); err != nil {
- return Softirqs{}, fmt.Errorf("%s: couldn't parse softirqs: %w", ErrFileParse, err)
- }
-
- return softirqs, scanner.Err()
-}
diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go
deleted file mode 100644
index 34fc3ee..0000000
--- a/vendor/github.com/prometheus/procfs/stat.go
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright 2018 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/fs"
- "github.com/prometheus/procfs/internal/util"
-)
-
-// CPUStat shows how much time the cpu spend in various stages.
-type CPUStat struct {
- User float64
- Nice float64
- System float64
- Idle float64
- Iowait float64
- IRQ float64
- SoftIRQ float64
- Steal float64
- Guest float64
- GuestNice float64
-}
-
-// SoftIRQStat represent the softirq statistics as exported in the procfs stat file.
-// A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html
-// It is possible to get per-cpu stats by reading `/proc/softirqs`.
-type SoftIRQStat struct {
- Hi uint64
- Timer uint64
- NetTx uint64
- NetRx uint64
- Block uint64
- BlockIoPoll uint64
- Tasklet uint64
- Sched uint64
- Hrtimer uint64
- Rcu uint64
-}
-
-// Stat represents kernel/system statistics.
-type Stat struct {
- // Boot time in seconds since the Epoch.
- BootTime uint64
- // Summed up cpu statistics.
- CPUTotal CPUStat
- // Per-CPU statistics.
- CPU map[int64]CPUStat
- // Number of times interrupts were handled, which contains numbered and unnumbered IRQs.
- IRQTotal uint64
- // Number of times a numbered IRQ was triggered.
- IRQ []uint64
- // Number of times a context switch happened.
- ContextSwitches uint64
- // Number of times a process was created.
- ProcessCreated uint64
- // Number of processes currently running.
- ProcessesRunning uint64
- // Number of processes currently blocked (waiting for IO).
- ProcessesBlocked uint64
- // Number of times a softirq was scheduled.
- SoftIRQTotal uint64
- // Detailed softirq statistics.
- SoftIRQ SoftIRQStat
-}
-
-// Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum).
-func parseCPUStat(line string) (CPUStat, int64, error) {
- cpuStat := CPUStat{}
- var cpu string
-
- count, err := fmt.Sscanf(line, "%s %f %f %f %f %f %f %f %f %f %f",
- &cpu,
- &cpuStat.User, &cpuStat.Nice, &cpuStat.System, &cpuStat.Idle,
- &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal,
- &cpuStat.Guest, &cpuStat.GuestNice)
-
- if err != nil && err != io.EOF {
- return CPUStat{}, -1, fmt.Errorf("%s: couldn't parse %q (cpu): %w", ErrFileParse, line, err)
- }
- if count == 0 {
- return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu): 0 elements parsed", ErrFileParse, line)
- }
-
- cpuStat.User /= userHZ
- cpuStat.Nice /= userHZ
- cpuStat.System /= userHZ
- cpuStat.Idle /= userHZ
- cpuStat.Iowait /= userHZ
- cpuStat.IRQ /= userHZ
- cpuStat.SoftIRQ /= userHZ
- cpuStat.Steal /= userHZ
- cpuStat.Guest /= userHZ
- cpuStat.GuestNice /= userHZ
-
- if cpu == "cpu" {
- return cpuStat, -1, nil
- }
-
- cpuID, err := strconv.ParseInt(cpu[3:], 10, 64)
- if err != nil {
- return CPUStat{}, -1, fmt.Errorf("%s: couldn't parse %q (cpu/cpuid): %w", ErrFileParse, line, err)
- }
-
- return cpuStat, cpuID, nil
-}
-
-// Parse a softirq line.
-func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) {
- softIRQStat := SoftIRQStat{}
- var total uint64
- var prefix string
-
- _, err := fmt.Sscanf(line, "%s %d %d %d %d %d %d %d %d %d %d %d",
- &prefix, &total,
- &softIRQStat.Hi, &softIRQStat.Timer, &softIRQStat.NetTx, &softIRQStat.NetRx,
- &softIRQStat.Block, &softIRQStat.BlockIoPoll,
- &softIRQStat.Tasklet, &softIRQStat.Sched,
- &softIRQStat.Hrtimer, &softIRQStat.Rcu)
-
- if err != nil {
- return SoftIRQStat{}, 0, fmt.Errorf("%s: couldn't parse %q (softirq): %w", ErrFileParse, line, err)
- }
-
- return softIRQStat, total, nil
-}
-
-// NewStat returns information about current cpu/process statistics.
-// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-//
-// Deprecated: Use fs.Stat() instead.
-func NewStat() (Stat, error) {
- fs, err := NewFS(fs.DefaultProcMountPoint)
- if err != nil {
- return Stat{}, err
- }
- return fs.Stat()
-}
-
-// NewStat returns information about current cpu/process statistics.
-// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-//
-// Deprecated: Use fs.Stat() instead.
-func (fs FS) NewStat() (Stat, error) {
- return fs.Stat()
-}
-
-// Stat returns information about current cpu/process statistics.
-// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
-func (fs FS) Stat() (Stat, error) {
- fileName := fs.proc.Path("stat")
- data, err := util.ReadFileNoStat(fileName)
- if err != nil {
- return Stat{}, err
- }
- procStat, err := parseStat(bytes.NewReader(data), fileName)
- if err != nil {
- return Stat{}, err
- }
- return procStat, nil
-}
-
-// parseStat parses the metrics from /proc/[pid]/stat.
-func parseStat(r io.Reader, fileName string) (Stat, error) {
- var (
- scanner = bufio.NewScanner(r)
- stat = Stat{
- CPU: make(map[int64]CPUStat),
- }
- err error
- )
-
- // Increase default scanner buffer to handle very long `intr` lines.
- buf := make([]byte, 0, 8*1024)
- scanner.Buffer(buf, 1024*1024)
-
- for scanner.Scan() {
- line := scanner.Text()
- parts := strings.Fields(scanner.Text())
- // require at least
- if len(parts) < 2 {
- continue
- }
- switch {
- case parts[0] == "btime":
- if stat.BootTime, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (btime): %w", ErrFileParse, parts[1], err)
- }
- case parts[0] == "intr":
- if stat.IRQTotal, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (intr): %w", ErrFileParse, parts[1], err)
- }
- numberedIRQs := parts[2:]
- stat.IRQ = make([]uint64, len(numberedIRQs))
- for i, count := range numberedIRQs {
- if stat.IRQ[i], err = strconv.ParseUint(count, 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (intr%d): %w", ErrFileParse, count, i, err)
- }
- }
- case parts[0] == "ctxt":
- if stat.ContextSwitches, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (ctxt): %w", ErrFileParse, parts[1], err)
- }
- case parts[0] == "processes":
- if stat.ProcessCreated, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (processes): %w", ErrFileParse, parts[1], err)
- }
- case parts[0] == "procs_running":
- if stat.ProcessesRunning, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (procs_running): %w", ErrFileParse, parts[1], err)
- }
- case parts[0] == "procs_blocked":
- if stat.ProcessesBlocked, err = strconv.ParseUint(parts[1], 10, 64); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q (procs_blocked): %w", ErrFileParse, parts[1], err)
- }
- case parts[0] == "softirq":
- softIRQStats, total, err := parseSoftIRQStat(line)
- if err != nil {
- return Stat{}, err
- }
- stat.SoftIRQTotal = total
- stat.SoftIRQ = softIRQStats
- case strings.HasPrefix(parts[0], "cpu"):
- cpuStat, cpuID, err := parseCPUStat(line)
- if err != nil {
- return Stat{}, err
- }
- if cpuID == -1 {
- stat.CPUTotal = cpuStat
- } else {
- stat.CPU[cpuID] = cpuStat
- }
- }
- }
-
- if err := scanner.Err(); err != nil {
- return Stat{}, fmt.Errorf("%s: couldn't parse %q: %w", ErrFileParse, fileName, err)
- }
-
- return stat, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/swaps.go b/vendor/github.com/prometheus/procfs/swaps.go
deleted file mode 100644
index fa00f55..0000000
--- a/vendor/github.com/prometheus/procfs/swaps.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Swap represents an entry in /proc/swaps.
-type Swap struct {
- Filename string
- Type string
- Size int
- Used int
- Priority int
-}
-
-// Swaps returns a slice of all configured swap devices on the system.
-func (fs FS) Swaps() ([]*Swap, error) {
- data, err := util.ReadFileNoStat(fs.proc.Path("swaps"))
- if err != nil {
- return nil, err
- }
- return parseSwaps(data)
-}
-
-func parseSwaps(info []byte) ([]*Swap, error) {
- swaps := []*Swap{}
- scanner := bufio.NewScanner(bytes.NewReader(info))
- scanner.Scan() // ignore header line
- for scanner.Scan() {
- swapString := scanner.Text()
- parsedSwap, err := parseSwapString(swapString)
- if err != nil {
- return nil, err
- }
- swaps = append(swaps, parsedSwap)
- }
-
- err := scanner.Err()
- return swaps, err
-}
-
-func parseSwapString(swapString string) (*Swap, error) {
- var err error
-
- swapFields := strings.Fields(swapString)
- swapLength := len(swapFields)
- if swapLength < 5 {
- return nil, fmt.Errorf("%w: too few fields in swap string: %s", ErrFileParse, swapString)
- }
-
- swap := &Swap{
- Filename: swapFields[0],
- Type: swapFields[1],
- }
-
- swap.Size, err = strconv.Atoi(swapFields[2])
- if err != nil {
- return nil, fmt.Errorf("%s: invalid swap size: %s: %w", ErrFileParse, swapFields[2], err)
- }
- swap.Used, err = strconv.Atoi(swapFields[3])
- if err != nil {
- return nil, fmt.Errorf("%s: invalid swap used: %s: %w", ErrFileParse, swapFields[3], err)
- }
- swap.Priority, err = strconv.Atoi(swapFields[4])
- if err != nil {
- return nil, fmt.Errorf("%s: invalid swap priority: %s: %w", ErrFileParse, swapFields[4], err)
- }
-
- return swap, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/thread.go b/vendor/github.com/prometheus/procfs/thread.go
deleted file mode 100644
index df2215e..0000000
--- a/vendor/github.com/prometheus/procfs/thread.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2022 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package procfs
-
-import (
- "fmt"
- "os"
- "strconv"
-
- fsi "github.com/prometheus/procfs/internal/fs"
-)
-
-// Provide access to /proc/PID/task/TID files, for thread specific values. Since
-// such files have the same structure as /proc/PID/ ones, the data structures
-// and the parsers for the latter may be reused.
-
-// AllThreads returns a list of all currently available threads under /proc/PID.
-func AllThreads(pid int) (Procs, error) {
- fs, err := NewFS(DefaultMountPoint)
- if err != nil {
- return Procs{}, err
- }
- return fs.AllThreads(pid)
-}
-
-// AllThreads returns a list of all currently available threads for PID.
-func (fs FS) AllThreads(pid int) (Procs, error) {
- taskPath := fs.proc.Path(strconv.Itoa(pid), "task")
- d, err := os.Open(taskPath)
- if err != nil {
- return Procs{}, err
- }
- defer d.Close()
-
- names, err := d.Readdirnames(-1)
- if err != nil {
- return Procs{}, fmt.Errorf("%s: could not read %q: %w", ErrFileRead, d.Name(), err)
- }
-
- t := Procs{}
- for _, n := range names {
- tid, err := strconv.ParseInt(n, 10, 64)
- if err != nil {
- continue
- }
-
- t = append(t, Proc{PID: int(tid), fs: FS{fsi.FS(taskPath), fs.isReal}})
- }
-
- return t, nil
-}
-
-// Thread returns a process for a given PID, TID.
-func (fs FS) Thread(pid, tid int) (Proc, error) {
- taskPath := fs.proc.Path(strconv.Itoa(pid), "task")
- if _, err := os.Stat(taskPath); err != nil {
- return Proc{}, err
- }
- return Proc{PID: tid, fs: FS{fsi.FS(taskPath), fs.isReal}}, nil
-}
-
-// Thread returns a process for a given TID of Proc.
-func (proc Proc) Thread(tid int) (Proc, error) {
- tfs := FS{fsi.FS(proc.path("task")), proc.fs.isReal}
- if _, err := os.Stat(tfs.proc.Path(strconv.Itoa(tid))); err != nil {
- return Proc{}, err
- }
- return Proc{PID: tid, fs: tfs}, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/ttar b/vendor/github.com/prometheus/procfs/ttar
deleted file mode 100644
index 19ef02b..0000000
--- a/vendor/github.com/prometheus/procfs/ttar
+++ /dev/null
@@ -1,413 +0,0 @@
-#!/usr/bin/env bash
-
-# Purpose: plain text tar format
-# Limitations: - only suitable for text files, directories, and symlinks
-# - stores only filename, content, and mode
-# - not designed for untrusted input
-#
-# Note: must work with bash version 3.2 (macOS)
-
-# Copyright 2017 Roger Luethi
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -o errexit -o nounset
-
-# Sanitize environment (for instance, standard sorting of glob matches)
-export LC_ALL=C
-
-path=""
-CMD=""
-ARG_STRING="$*"
-
-#------------------------------------------------------------------------------
-# Not all sed implementations can work on null bytes. In order to make ttar
-# work out of the box on macOS, use Python as a stream editor.
-
-USE_PYTHON=0
-
-PYTHON_CREATE_FILTER=$(cat << 'PCF'
-#!/usr/bin/env python
-
-import re
-import sys
-
-for line in sys.stdin:
- line = re.sub(r'EOF', r'\EOF', line)
- line = re.sub(r'NULLBYTE', r'\NULLBYTE', line)
- line = re.sub('\x00', r'NULLBYTE', line)
- sys.stdout.write(line)
-PCF
-)
-
-PYTHON_EXTRACT_FILTER=$(cat << 'PEF'
-#!/usr/bin/env python
-
-import re
-import sys
-
-for line in sys.stdin:
- line = re.sub(r'(?/dev/null; then
- echo "ERROR Python not found. Aborting."
- exit 2
- fi
- USE_PYTHON=1
- fi
-}
-
-#------------------------------------------------------------------------------
-
-function usage {
- bname=$(basename "$0")
- cat << USAGE
-Usage: $bname [-C ] -c -f (create archive)
- $bname -t -f (list archive contents)
- $bname [-C ] -x -f (extract archive)
-
-Options:
- -C (change directory)
- -v (verbose)
- --recursive-unlink (recursively delete existing directory if path
- collides with file or directory to extract)
-
-Example: Change to sysfs directory, create ttar file from fixtures directory
- $bname -C sysfs -c -f sysfs/fixtures.ttar fixtures/
-USAGE
-exit "$1"
-}
-
-function vecho {
- if [ "${VERBOSE:-}" == "yes" ]; then
- echo >&7 "$@"
- fi
-}
-
-function set_cmd {
- if [ -n "$CMD" ]; then
- echo "ERROR: more than one command given"
- echo
- usage 2
- fi
- CMD=$1
-}
-
-unset VERBOSE
-unset RECURSIVE_UNLINK
-
-while getopts :cf:-:htxvC: opt; do
- case $opt in
- c)
- set_cmd "create"
- ;;
- f)
- ARCHIVE=$OPTARG
- ;;
- h)
- usage 0
- ;;
- t)
- set_cmd "list"
- ;;
- x)
- set_cmd "extract"
- ;;
- v)
- VERBOSE=yes
- exec 7>&1
- ;;
- C)
- CDIR=$OPTARG
- ;;
- -)
- case $OPTARG in
- recursive-unlink)
- RECURSIVE_UNLINK="yes"
- ;;
- *)
- echo -e "Error: invalid option -$OPTARG"
- echo
- usage 1
- ;;
- esac
- ;;
- *)
- echo >&2 "ERROR: invalid option -$OPTARG"
- echo
- usage 1
- ;;
- esac
-done
-
-# Remove processed options from arguments
-shift $(( OPTIND - 1 ));
-
-if [ "${CMD:-}" == "" ]; then
- echo >&2 "ERROR: no command given"
- echo
- usage 1
-elif [ "${ARCHIVE:-}" == "" ]; then
- echo >&2 "ERROR: no archive name given"
- echo
- usage 1
-fi
-
-function list {
- local path=""
- local size=0
- local line_no=0
- local ttar_file=$1
- if [ -n "${2:-}" ]; then
- echo >&2 "ERROR: too many arguments."
- echo
- usage 1
- fi
- if [ ! -e "$ttar_file" ]; then
- echo >&2 "ERROR: file not found ($ttar_file)"
- echo
- usage 1
- fi
- while read -r line; do
- line_no=$(( line_no + 1 ))
- if [ $size -gt 0 ]; then
- size=$(( size - 1 ))
- continue
- fi
- if [[ $line =~ ^Path:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- elif [[ $line =~ ^Lines:\ (.*)$ ]]; then
- size=${BASH_REMATCH[1]}
- echo "$path"
- elif [[ $line =~ ^Directory:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- echo "$path/"
- elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then
- echo "$path -> ${BASH_REMATCH[1]}"
- fi
- done < "$ttar_file"
-}
-
-function extract {
- local path=""
- local size=0
- local line_no=0
- local ttar_file=$1
- if [ -n "${2:-}" ]; then
- echo >&2 "ERROR: too many arguments."
- echo
- usage 1
- fi
- if [ ! -e "$ttar_file" ]; then
- echo >&2 "ERROR: file not found ($ttar_file)"
- echo
- usage 1
- fi
- while IFS= read -r line; do
- line_no=$(( line_no + 1 ))
- local eof_without_newline
- if [ "$size" -gt 0 ]; then
- if [[ "$line" =~ [^\\]EOF ]]; then
- # An EOF not preceded by a backslash indicates that the line
- # does not end with a newline
- eof_without_newline=1
- else
- eof_without_newline=0
- fi
- # Replace NULLBYTE with null byte if at beginning of line
- # Replace NULLBYTE with null byte unless preceded by backslash
- # Remove one backslash in front of NULLBYTE (if any)
- # Remove EOF unless preceded by backslash
- # Remove one backslash in front of EOF
- if [ $USE_PYTHON -eq 1 ]; then
- echo -n "$line" | python -c "$PYTHON_EXTRACT_FILTER" >> "$path"
- else
- # The repeated pattern makes up for sed's lack of negative
- # lookbehind assertions (for consecutive null bytes).
- echo -n "$line" | \
- sed -e 's/^NULLBYTE/\x0/g;
- s/\([^\\]\)NULLBYTE/\1\x0/g;
- s/\([^\\]\)NULLBYTE/\1\x0/g;
- s/\\NULLBYTE/NULLBYTE/g;
- s/\([^\\]\)EOF/\1/g;
- s/\\EOF/EOF/g;
- ' >> "$path"
- fi
- if [[ "$eof_without_newline" -eq 0 ]]; then
- echo >> "$path"
- fi
- size=$(( size - 1 ))
- continue
- fi
- if [[ $line =~ ^Path:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- if [ -L "$path" ]; then
- rm "$path"
- elif [ -d "$path" ]; then
- if [ "${RECURSIVE_UNLINK:-}" == "yes" ]; then
- rm -r "$path"
- else
- # Safe because symlinks to directories are dealt with above
- rmdir "$path"
- fi
- elif [ -e "$path" ]; then
- rm "$path"
- fi
- elif [[ $line =~ ^Lines:\ (.*)$ ]]; then
- size=${BASH_REMATCH[1]}
- # Create file even if it is zero-length.
- touch "$path"
- vecho " $path"
- elif [[ $line =~ ^Mode:\ (.*)$ ]]; then
- mode=${BASH_REMATCH[1]}
- chmod "$mode" "$path"
- vecho "$mode"
- elif [[ $line =~ ^Directory:\ (.*)$ ]]; then
- path=${BASH_REMATCH[1]}
- mkdir -p "$path"
- vecho " $path/"
- elif [[ $line =~ ^SymlinkTo:\ (.*)$ ]]; then
- ln -s "${BASH_REMATCH[1]}" "$path"
- vecho " $path -> ${BASH_REMATCH[1]}"
- elif [[ $line =~ ^# ]]; then
- # Ignore comments between files
- continue
- else
- echo >&2 "ERROR: Unknown keyword on line $line_no: $line"
- exit 1
- fi
- done < "$ttar_file"
-}
-
-function div {
- echo "# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -" \
- "- - - - - -"
-}
-
-function get_mode {
- local mfile=$1
- if [ -z "${STAT_OPTION:-}" ]; then
- if stat -c '%a' "$mfile" >/dev/null 2>&1; then
- # GNU stat
- STAT_OPTION='-c'
- STAT_FORMAT='%a'
- else
- # BSD stat
- STAT_OPTION='-f'
- # Octal output, user/group/other (omit file type, sticky bit)
- STAT_FORMAT='%OLp'
- fi
- fi
- stat "${STAT_OPTION}" "${STAT_FORMAT}" "$mfile"
-}
-
-function _create {
- shopt -s nullglob
- local mode
- local eof_without_newline
- while (( "$#" )); do
- file=$1
- if [ -L "$file" ]; then
- echo "Path: $file"
- symlinkTo=$(readlink "$file")
- echo "SymlinkTo: $symlinkTo"
- vecho " $file -> $symlinkTo"
- div
- elif [ -d "$file" ]; then
- # Strip trailing slash (if there is one)
- file=${file%/}
- echo "Directory: $file"
- mode=$(get_mode "$file")
- echo "Mode: $mode"
- vecho "$mode $file/"
- div
- # Find all files and dirs, including hidden/dot files
- for x in "$file/"{*,.[^.]*}; do
- _create "$x"
- done
- elif [ -f "$file" ]; then
- echo "Path: $file"
- lines=$(wc -l "$file"|awk '{print $1}')
- eof_without_newline=0
- if [[ "$(wc -c "$file"|awk '{print $1}')" -gt 0 ]] && \
- [[ "$(tail -c 1 "$file" | wc -l)" -eq 0 ]]; then
- eof_without_newline=1
- lines=$((lines+1))
- fi
- echo "Lines: $lines"
- # Add backslash in front of EOF
- # Add backslash in front of NULLBYTE
- # Replace null byte with NULLBYTE
- if [ $USE_PYTHON -eq 1 ]; then
- < "$file" python -c "$PYTHON_CREATE_FILTER"
- else
- < "$file" \
- sed 's/EOF/\\EOF/g;
- s/NULLBYTE/\\NULLBYTE/g;
- s/\x0/NULLBYTE/g;
- '
- fi
- if [[ "$eof_without_newline" -eq 1 ]]; then
- # Finish line with EOF to indicate that the original line did
- # not end with a linefeed
- echo "EOF"
- fi
- mode=$(get_mode "$file")
- echo "Mode: $mode"
- vecho "$mode $file"
- div
- else
- echo >&2 "ERROR: file not found ($file in $(pwd))"
- exit 2
- fi
- shift
- done
-}
-
-function create {
- ttar_file=$1
- shift
- if [ -z "${1:-}" ]; then
- echo >&2 "ERROR: missing arguments."
- echo
- usage 1
- fi
- if [ -e "$ttar_file" ]; then
- rm "$ttar_file"
- fi
- exec > "$ttar_file"
- echo "# Archive created by ttar $ARG_STRING"
- _create "$@"
-}
-
-test_environment
-
-if [ -n "${CDIR:-}" ]; then
- if [[ "$ARCHIVE" != /* ]]; then
- # Relative path: preserve the archive's location before changing
- # directory
- ARCHIVE="$(pwd)/$ARCHIVE"
- fi
- cd "$CDIR"
-fi
-
-"$CMD" "$ARCHIVE" "$@"
diff --git a/vendor/github.com/prometheus/procfs/vm.go b/vendor/github.com/prometheus/procfs/vm.go
deleted file mode 100644
index 51c49d8..0000000
--- a/vendor/github.com/prometheus/procfs/vm.go
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows
-// +build !windows
-
-package procfs
-
-import (
- "fmt"
- "os"
- "path/filepath"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// The VM interface is described at
-//
-// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
-//
-// Each setting is exposed as a single file.
-// Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array
-// and numa_zonelist_order (deprecated) which is a string.
-type VM struct {
- AdminReserveKbytes *int64 // /proc/sys/vm/admin_reserve_kbytes
- BlockDump *int64 // /proc/sys/vm/block_dump
- CompactUnevictableAllowed *int64 // /proc/sys/vm/compact_unevictable_allowed
- DirtyBackgroundBytes *int64 // /proc/sys/vm/dirty_background_bytes
- DirtyBackgroundRatio *int64 // /proc/sys/vm/dirty_background_ratio
- DirtyBytes *int64 // /proc/sys/vm/dirty_bytes
- DirtyExpireCentisecs *int64 // /proc/sys/vm/dirty_expire_centisecs
- DirtyRatio *int64 // /proc/sys/vm/dirty_ratio
- DirtytimeExpireSeconds *int64 // /proc/sys/vm/dirtytime_expire_seconds
- DirtyWritebackCentisecs *int64 // /proc/sys/vm/dirty_writeback_centisecs
- DropCaches *int64 // /proc/sys/vm/drop_caches
- ExtfragThreshold *int64 // /proc/sys/vm/extfrag_threshold
- HugetlbShmGroup *int64 // /proc/sys/vm/hugetlb_shm_group
- LaptopMode *int64 // /proc/sys/vm/laptop_mode
- LegacyVaLayout *int64 // /proc/sys/vm/legacy_va_layout
- LowmemReserveRatio []*int64 // /proc/sys/vm/lowmem_reserve_ratio
- MaxMapCount *int64 // /proc/sys/vm/max_map_count
- MemoryFailureEarlyKill *int64 // /proc/sys/vm/memory_failure_early_kill
- MemoryFailureRecovery *int64 // /proc/sys/vm/memory_failure_recovery
- MinFreeKbytes *int64 // /proc/sys/vm/min_free_kbytes
- MinSlabRatio *int64 // /proc/sys/vm/min_slab_ratio
- MinUnmappedRatio *int64 // /proc/sys/vm/min_unmapped_ratio
- MmapMinAddr *int64 // /proc/sys/vm/mmap_min_addr
- NrHugepages *int64 // /proc/sys/vm/nr_hugepages
- NrHugepagesMempolicy *int64 // /proc/sys/vm/nr_hugepages_mempolicy
- NrOvercommitHugepages *int64 // /proc/sys/vm/nr_overcommit_hugepages
- NumaStat *int64 // /proc/sys/vm/numa_stat
- NumaZonelistOrder string // /proc/sys/vm/numa_zonelist_order
- OomDumpTasks *int64 // /proc/sys/vm/oom_dump_tasks
- OomKillAllocatingTask *int64 // /proc/sys/vm/oom_kill_allocating_task
- OvercommitKbytes *int64 // /proc/sys/vm/overcommit_kbytes
- OvercommitMemory *int64 // /proc/sys/vm/overcommit_memory
- OvercommitRatio *int64 // /proc/sys/vm/overcommit_ratio
- PageCluster *int64 // /proc/sys/vm/page-cluster
- PanicOnOom *int64 // /proc/sys/vm/panic_on_oom
- PercpuPagelistFraction *int64 // /proc/sys/vm/percpu_pagelist_fraction
- StatInterval *int64 // /proc/sys/vm/stat_interval
- Swappiness *int64 // /proc/sys/vm/swappiness
- UserReserveKbytes *int64 // /proc/sys/vm/user_reserve_kbytes
- VfsCachePressure *int64 // /proc/sys/vm/vfs_cache_pressure
- WatermarkBoostFactor *int64 // /proc/sys/vm/watermark_boost_factor
- WatermarkScaleFactor *int64 // /proc/sys/vm/watermark_scale_factor
- ZoneReclaimMode *int64 // /proc/sys/vm/zone_reclaim_mode
-}
-
-// VM reads the VM statistics from the specified `proc` filesystem.
-func (fs FS) VM() (*VM, error) {
- path := fs.proc.Path("sys/vm")
- file, err := os.Stat(path)
- if err != nil {
- return nil, err
- }
- if !file.Mode().IsDir() {
- return nil, fmt.Errorf("%w: %s is not a directory", ErrFileRead, path)
- }
-
- files, err := os.ReadDir(path)
- if err != nil {
- return nil, err
- }
-
- var vm VM
- for _, f := range files {
- if f.IsDir() {
- continue
- }
-
- name := filepath.Join(path, f.Name())
- // ignore errors on read, as there are some write only
- // in /proc/sys/vm
- value, err := util.SysReadFile(name)
- if err != nil {
- continue
- }
- vp := util.NewValueParser(value)
-
- switch f.Name() {
- case "admin_reserve_kbytes":
- vm.AdminReserveKbytes = vp.PInt64()
- case "block_dump":
- vm.BlockDump = vp.PInt64()
- case "compact_unevictable_allowed":
- vm.CompactUnevictableAllowed = vp.PInt64()
- case "dirty_background_bytes":
- vm.DirtyBackgroundBytes = vp.PInt64()
- case "dirty_background_ratio":
- vm.DirtyBackgroundRatio = vp.PInt64()
- case "dirty_bytes":
- vm.DirtyBytes = vp.PInt64()
- case "dirty_expire_centisecs":
- vm.DirtyExpireCentisecs = vp.PInt64()
- case "dirty_ratio":
- vm.DirtyRatio = vp.PInt64()
- case "dirtytime_expire_seconds":
- vm.DirtytimeExpireSeconds = vp.PInt64()
- case "dirty_writeback_centisecs":
- vm.DirtyWritebackCentisecs = vp.PInt64()
- case "drop_caches":
- vm.DropCaches = vp.PInt64()
- case "extfrag_threshold":
- vm.ExtfragThreshold = vp.PInt64()
- case "hugetlb_shm_group":
- vm.HugetlbShmGroup = vp.PInt64()
- case "laptop_mode":
- vm.LaptopMode = vp.PInt64()
- case "legacy_va_layout":
- vm.LegacyVaLayout = vp.PInt64()
- case "lowmem_reserve_ratio":
- stringSlice := strings.Fields(value)
- pint64Slice := make([]*int64, 0, len(stringSlice))
- for _, value := range stringSlice {
- vp := util.NewValueParser(value)
- pint64Slice = append(pint64Slice, vp.PInt64())
- }
- vm.LowmemReserveRatio = pint64Slice
- case "max_map_count":
- vm.MaxMapCount = vp.PInt64()
- case "memory_failure_early_kill":
- vm.MemoryFailureEarlyKill = vp.PInt64()
- case "memory_failure_recovery":
- vm.MemoryFailureRecovery = vp.PInt64()
- case "min_free_kbytes":
- vm.MinFreeKbytes = vp.PInt64()
- case "min_slab_ratio":
- vm.MinSlabRatio = vp.PInt64()
- case "min_unmapped_ratio":
- vm.MinUnmappedRatio = vp.PInt64()
- case "mmap_min_addr":
- vm.MmapMinAddr = vp.PInt64()
- case "nr_hugepages":
- vm.NrHugepages = vp.PInt64()
- case "nr_hugepages_mempolicy":
- vm.NrHugepagesMempolicy = vp.PInt64()
- case "nr_overcommit_hugepages":
- vm.NrOvercommitHugepages = vp.PInt64()
- case "numa_stat":
- vm.NumaStat = vp.PInt64()
- case "numa_zonelist_order":
- vm.NumaZonelistOrder = value
- case "oom_dump_tasks":
- vm.OomDumpTasks = vp.PInt64()
- case "oom_kill_allocating_task":
- vm.OomKillAllocatingTask = vp.PInt64()
- case "overcommit_kbytes":
- vm.OvercommitKbytes = vp.PInt64()
- case "overcommit_memory":
- vm.OvercommitMemory = vp.PInt64()
- case "overcommit_ratio":
- vm.OvercommitRatio = vp.PInt64()
- case "page-cluster":
- vm.PageCluster = vp.PInt64()
- case "panic_on_oom":
- vm.PanicOnOom = vp.PInt64()
- case "percpu_pagelist_fraction":
- vm.PercpuPagelistFraction = vp.PInt64()
- case "stat_interval":
- vm.StatInterval = vp.PInt64()
- case "swappiness":
- vm.Swappiness = vp.PInt64()
- case "user_reserve_kbytes":
- vm.UserReserveKbytes = vp.PInt64()
- case "vfs_cache_pressure":
- vm.VfsCachePressure = vp.PInt64()
- case "watermark_boost_factor":
- vm.WatermarkBoostFactor = vp.PInt64()
- case "watermark_scale_factor":
- vm.WatermarkScaleFactor = vp.PInt64()
- case "zone_reclaim_mode":
- vm.ZoneReclaimMode = vp.PInt64()
- }
- if err := vp.Err(); err != nil {
- return nil, err
- }
- }
-
- return &vm, nil
-}
diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go
deleted file mode 100644
index ce5fefa..0000000
--- a/vendor/github.com/prometheus/procfs/zoneinfo.go
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2019 The Prometheus Authors
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//go:build !windows
-// +build !windows
-
-package procfs
-
-import (
- "bytes"
- "fmt"
- "os"
- "regexp"
- "strings"
-
- "github.com/prometheus/procfs/internal/util"
-)
-
-// Zoneinfo holds info parsed from /proc/zoneinfo.
-type Zoneinfo struct {
- Node string
- Zone string
- NrFreePages *int64
- Min *int64
- Low *int64
- High *int64
- Scanned *int64
- Spanned *int64
- Present *int64
- Managed *int64
- NrActiveAnon *int64
- NrInactiveAnon *int64
- NrIsolatedAnon *int64
- NrAnonPages *int64
- NrAnonTransparentHugepages *int64
- NrActiveFile *int64
- NrInactiveFile *int64
- NrIsolatedFile *int64
- NrFilePages *int64
- NrSlabReclaimable *int64
- NrSlabUnreclaimable *int64
- NrMlockStack *int64
- NrKernelStack *int64
- NrMapped *int64
- NrDirty *int64
- NrWriteback *int64
- NrUnevictable *int64
- NrShmem *int64
- NrDirtied *int64
- NrWritten *int64
- NumaHit *int64
- NumaMiss *int64
- NumaForeign *int64
- NumaInterleave *int64
- NumaLocal *int64
- NumaOther *int64
- Protection []*int64
-}
-
-var nodeZoneRE = regexp.MustCompile(`(\d+), zone\s+(\w+)`)
-
-// Zoneinfo parses an zoneinfo-file (/proc/zoneinfo) and returns a slice of
-// structs containing the relevant info. More information available here:
-// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
-func (fs FS) Zoneinfo() ([]Zoneinfo, error) {
- data, err := os.ReadFile(fs.proc.Path("zoneinfo"))
- if err != nil {
- return nil, fmt.Errorf("%s: error reading zoneinfo %q: %w", ErrFileRead, fs.proc.Path("zoneinfo"), err)
- }
- zoneinfo, err := parseZoneinfo(data)
- if err != nil {
- return nil, fmt.Errorf("%s: error parsing zoneinfo %q: %w", ErrFileParse, fs.proc.Path("zoneinfo"), err)
- }
- return zoneinfo, nil
-}
-
-func parseZoneinfo(zoneinfoData []byte) ([]Zoneinfo, error) {
-
- zoneinfo := []Zoneinfo{}
-
- zoneinfoBlocks := bytes.Split(zoneinfoData, []byte("\nNode"))
- for _, block := range zoneinfoBlocks {
- var zoneinfoElement Zoneinfo
- lines := strings.Split(string(block), "\n")
- for _, line := range lines {
-
- if nodeZone := nodeZoneRE.FindStringSubmatch(line); nodeZone != nil {
- zoneinfoElement.Node = nodeZone[1]
- zoneinfoElement.Zone = nodeZone[2]
- continue
- }
- if strings.HasPrefix(strings.TrimSpace(line), "per-node stats") {
- continue
- }
- parts := strings.Fields(strings.TrimSpace(line))
- if len(parts) < 2 {
- continue
- }
- vp := util.NewValueParser(parts[1])
- switch parts[0] {
- case "nr_free_pages":
- zoneinfoElement.NrFreePages = vp.PInt64()
- case "min":
- zoneinfoElement.Min = vp.PInt64()
- case "low":
- zoneinfoElement.Low = vp.PInt64()
- case "high":
- zoneinfoElement.High = vp.PInt64()
- case "scanned":
- zoneinfoElement.Scanned = vp.PInt64()
- case "spanned":
- zoneinfoElement.Spanned = vp.PInt64()
- case "present":
- zoneinfoElement.Present = vp.PInt64()
- case "managed":
- zoneinfoElement.Managed = vp.PInt64()
- case "nr_active_anon":
- zoneinfoElement.NrActiveAnon = vp.PInt64()
- case "nr_inactive_anon":
- zoneinfoElement.NrInactiveAnon = vp.PInt64()
- case "nr_isolated_anon":
- zoneinfoElement.NrIsolatedAnon = vp.PInt64()
- case "nr_anon_pages":
- zoneinfoElement.NrAnonPages = vp.PInt64()
- case "nr_anon_transparent_hugepages":
- zoneinfoElement.NrAnonTransparentHugepages = vp.PInt64()
- case "nr_active_file":
- zoneinfoElement.NrActiveFile = vp.PInt64()
- case "nr_inactive_file":
- zoneinfoElement.NrInactiveFile = vp.PInt64()
- case "nr_isolated_file":
- zoneinfoElement.NrIsolatedFile = vp.PInt64()
- case "nr_file_pages":
- zoneinfoElement.NrFilePages = vp.PInt64()
- case "nr_slab_reclaimable":
- zoneinfoElement.NrSlabReclaimable = vp.PInt64()
- case "nr_slab_unreclaimable":
- zoneinfoElement.NrSlabUnreclaimable = vp.PInt64()
- case "nr_mlock_stack":
- zoneinfoElement.NrMlockStack = vp.PInt64()
- case "nr_kernel_stack":
- zoneinfoElement.NrKernelStack = vp.PInt64()
- case "nr_mapped":
- zoneinfoElement.NrMapped = vp.PInt64()
- case "nr_dirty":
- zoneinfoElement.NrDirty = vp.PInt64()
- case "nr_writeback":
- zoneinfoElement.NrWriteback = vp.PInt64()
- case "nr_unevictable":
- zoneinfoElement.NrUnevictable = vp.PInt64()
- case "nr_shmem":
- zoneinfoElement.NrShmem = vp.PInt64()
- case "nr_dirtied":
- zoneinfoElement.NrDirtied = vp.PInt64()
- case "nr_written":
- zoneinfoElement.NrWritten = vp.PInt64()
- case "numa_hit":
- zoneinfoElement.NumaHit = vp.PInt64()
- case "numa_miss":
- zoneinfoElement.NumaMiss = vp.PInt64()
- case "numa_foreign":
- zoneinfoElement.NumaForeign = vp.PInt64()
- case "numa_interleave":
- zoneinfoElement.NumaInterleave = vp.PInt64()
- case "numa_local":
- zoneinfoElement.NumaLocal = vp.PInt64()
- case "numa_other":
- zoneinfoElement.NumaOther = vp.PInt64()
- case "protection:":
- protectionParts := strings.Split(line, ":")
- protectionValues := strings.Replace(protectionParts[1], "(", "", 1)
- protectionValues = strings.Replace(protectionValues, ")", "", 1)
- protectionValues = strings.TrimSpace(protectionValues)
- protectionStringMap := strings.Split(protectionValues, ", ")
- val, err := util.ParsePInt64s(protectionStringMap)
- if err == nil {
- zoneinfoElement.Protection = val
- }
- }
-
- }
-
- zoneinfo = append(zoneinfo, zoneinfoElement)
- }
- return zoneinfo, nil
-}
diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go
index e7d3df4..b0e4198 100644
--- a/vendor/golang.org/x/sys/unix/aliases.go
+++ b/vendor/golang.org/x/sys/unix/aliases.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
index 16dc699..2f0fa76 100644
--- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
+++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build darwin && go1.12
+//go:build darwin
package unix
diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
index 64d1bb4..2b57e0f 100644
--- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go
@@ -13,6 +13,7 @@
package unix
import (
+ "errors"
"sync"
"unsafe"
)
@@ -169,25 +170,26 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
func Uname(uname *Utsname) error {
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
n := unsafe.Sizeof(uname.Sysname)
- if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
+ // Suppress ENOMEM errors to be compatible with the C library __xuname() implementation.
+ if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
return err
}
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
n = unsafe.Sizeof(uname.Nodename)
- if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
+ if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
return err
}
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
n = unsafe.Sizeof(uname.Release)
- if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
+ if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
return err
}
mib = []_C_int{CTL_KERN, KERN_VERSION}
n = unsafe.Sizeof(uname.Version)
- if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
+ if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
return err
}
@@ -205,7 +207,7 @@ func Uname(uname *Utsname) error {
mib = []_C_int{CTL_HW, HW_MACHINE}
n = unsafe.Sizeof(uname.Machine)
- if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
+ if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil && !errors.Is(err, ENOMEM) {
return err
}
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
index 0f85e29..5682e26 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -1849,6 +1849,105 @@ func Dup2(oldfd, newfd int) error {
//sys Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error)
//sys Fsopen(fsName string, flags int) (fd int, err error)
//sys Fspick(dirfd int, pathName string, flags int) (fd int, err error)
+
+//sys fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error)
+
+func fsconfigCommon(fd int, cmd uint, key string, value *byte, aux int) (err error) {
+ var keyp *byte
+ if keyp, err = BytePtrFromString(key); err != nil {
+ return
+ }
+ return fsconfig(fd, cmd, keyp, value, aux)
+}
+
+// FsconfigSetFlag is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_FLAG.
+//
+// fd is the filesystem context to act upon.
+// key the parameter key to set.
+func FsconfigSetFlag(fd int, key string) (err error) {
+ return fsconfigCommon(fd, FSCONFIG_SET_FLAG, key, nil, 0)
+}
+
+// FsconfigSetString is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_STRING.
+//
+// fd is the filesystem context to act upon.
+// key the parameter key to set.
+// value is the parameter value to set.
+func FsconfigSetString(fd int, key string, value string) (err error) {
+ var valuep *byte
+ if valuep, err = BytePtrFromString(value); err != nil {
+ return
+ }
+ return fsconfigCommon(fd, FSCONFIG_SET_STRING, key, valuep, 0)
+}
+
+// FsconfigSetBinary is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_BINARY.
+//
+// fd is the filesystem context to act upon.
+// key the parameter key to set.
+// value is the parameter value to set.
+func FsconfigSetBinary(fd int, key string, value []byte) (err error) {
+ if len(value) == 0 {
+ return EINVAL
+ }
+ return fsconfigCommon(fd, FSCONFIG_SET_BINARY, key, &value[0], len(value))
+}
+
+// FsconfigSetPath is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_PATH.
+//
+// fd is the filesystem context to act upon.
+// key the parameter key to set.
+// path is a non-empty path for specified key.
+// atfd is a file descriptor at which to start lookup from or AT_FDCWD.
+func FsconfigSetPath(fd int, key string, path string, atfd int) (err error) {
+ var valuep *byte
+ if valuep, err = BytePtrFromString(path); err != nil {
+ return
+ }
+ return fsconfigCommon(fd, FSCONFIG_SET_PATH, key, valuep, atfd)
+}
+
+// FsconfigSetPathEmpty is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_PATH_EMPTY. The same as
+// FconfigSetPath but with AT_PATH_EMPTY implied.
+func FsconfigSetPathEmpty(fd int, key string, path string, atfd int) (err error) {
+ var valuep *byte
+ if valuep, err = BytePtrFromString(path); err != nil {
+ return
+ }
+ return fsconfigCommon(fd, FSCONFIG_SET_PATH_EMPTY, key, valuep, atfd)
+}
+
+// FsconfigSetFd is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_SET_FD.
+//
+// fd is the filesystem context to act upon.
+// key the parameter key to set.
+// value is a file descriptor to be assigned to specified key.
+func FsconfigSetFd(fd int, key string, value int) (err error) {
+ return fsconfigCommon(fd, FSCONFIG_SET_FD, key, nil, value)
+}
+
+// FsconfigCreate is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_CMD_CREATE.
+//
+// fd is the filesystem context to act upon.
+func FsconfigCreate(fd int) (err error) {
+ return fsconfig(fd, FSCONFIG_CMD_CREATE, nil, nil, 0)
+}
+
+// FsconfigReconfigure is equivalent to fsconfig(2) called
+// with cmd == FSCONFIG_CMD_RECONFIGURE.
+//
+// fd is the filesystem context to act upon.
+func FsconfigReconfigure(fd int) (err error) {
+ return fsconfig(fd, FSCONFIG_CMD_RECONFIGURE, nil, nil, 0)
+}
+
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
//sysnb Getpgid(pid int) (pgid int, err error)
diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
index 1488d27..87d8612 100644
--- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go
@@ -906,6 +906,16 @@ func Fspick(dirfd int, pathName string, flags int) (fd int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func fsconfig(fd int, cmd uint, key *byte, value *byte, aux int) (err error) {
+ _, _, e1 := Syscall6(SYS_FSCONFIG, uintptr(fd), uintptr(cmd), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(value)), uintptr(aux), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go
index dc0c955..eff6bcd 100644
--- a/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -836,6 +836,15 @@ const (
FSPICK_EMPTY_PATH = 0x8
FSMOUNT_CLOEXEC = 0x1
+
+ FSCONFIG_SET_FLAG = 0x0
+ FSCONFIG_SET_STRING = 0x1
+ FSCONFIG_SET_BINARY = 0x2
+ FSCONFIG_SET_PATH = 0x3
+ FSCONFIG_SET_PATH_EMPTY = 0x4
+ FSCONFIG_SET_FD = 0x5
+ FSCONFIG_CMD_CREATE = 0x6
+ FSCONFIG_CMD_RECONFIGURE = 0x7
)
type OpenHow struct {
@@ -1550,6 +1559,7 @@ const (
IFLA_DEVLINK_PORT = 0x3e
IFLA_GSO_IPV4_MAX_SIZE = 0x3f
IFLA_GRO_IPV4_MAX_SIZE = 0x40
+ IFLA_DPLL_PIN = 0x41
IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0
IFLA_PROTO_DOWN_REASON_MASK = 0x1
IFLA_PROTO_DOWN_REASON_VALUE = 0x2
@@ -1565,6 +1575,7 @@ const (
IFLA_INET6_ICMP6STATS = 0x6
IFLA_INET6_TOKEN = 0x7
IFLA_INET6_ADDR_GEN_MODE = 0x8
+ IFLA_INET6_RA_MTU = 0x9
IFLA_BR_UNSPEC = 0x0
IFLA_BR_FORWARD_DELAY = 0x1
IFLA_BR_HELLO_TIME = 0x2
@@ -1612,6 +1623,9 @@ const (
IFLA_BR_MCAST_MLD_VERSION = 0x2c
IFLA_BR_VLAN_STATS_PER_PORT = 0x2d
IFLA_BR_MULTI_BOOLOPT = 0x2e
+ IFLA_BR_MCAST_QUERIER_STATE = 0x2f
+ IFLA_BR_FDB_N_LEARNED = 0x30
+ IFLA_BR_FDB_MAX_LEARNED = 0x31
IFLA_BRPORT_UNSPEC = 0x0
IFLA_BRPORT_STATE = 0x1
IFLA_BRPORT_PRIORITY = 0x2
@@ -1649,6 +1663,14 @@ const (
IFLA_BRPORT_BACKUP_PORT = 0x22
IFLA_BRPORT_MRP_RING_OPEN = 0x23
IFLA_BRPORT_MRP_IN_OPEN = 0x24
+ IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT = 0x25
+ IFLA_BRPORT_MCAST_EHT_HOSTS_CNT = 0x26
+ IFLA_BRPORT_LOCKED = 0x27
+ IFLA_BRPORT_MAB = 0x28
+ IFLA_BRPORT_MCAST_N_GROUPS = 0x29
+ IFLA_BRPORT_MCAST_MAX_GROUPS = 0x2a
+ IFLA_BRPORT_NEIGH_VLAN_SUPPRESS = 0x2b
+ IFLA_BRPORT_BACKUP_NHID = 0x2c
IFLA_INFO_UNSPEC = 0x0
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
@@ -1670,6 +1692,9 @@ const (
IFLA_MACVLAN_MACADDR = 0x4
IFLA_MACVLAN_MACADDR_DATA = 0x5
IFLA_MACVLAN_MACADDR_COUNT = 0x6
+ IFLA_MACVLAN_BC_QUEUE_LEN = 0x7
+ IFLA_MACVLAN_BC_QUEUE_LEN_USED = 0x8
+ IFLA_MACVLAN_BC_CUTOFF = 0x9
IFLA_VRF_UNSPEC = 0x0
IFLA_VRF_TABLE = 0x1
IFLA_VRF_PORT_UNSPEC = 0x0
@@ -1693,9 +1718,22 @@ const (
IFLA_XFRM_UNSPEC = 0x0
IFLA_XFRM_LINK = 0x1
IFLA_XFRM_IF_ID = 0x2
+ IFLA_XFRM_COLLECT_METADATA = 0x3
IFLA_IPVLAN_UNSPEC = 0x0
IFLA_IPVLAN_MODE = 0x1
IFLA_IPVLAN_FLAGS = 0x2
+ NETKIT_NEXT = -0x1
+ NETKIT_PASS = 0x0
+ NETKIT_DROP = 0x2
+ NETKIT_REDIRECT = 0x7
+ NETKIT_L2 = 0x0
+ NETKIT_L3 = 0x1
+ IFLA_NETKIT_UNSPEC = 0x0
+ IFLA_NETKIT_PEER_INFO = 0x1
+ IFLA_NETKIT_PRIMARY = 0x2
+ IFLA_NETKIT_POLICY = 0x3
+ IFLA_NETKIT_PEER_POLICY = 0x4
+ IFLA_NETKIT_MODE = 0x5
IFLA_VXLAN_UNSPEC = 0x0
IFLA_VXLAN_ID = 0x1
IFLA_VXLAN_GROUP = 0x2
@@ -1726,6 +1764,8 @@ const (
IFLA_VXLAN_GPE = 0x1b
IFLA_VXLAN_TTL_INHERIT = 0x1c
IFLA_VXLAN_DF = 0x1d
+ IFLA_VXLAN_VNIFILTER = 0x1e
+ IFLA_VXLAN_LOCALBYPASS = 0x1f
IFLA_GENEVE_UNSPEC = 0x0
IFLA_GENEVE_ID = 0x1
IFLA_GENEVE_REMOTE = 0x2
@@ -1740,6 +1780,7 @@ const (
IFLA_GENEVE_LABEL = 0xb
IFLA_GENEVE_TTL_INHERIT = 0xc
IFLA_GENEVE_DF = 0xd
+ IFLA_GENEVE_INNER_PROTO_INHERIT = 0xe
IFLA_BAREUDP_UNSPEC = 0x0
IFLA_BAREUDP_PORT = 0x1
IFLA_BAREUDP_ETHERTYPE = 0x2
@@ -1752,6 +1793,8 @@ const (
IFLA_GTP_FD1 = 0x2
IFLA_GTP_PDP_HASHSIZE = 0x3
IFLA_GTP_ROLE = 0x4
+ IFLA_GTP_CREATE_SOCKETS = 0x5
+ IFLA_GTP_RESTART_COUNT = 0x6
IFLA_BOND_UNSPEC = 0x0
IFLA_BOND_MODE = 0x1
IFLA_BOND_ACTIVE_SLAVE = 0x2
@@ -1781,6 +1824,9 @@ const (
IFLA_BOND_AD_ACTOR_SYSTEM = 0x1a
IFLA_BOND_TLB_DYNAMIC_LB = 0x1b
IFLA_BOND_PEER_NOTIF_DELAY = 0x1c
+ IFLA_BOND_AD_LACP_ACTIVE = 0x1d
+ IFLA_BOND_MISSED_MAX = 0x1e
+ IFLA_BOND_NS_IP6_TARGET = 0x1f
IFLA_BOND_AD_INFO_UNSPEC = 0x0
IFLA_BOND_AD_INFO_AGGREGATOR = 0x1
IFLA_BOND_AD_INFO_NUM_PORTS = 0x2
@@ -1796,6 +1842,7 @@ const (
IFLA_BOND_SLAVE_AD_AGGREGATOR_ID = 0x6
IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE = 0x7
IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE = 0x8
+ IFLA_BOND_SLAVE_PRIO = 0x9
IFLA_VF_INFO_UNSPEC = 0x0
IFLA_VF_INFO = 0x1
IFLA_VF_UNSPEC = 0x0
@@ -1854,8 +1901,16 @@ const (
IFLA_STATS_LINK_XSTATS_SLAVE = 0x3
IFLA_STATS_LINK_OFFLOAD_XSTATS = 0x4
IFLA_STATS_AF_SPEC = 0x5
+ IFLA_STATS_GETSET_UNSPEC = 0x0
+ IFLA_STATS_GET_FILTERS = 0x1
+ IFLA_STATS_SET_OFFLOAD_XSTATS_L3_STATS = 0x2
IFLA_OFFLOAD_XSTATS_UNSPEC = 0x0
IFLA_OFFLOAD_XSTATS_CPU_HIT = 0x1
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO = 0x2
+ IFLA_OFFLOAD_XSTATS_L3_STATS = 0x3
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_UNSPEC = 0x0
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST = 0x1
+ IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED = 0x2
IFLA_XDP_UNSPEC = 0x0
IFLA_XDP_FD = 0x1
IFLA_XDP_ATTACHED = 0x2
@@ -1885,6 +1940,11 @@ const (
IFLA_RMNET_UNSPEC = 0x0
IFLA_RMNET_MUX_ID = 0x1
IFLA_RMNET_FLAGS = 0x2
+ IFLA_MCTP_UNSPEC = 0x0
+ IFLA_MCTP_NET = 0x1
+ IFLA_DSA_UNSPEC = 0x0
+ IFLA_DSA_CONDUIT = 0x1
+ IFLA_DSA_MASTER = 0x1
)
const (
diff --git a/vendor/google.golang.org/protobuf/LICENSE b/vendor/google.golang.org/protobuf/LICENSE
deleted file mode 100644
index 49ea0f9..0000000
--- a/vendor/google.golang.org/protobuf/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2018 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/google.golang.org/protobuf/PATENTS b/vendor/google.golang.org/protobuf/PATENTS
deleted file mode 100644
index 7330990..0000000
--- a/vendor/google.golang.org/protobuf/PATENTS
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional IP Rights Grant (Patents)
-
-"This implementation" means the copyrightable works distributed by
-Google as part of the Go project.
-
-Google hereby grants to You a perpetual, worldwide, non-exclusive,
-no-charge, royalty-free, irrevocable (except as stated in this section)
-patent license to make, have made, use, offer to sell, sell, import,
-transfer and otherwise run, modify and propagate the contents of this
-implementation of Go, where such license applies only to those patent
-claims, both currently owned or controlled by Google and acquired in
-the future, licensable by Google that are necessarily infringed by this
-implementation of Go. This grant does not include claims that would be
-infringed only as a consequence of further modification of this
-implementation. If you or your agent or exclusive licensee institute or
-order or agree to the institution of patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging
-that this implementation of Go or any code incorporated within this
-implementation of Go constitutes direct or contributory patent
-infringement, or inducement of patent infringement, then any patent
-rights granted to you under this License for this implementation of Go
-shall terminate as of the date such litigation is filed.
diff --git a/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go b/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go
deleted file mode 100644
index 2ef36bb..0000000
--- a/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright 2022 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.
-
-// Package protodelim marshals and unmarshals varint size-delimited messages.
-package protodelim
-
-import (
- "bufio"
- "encoding/binary"
- "fmt"
- "io"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/proto"
-)
-
-// MarshalOptions is a configurable varint size-delimited marshaler.
-type MarshalOptions struct{ proto.MarshalOptions }
-
-// MarshalTo writes a varint size-delimited wire-format message to w.
-// If w returns an error, MarshalTo returns it unchanged.
-func (o MarshalOptions) MarshalTo(w io.Writer, m proto.Message) (int, error) {
- msgBytes, err := o.MarshalOptions.Marshal(m)
- if err != nil {
- return 0, err
- }
-
- sizeBytes := protowire.AppendVarint(nil, uint64(len(msgBytes)))
- sizeWritten, err := w.Write(sizeBytes)
- if err != nil {
- return sizeWritten, err
- }
- msgWritten, err := w.Write(msgBytes)
- if err != nil {
- return sizeWritten + msgWritten, err
- }
- return sizeWritten + msgWritten, nil
-}
-
-// MarshalTo writes a varint size-delimited wire-format message to w
-// with the default options.
-//
-// See the documentation for [MarshalOptions.MarshalTo].
-func MarshalTo(w io.Writer, m proto.Message) (int, error) {
- return MarshalOptions{}.MarshalTo(w, m)
-}
-
-// UnmarshalOptions is a configurable varint size-delimited unmarshaler.
-type UnmarshalOptions struct {
- proto.UnmarshalOptions
-
- // MaxSize is the maximum size in wire-format bytes of a single message.
- // Unmarshaling a message larger than MaxSize will return an error.
- // A zero MaxSize will default to 4 MiB.
- // Setting MaxSize to -1 disables the limit.
- MaxSize int64
-}
-
-const defaultMaxSize = 4 << 20 // 4 MiB, corresponds to the default gRPC max request/response size
-
-// SizeTooLargeError is an error that is returned when the unmarshaler encounters a message size
-// that is larger than its configured [UnmarshalOptions.MaxSize].
-type SizeTooLargeError struct {
- // Size is the varint size of the message encountered
- // that was larger than the provided MaxSize.
- Size uint64
-
- // MaxSize is the MaxSize limit configured in UnmarshalOptions, which Size exceeded.
- MaxSize uint64
-}
-
-func (e *SizeTooLargeError) Error() string {
- return fmt.Sprintf("message size %d exceeded unmarshaler's maximum configured size %d", e.Size, e.MaxSize)
-}
-
-// Reader is the interface expected by [UnmarshalFrom].
-// It is implemented by *[bufio.Reader].
-type Reader interface {
- io.Reader
- io.ByteReader
-}
-
-// UnmarshalFrom parses and consumes a varint size-delimited wire-format message
-// from r.
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-//
-// The error is [io.EOF] error only if no bytes are read.
-// If an EOF happens after reading some but not all the bytes,
-// UnmarshalFrom returns a non-io.EOF error.
-// In particular if r returns a non-io.EOF error, UnmarshalFrom returns it unchanged,
-// and if only a size is read with no subsequent message, [io.ErrUnexpectedEOF] is returned.
-func (o UnmarshalOptions) UnmarshalFrom(r Reader, m proto.Message) error {
- var sizeArr [binary.MaxVarintLen64]byte
- sizeBuf := sizeArr[:0]
- for i := range sizeArr {
- b, err := r.ReadByte()
- if err != nil {
- // Immediate EOF is unexpected.
- if err == io.EOF && i != 0 {
- break
- }
- return err
- }
- sizeBuf = append(sizeBuf, b)
- if b < 0x80 {
- break
- }
- }
- size, n := protowire.ConsumeVarint(sizeBuf)
- if n < 0 {
- return protowire.ParseError(n)
- }
-
- maxSize := o.MaxSize
- if maxSize == 0 {
- maxSize = defaultMaxSize
- }
- if maxSize != -1 && size > uint64(maxSize) {
- return errors.Wrap(&SizeTooLargeError{Size: size, MaxSize: uint64(maxSize)}, "")
- }
-
- var b []byte
- var err error
- if br, ok := r.(*bufio.Reader); ok {
- // Use the []byte from the bufio.Reader instead of having to allocate one.
- // This reduces CPU usage and allocated bytes.
- b, err = br.Peek(int(size))
- if err == nil {
- defer br.Discard(int(size))
- } else {
- b = nil
- }
- }
- if b == nil {
- b = make([]byte, size)
- _, err = io.ReadFull(r, b)
- }
-
- if err == io.EOF {
- return io.ErrUnexpectedEOF
- }
- if err != nil {
- return err
- }
- if err := o.Unmarshal(b, m); err != nil {
- return err
- }
- return nil
-}
-
-// UnmarshalFrom parses and consumes a varint size-delimited wire-format message
-// from r with the default options.
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-//
-// See the documentation for [UnmarshalOptions.UnmarshalFrom].
-func UnmarshalFrom(r Reader, m proto.Message) error {
- return UnmarshalOptions{}.UnmarshalFrom(r, m)
-}
diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go
deleted file mode 100644
index a45f112..0000000
--- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go
+++ /dev/null
@@ -1,772 +0,0 @@
-// Copyright 2018 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.
-
-package prototext
-
-import (
- "fmt"
- "unicode/utf8"
-
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/text"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/internal/set"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// Unmarshal reads the given []byte into the given [proto.Message].
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-func Unmarshal(b []byte, m proto.Message) error {
- return UnmarshalOptions{}.Unmarshal(b, m)
-}
-
-// UnmarshalOptions is a configurable textproto format unmarshaler.
-type UnmarshalOptions struct {
- pragma.NoUnkeyedLiterals
-
- // AllowPartial accepts input for messages that will result in missing
- // required fields. If AllowPartial is false (the default), Unmarshal will
- // return error if there are any missing required fields.
- AllowPartial bool
-
- // DiscardUnknown specifies whether to ignore unknown fields when parsing.
- // An unknown field is any field whose field name or field number does not
- // resolve to any known or extension field in the message.
- // By default, unmarshal rejects unknown fields as an error.
- DiscardUnknown bool
-
- // Resolver is used for looking up types when unmarshaling
- // google.protobuf.Any messages or extension fields.
- // If nil, this defaults to using protoregistry.GlobalTypes.
- Resolver interface {
- protoregistry.MessageTypeResolver
- protoregistry.ExtensionTypeResolver
- }
-}
-
-// Unmarshal reads the given []byte and populates the given [proto.Message]
-// using options in the UnmarshalOptions object.
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error {
- return o.unmarshal(b, m)
-}
-
-// unmarshal is a centralized function that all unmarshal operations go through.
-// For profiling purposes, avoid changing the name of this function or
-// introducing other code paths for unmarshal that do not go through this.
-func (o UnmarshalOptions) unmarshal(b []byte, m proto.Message) error {
- proto.Reset(m)
-
- if o.Resolver == nil {
- o.Resolver = protoregistry.GlobalTypes
- }
-
- dec := decoder{text.NewDecoder(b), o}
- if err := dec.unmarshalMessage(m.ProtoReflect(), false); err != nil {
- return err
- }
- if o.AllowPartial {
- return nil
- }
- return proto.CheckInitialized(m)
-}
-
-type decoder struct {
- *text.Decoder
- opts UnmarshalOptions
-}
-
-// newError returns an error object with position info.
-func (d decoder) newError(pos int, f string, x ...interface{}) error {
- line, column := d.Position(pos)
- head := fmt.Sprintf("(line %d:%d): ", line, column)
- return errors.New(head+f, x...)
-}
-
-// unexpectedTokenError returns a syntax error for the given unexpected token.
-func (d decoder) unexpectedTokenError(tok text.Token) error {
- return d.syntaxError(tok.Pos(), "unexpected token: %s", tok.RawString())
-}
-
-// syntaxError returns a syntax error for given position.
-func (d decoder) syntaxError(pos int, f string, x ...interface{}) error {
- line, column := d.Position(pos)
- head := fmt.Sprintf("syntax error (line %d:%d): ", line, column)
- return errors.New(head+f, x...)
-}
-
-// unmarshalMessage unmarshals into the given protoreflect.Message.
-func (d decoder) unmarshalMessage(m protoreflect.Message, checkDelims bool) error {
- messageDesc := m.Descriptor()
- if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
- return errors.New("no support for proto1 MessageSets")
- }
-
- if messageDesc.FullName() == genid.Any_message_fullname {
- return d.unmarshalAny(m, checkDelims)
- }
-
- if checkDelims {
- tok, err := d.Read()
- if err != nil {
- return err
- }
-
- if tok.Kind() != text.MessageOpen {
- return d.unexpectedTokenError(tok)
- }
- }
-
- var seenNums set.Ints
- var seenOneofs set.Ints
- fieldDescs := messageDesc.Fields()
-
- for {
- // Read field name.
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch typ := tok.Kind(); typ {
- case text.Name:
- // Continue below.
- case text.EOF:
- if checkDelims {
- return text.ErrUnexpectedEOF
- }
- return nil
- default:
- if checkDelims && typ == text.MessageClose {
- return nil
- }
- return d.unexpectedTokenError(tok)
- }
-
- // Resolve the field descriptor.
- var name protoreflect.Name
- var fd protoreflect.FieldDescriptor
- var xt protoreflect.ExtensionType
- var xtErr error
- var isFieldNumberName bool
-
- switch tok.NameKind() {
- case text.IdentName:
- name = protoreflect.Name(tok.IdentName())
- fd = fieldDescs.ByTextName(string(name))
-
- case text.TypeName:
- // Handle extensions only. This code path is not for Any.
- xt, xtErr = d.opts.Resolver.FindExtensionByName(protoreflect.FullName(tok.TypeName()))
-
- case text.FieldNumber:
- isFieldNumberName = true
- num := protoreflect.FieldNumber(tok.FieldNumber())
- if !num.IsValid() {
- return d.newError(tok.Pos(), "invalid field number: %d", num)
- }
- fd = fieldDescs.ByNumber(num)
- if fd == nil {
- xt, xtErr = d.opts.Resolver.FindExtensionByNumber(messageDesc.FullName(), num)
- }
- }
-
- if xt != nil {
- fd = xt.TypeDescriptor()
- if !messageDesc.ExtensionRanges().Has(fd.Number()) || fd.ContainingMessage().FullName() != messageDesc.FullName() {
- return d.newError(tok.Pos(), "message %v cannot be extended by %v", messageDesc.FullName(), fd.FullName())
- }
- } else if xtErr != nil && xtErr != protoregistry.NotFound {
- return d.newError(tok.Pos(), "unable to resolve [%s]: %v", tok.RawString(), xtErr)
- }
- if flags.ProtoLegacy {
- if fd != nil && fd.IsWeak() && fd.Message().IsPlaceholder() {
- fd = nil // reset since the weak reference is not linked in
- }
- }
-
- // Handle unknown fields.
- if fd == nil {
- if d.opts.DiscardUnknown || messageDesc.ReservedNames().Has(name) {
- d.skipValue()
- continue
- }
- return d.newError(tok.Pos(), "unknown field: %v", tok.RawString())
- }
-
- // Handle fields identified by field number.
- if isFieldNumberName {
- // TODO: Add an option to permit parsing field numbers.
- //
- // This requires careful thought as the MarshalOptions.EmitUnknown
- // option allows formatting unknown fields as the field number and the
- // best-effort textual representation of the field value. In that case,
- // it may not be possible to unmarshal the value from a parser that does
- // have information about the unknown field.
- return d.newError(tok.Pos(), "cannot specify field by number: %v", tok.RawString())
- }
-
- switch {
- case fd.IsList():
- kind := fd.Kind()
- if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
- return d.syntaxError(tok.Pos(), "missing field separator :")
- }
-
- list := m.Mutable(fd).List()
- if err := d.unmarshalList(fd, list); err != nil {
- return err
- }
-
- case fd.IsMap():
- mmap := m.Mutable(fd).Map()
- if err := d.unmarshalMap(fd, mmap); err != nil {
- return err
- }
-
- default:
- kind := fd.Kind()
- if kind != protoreflect.MessageKind && kind != protoreflect.GroupKind && !tok.HasSeparator() {
- return d.syntaxError(tok.Pos(), "missing field separator :")
- }
-
- // If field is a oneof, check if it has already been set.
- if od := fd.ContainingOneof(); od != nil {
- idx := uint64(od.Index())
- if seenOneofs.Has(idx) {
- return d.newError(tok.Pos(), "error parsing %q, oneof %v is already set", tok.RawString(), od.FullName())
- }
- seenOneofs.Set(idx)
- }
-
- num := uint64(fd.Number())
- if seenNums.Has(num) {
- return d.newError(tok.Pos(), "non-repeated field %q is repeated", tok.RawString())
- }
-
- if err := d.unmarshalSingular(fd, m); err != nil {
- return err
- }
- seenNums.Set(num)
- }
- }
-
- return nil
-}
-
-// unmarshalSingular unmarshals a non-repeated field value specified by the
-// given FieldDescriptor.
-func (d decoder) unmarshalSingular(fd protoreflect.FieldDescriptor, m protoreflect.Message) error {
- var val protoreflect.Value
- var err error
- switch fd.Kind() {
- case protoreflect.MessageKind, protoreflect.GroupKind:
- val = m.NewField(fd)
- err = d.unmarshalMessage(val.Message(), true)
- default:
- val, err = d.unmarshalScalar(fd)
- }
- if err == nil {
- m.Set(fd, val)
- }
- return err
-}
-
-// unmarshalScalar unmarshals a scalar/enum protoreflect.Value specified by the
-// given FieldDescriptor.
-func (d decoder) unmarshalScalar(fd protoreflect.FieldDescriptor) (protoreflect.Value, error) {
- tok, err := d.Read()
- if err != nil {
- return protoreflect.Value{}, err
- }
-
- if tok.Kind() != text.Scalar {
- return protoreflect.Value{}, d.unexpectedTokenError(tok)
- }
-
- kind := fd.Kind()
- switch kind {
- case protoreflect.BoolKind:
- if b, ok := tok.Bool(); ok {
- return protoreflect.ValueOfBool(b), nil
- }
-
- case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
- if n, ok := tok.Int32(); ok {
- return protoreflect.ValueOfInt32(n), nil
- }
-
- case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
- if n, ok := tok.Int64(); ok {
- return protoreflect.ValueOfInt64(n), nil
- }
-
- case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
- if n, ok := tok.Uint32(); ok {
- return protoreflect.ValueOfUint32(n), nil
- }
-
- case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
- if n, ok := tok.Uint64(); ok {
- return protoreflect.ValueOfUint64(n), nil
- }
-
- case protoreflect.FloatKind:
- if n, ok := tok.Float32(); ok {
- return protoreflect.ValueOfFloat32(n), nil
- }
-
- case protoreflect.DoubleKind:
- if n, ok := tok.Float64(); ok {
- return protoreflect.ValueOfFloat64(n), nil
- }
-
- case protoreflect.StringKind:
- if s, ok := tok.String(); ok {
- if strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
- return protoreflect.Value{}, d.newError(tok.Pos(), "contains invalid UTF-8")
- }
- return protoreflect.ValueOfString(s), nil
- }
-
- case protoreflect.BytesKind:
- if b, ok := tok.String(); ok {
- return protoreflect.ValueOfBytes([]byte(b)), nil
- }
-
- case protoreflect.EnumKind:
- if lit, ok := tok.Enum(); ok {
- // Lookup EnumNumber based on name.
- if enumVal := fd.Enum().Values().ByName(protoreflect.Name(lit)); enumVal != nil {
- return protoreflect.ValueOfEnum(enumVal.Number()), nil
- }
- }
- if num, ok := tok.Int32(); ok {
- return protoreflect.ValueOfEnum(protoreflect.EnumNumber(num)), nil
- }
-
- default:
- panic(fmt.Sprintf("invalid scalar kind %v", kind))
- }
-
- return protoreflect.Value{}, d.newError(tok.Pos(), "invalid value for %v type: %v", kind, tok.RawString())
-}
-
-// unmarshalList unmarshals into given protoreflect.List. A list value can
-// either be in [] syntax or simply just a single scalar/message value.
-func (d decoder) unmarshalList(fd protoreflect.FieldDescriptor, list protoreflect.List) error {
- tok, err := d.Peek()
- if err != nil {
- return err
- }
-
- switch fd.Kind() {
- case protoreflect.MessageKind, protoreflect.GroupKind:
- switch tok.Kind() {
- case text.ListOpen:
- d.Read()
- for {
- tok, err := d.Peek()
- if err != nil {
- return err
- }
-
- switch tok.Kind() {
- case text.ListClose:
- d.Read()
- return nil
- case text.MessageOpen:
- pval := list.NewElement()
- if err := d.unmarshalMessage(pval.Message(), true); err != nil {
- return err
- }
- list.Append(pval)
- default:
- return d.unexpectedTokenError(tok)
- }
- }
-
- case text.MessageOpen:
- pval := list.NewElement()
- if err := d.unmarshalMessage(pval.Message(), true); err != nil {
- return err
- }
- list.Append(pval)
- return nil
- }
-
- default:
- switch tok.Kind() {
- case text.ListOpen:
- d.Read()
- for {
- tok, err := d.Peek()
- if err != nil {
- return err
- }
-
- switch tok.Kind() {
- case text.ListClose:
- d.Read()
- return nil
- case text.Scalar:
- pval, err := d.unmarshalScalar(fd)
- if err != nil {
- return err
- }
- list.Append(pval)
- default:
- return d.unexpectedTokenError(tok)
- }
- }
-
- case text.Scalar:
- pval, err := d.unmarshalScalar(fd)
- if err != nil {
- return err
- }
- list.Append(pval)
- return nil
- }
- }
-
- return d.unexpectedTokenError(tok)
-}
-
-// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
-// textproto message containing {key: , value: }.
-func (d decoder) unmarshalMap(fd protoreflect.FieldDescriptor, mmap protoreflect.Map) error {
- // Determine ahead whether map entry is a scalar type or a message type in
- // order to call the appropriate unmarshalMapValue func inside
- // unmarshalMapEntry.
- var unmarshalMapValue func() (protoreflect.Value, error)
- switch fd.MapValue().Kind() {
- case protoreflect.MessageKind, protoreflect.GroupKind:
- unmarshalMapValue = func() (protoreflect.Value, error) {
- pval := mmap.NewValue()
- if err := d.unmarshalMessage(pval.Message(), true); err != nil {
- return protoreflect.Value{}, err
- }
- return pval, nil
- }
- default:
- unmarshalMapValue = func() (protoreflect.Value, error) {
- return d.unmarshalScalar(fd.MapValue())
- }
- }
-
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch tok.Kind() {
- case text.MessageOpen:
- return d.unmarshalMapEntry(fd, mmap, unmarshalMapValue)
-
- case text.ListOpen:
- for {
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch tok.Kind() {
- case text.ListClose:
- return nil
- case text.MessageOpen:
- if err := d.unmarshalMapEntry(fd, mmap, unmarshalMapValue); err != nil {
- return err
- }
- default:
- return d.unexpectedTokenError(tok)
- }
- }
-
- default:
- return d.unexpectedTokenError(tok)
- }
-}
-
-// unmarshalMap unmarshals into given protoreflect.Map. A map value is a
-// textproto message containing {key: , value: }.
-func (d decoder) unmarshalMapEntry(fd protoreflect.FieldDescriptor, mmap protoreflect.Map, unmarshalMapValue func() (protoreflect.Value, error)) error {
- var key protoreflect.MapKey
- var pval protoreflect.Value
-Loop:
- for {
- // Read field name.
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch tok.Kind() {
- case text.Name:
- if tok.NameKind() != text.IdentName {
- if !d.opts.DiscardUnknown {
- return d.newError(tok.Pos(), "unknown map entry field %q", tok.RawString())
- }
- d.skipValue()
- continue Loop
- }
- // Continue below.
- case text.MessageClose:
- break Loop
- default:
- return d.unexpectedTokenError(tok)
- }
-
- switch name := protoreflect.Name(tok.IdentName()); name {
- case genid.MapEntry_Key_field_name:
- if !tok.HasSeparator() {
- return d.syntaxError(tok.Pos(), "missing field separator :")
- }
- if key.IsValid() {
- return d.newError(tok.Pos(), "map entry %q cannot be repeated", name)
- }
- val, err := d.unmarshalScalar(fd.MapKey())
- if err != nil {
- return err
- }
- key = val.MapKey()
-
- case genid.MapEntry_Value_field_name:
- if kind := fd.MapValue().Kind(); (kind != protoreflect.MessageKind) && (kind != protoreflect.GroupKind) {
- if !tok.HasSeparator() {
- return d.syntaxError(tok.Pos(), "missing field separator :")
- }
- }
- if pval.IsValid() {
- return d.newError(tok.Pos(), "map entry %q cannot be repeated", name)
- }
- pval, err = unmarshalMapValue()
- if err != nil {
- return err
- }
-
- default:
- if !d.opts.DiscardUnknown {
- return d.newError(tok.Pos(), "unknown map entry field %q", name)
- }
- d.skipValue()
- }
- }
-
- if !key.IsValid() {
- key = fd.MapKey().Default().MapKey()
- }
- if !pval.IsValid() {
- switch fd.MapValue().Kind() {
- case protoreflect.MessageKind, protoreflect.GroupKind:
- // If value field is not set for message/group types, construct an
- // empty one as default.
- pval = mmap.NewValue()
- default:
- pval = fd.MapValue().Default()
- }
- }
- mmap.Set(key, pval)
- return nil
-}
-
-// unmarshalAny unmarshals an Any textproto. It can either be in expanded form
-// or non-expanded form.
-func (d decoder) unmarshalAny(m protoreflect.Message, checkDelims bool) error {
- var typeURL string
- var bValue []byte
- var seenTypeUrl bool
- var seenValue bool
- var isExpanded bool
-
- if checkDelims {
- tok, err := d.Read()
- if err != nil {
- return err
- }
-
- if tok.Kind() != text.MessageOpen {
- return d.unexpectedTokenError(tok)
- }
- }
-
-Loop:
- for {
- // Read field name. Can only have 3 possible field names, i.e. type_url,
- // value and type URL name inside [].
- tok, err := d.Read()
- if err != nil {
- return err
- }
- if typ := tok.Kind(); typ != text.Name {
- if checkDelims {
- if typ == text.MessageClose {
- break Loop
- }
- } else if typ == text.EOF {
- break Loop
- }
- return d.unexpectedTokenError(tok)
- }
-
- switch tok.NameKind() {
- case text.IdentName:
- // Both type_url and value fields require field separator :.
- if !tok.HasSeparator() {
- return d.syntaxError(tok.Pos(), "missing field separator :")
- }
-
- switch name := protoreflect.Name(tok.IdentName()); name {
- case genid.Any_TypeUrl_field_name:
- if seenTypeUrl {
- return d.newError(tok.Pos(), "duplicate %v field", genid.Any_TypeUrl_field_fullname)
- }
- if isExpanded {
- return d.newError(tok.Pos(), "conflict with [%s] field", typeURL)
- }
- tok, err := d.Read()
- if err != nil {
- return err
- }
- var ok bool
- typeURL, ok = tok.String()
- if !ok {
- return d.newError(tok.Pos(), "invalid %v field value: %v", genid.Any_TypeUrl_field_fullname, tok.RawString())
- }
- seenTypeUrl = true
-
- case genid.Any_Value_field_name:
- if seenValue {
- return d.newError(tok.Pos(), "duplicate %v field", genid.Any_Value_field_fullname)
- }
- if isExpanded {
- return d.newError(tok.Pos(), "conflict with [%s] field", typeURL)
- }
- tok, err := d.Read()
- if err != nil {
- return err
- }
- s, ok := tok.String()
- if !ok {
- return d.newError(tok.Pos(), "invalid %v field value: %v", genid.Any_Value_field_fullname, tok.RawString())
- }
- bValue = []byte(s)
- seenValue = true
-
- default:
- if !d.opts.DiscardUnknown {
- return d.newError(tok.Pos(), "invalid field name %q in %v message", tok.RawString(), genid.Any_message_fullname)
- }
- }
-
- case text.TypeName:
- if isExpanded {
- return d.newError(tok.Pos(), "cannot have more than one type")
- }
- if seenTypeUrl {
- return d.newError(tok.Pos(), "conflict with type_url field")
- }
- typeURL = tok.TypeName()
- var err error
- bValue, err = d.unmarshalExpandedAny(typeURL, tok.Pos())
- if err != nil {
- return err
- }
- isExpanded = true
-
- default:
- if !d.opts.DiscardUnknown {
- return d.newError(tok.Pos(), "invalid field name %q in %v message", tok.RawString(), genid.Any_message_fullname)
- }
- }
- }
-
- fds := m.Descriptor().Fields()
- if len(typeURL) > 0 {
- m.Set(fds.ByNumber(genid.Any_TypeUrl_field_number), protoreflect.ValueOfString(typeURL))
- }
- if len(bValue) > 0 {
- m.Set(fds.ByNumber(genid.Any_Value_field_number), protoreflect.ValueOfBytes(bValue))
- }
- return nil
-}
-
-func (d decoder) unmarshalExpandedAny(typeURL string, pos int) ([]byte, error) {
- mt, err := d.opts.Resolver.FindMessageByURL(typeURL)
- if err != nil {
- return nil, d.newError(pos, "unable to resolve message [%v]: %v", typeURL, err)
- }
- // Create new message for the embedded message type and unmarshal the value
- // field into it.
- m := mt.New()
- if err := d.unmarshalMessage(m, true); err != nil {
- return nil, err
- }
- // Serialize the embedded message and return the resulting bytes.
- b, err := proto.MarshalOptions{
- AllowPartial: true, // Never check required fields inside an Any.
- Deterministic: true,
- }.Marshal(m.Interface())
- if err != nil {
- return nil, d.newError(pos, "error in marshaling message into Any.value: %v", err)
- }
- return b, nil
-}
-
-// skipValue makes the decoder parse a field value in order to advance the read
-// to the next field. It relies on Read returning an error if the types are not
-// in valid sequence.
-func (d decoder) skipValue() error {
- tok, err := d.Read()
- if err != nil {
- return err
- }
- // Only need to continue reading for messages and lists.
- switch tok.Kind() {
- case text.MessageOpen:
- return d.skipMessageValue()
-
- case text.ListOpen:
- for {
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch tok.Kind() {
- case text.ListClose:
- return nil
- case text.MessageOpen:
- if err := d.skipMessageValue(); err != nil {
- return err
- }
- default:
- // Skip items. This will not validate whether skipped values are
- // of the same type or not, same behavior as C++
- // TextFormat::Parser::AllowUnknownField(true) version 3.8.0.
- }
- }
- }
- return nil
-}
-
-// skipMessageValue makes the decoder parse and skip over all fields in a
-// message. It assumes that the previous read type is MessageOpen.
-func (d decoder) skipMessageValue() error {
- for {
- tok, err := d.Read()
- if err != nil {
- return err
- }
- switch tok.Kind() {
- case text.MessageClose:
- return nil
- case text.Name:
- if err := d.skipValue(); err != nil {
- return err
- }
- }
- }
-}
diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/doc.go b/vendor/google.golang.org/protobuf/encoding/prototext/doc.go
deleted file mode 100644
index 162b4f9..0000000
--- a/vendor/google.golang.org/protobuf/encoding/prototext/doc.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// 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.
-
-// Package prototext marshals and unmarshals protocol buffer messages as the
-// textproto format.
-package prototext
diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go b/vendor/google.golang.org/protobuf/encoding/prototext/encode.go
deleted file mode 100644
index 95967e8..0000000
--- a/vendor/google.golang.org/protobuf/encoding/prototext/encode.go
+++ /dev/null
@@ -1,376 +0,0 @@
-// Copyright 2018 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.
-
-package prototext
-
-import (
- "fmt"
- "strconv"
- "unicode/utf8"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/text"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/order"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-const defaultIndent = " "
-
-// Format formats the message as a multiline string.
-// This function is only intended for human consumption and ignores errors.
-// Do not depend on the output being stable. It may change over time across
-// different versions of the program.
-func Format(m proto.Message) string {
- return MarshalOptions{Multiline: true}.Format(m)
-}
-
-// Marshal writes the given [proto.Message] in textproto format using default
-// options. Do not depend on the output being stable. It may change over time
-// across different versions of the program.
-func Marshal(m proto.Message) ([]byte, error) {
- return MarshalOptions{}.Marshal(m)
-}
-
-// MarshalOptions is a configurable text format marshaler.
-type MarshalOptions struct {
- pragma.NoUnkeyedLiterals
-
- // Multiline specifies whether the marshaler should format the output in
- // indented-form with every textual element on a new line.
- // If Indent is an empty string, then an arbitrary indent is chosen.
- Multiline bool
-
- // Indent specifies the set of indentation characters to use in a multiline
- // formatted output such that every entry is preceded by Indent and
- // terminated by a newline. If non-empty, then Multiline is treated as true.
- // Indent can only be composed of space or tab characters.
- Indent string
-
- // EmitASCII specifies whether to format strings and bytes as ASCII only
- // as opposed to using UTF-8 encoding when possible.
- EmitASCII bool
-
- // allowInvalidUTF8 specifies whether to permit the encoding of strings
- // with invalid UTF-8. This is unexported as it is intended to only
- // be specified by the Format method.
- allowInvalidUTF8 bool
-
- // AllowPartial allows messages that have missing required fields to marshal
- // without returning an error. If AllowPartial is false (the default),
- // Marshal will return error if there are any missing required fields.
- AllowPartial bool
-
- // EmitUnknown specifies whether to emit unknown fields in the output.
- // If specified, the unmarshaler may be unable to parse the output.
- // The default is to exclude unknown fields.
- EmitUnknown bool
-
- // Resolver is used for looking up types when expanding google.protobuf.Any
- // messages. If nil, this defaults to using protoregistry.GlobalTypes.
- Resolver interface {
- protoregistry.ExtensionTypeResolver
- protoregistry.MessageTypeResolver
- }
-}
-
-// Format formats the message as a string.
-// This method is only intended for human consumption and ignores errors.
-// Do not depend on the output being stable. It may change over time across
-// different versions of the program.
-func (o MarshalOptions) Format(m proto.Message) string {
- if m == nil || !m.ProtoReflect().IsValid() {
- return "" // invalid syntax, but okay since this is for debugging
- }
- o.allowInvalidUTF8 = true
- o.AllowPartial = true
- o.EmitUnknown = true
- b, _ := o.Marshal(m)
- return string(b)
-}
-
-// Marshal writes the given [proto.Message] in textproto format using options in
-// MarshalOptions object. Do not depend on the output being stable. It may
-// change over time across different versions of the program.
-func (o MarshalOptions) Marshal(m proto.Message) ([]byte, error) {
- return o.marshal(nil, m)
-}
-
-// MarshalAppend appends the textproto format encoding of m to b,
-// returning the result.
-func (o MarshalOptions) MarshalAppend(b []byte, m proto.Message) ([]byte, error) {
- return o.marshal(b, m)
-}
-
-// marshal is a centralized function that all marshal operations go through.
-// For profiling purposes, avoid changing the name of this function or
-// introducing other code paths for marshal that do not go through this.
-func (o MarshalOptions) marshal(b []byte, m proto.Message) ([]byte, error) {
- var delims = [2]byte{'{', '}'}
-
- if o.Multiline && o.Indent == "" {
- o.Indent = defaultIndent
- }
- if o.Resolver == nil {
- o.Resolver = protoregistry.GlobalTypes
- }
-
- internalEnc, err := text.NewEncoder(b, o.Indent, delims, o.EmitASCII)
- if err != nil {
- return nil, err
- }
-
- // Treat nil message interface as an empty message,
- // in which case there is nothing to output.
- if m == nil {
- return b, nil
- }
-
- enc := encoder{internalEnc, o}
- err = enc.marshalMessage(m.ProtoReflect(), false)
- if err != nil {
- return nil, err
- }
- out := enc.Bytes()
- if len(o.Indent) > 0 && len(out) > 0 {
- out = append(out, '\n')
- }
- if o.AllowPartial {
- return out, nil
- }
- return out, proto.CheckInitialized(m)
-}
-
-type encoder struct {
- *text.Encoder
- opts MarshalOptions
-}
-
-// marshalMessage marshals the given protoreflect.Message.
-func (e encoder) marshalMessage(m protoreflect.Message, inclDelims bool) error {
- messageDesc := m.Descriptor()
- if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) {
- return errors.New("no support for proto1 MessageSets")
- }
-
- if inclDelims {
- e.StartMessage()
- defer e.EndMessage()
- }
-
- // Handle Any expansion.
- if messageDesc.FullName() == genid.Any_message_fullname {
- if e.marshalAny(m) {
- return nil
- }
- // If unable to expand, continue on to marshal Any as a regular message.
- }
-
- // Marshal fields.
- var err error
- order.RangeFields(m, order.IndexNameFieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- if err = e.marshalField(fd.TextName(), v, fd); err != nil {
- return false
- }
- return true
- })
- if err != nil {
- return err
- }
-
- // Marshal unknown fields.
- if e.opts.EmitUnknown {
- e.marshalUnknown(m.GetUnknown())
- }
-
- return nil
-}
-
-// marshalField marshals the given field with protoreflect.Value.
-func (e encoder) marshalField(name string, val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
- switch {
- case fd.IsList():
- return e.marshalList(name, val.List(), fd)
- case fd.IsMap():
- return e.marshalMap(name, val.Map(), fd)
- default:
- e.WriteName(name)
- return e.marshalSingular(val, fd)
- }
-}
-
-// marshalSingular marshals the given non-repeated field value. This includes
-// all scalar types, enums, messages, and groups.
-func (e encoder) marshalSingular(val protoreflect.Value, fd protoreflect.FieldDescriptor) error {
- kind := fd.Kind()
- switch kind {
- case protoreflect.BoolKind:
- e.WriteBool(val.Bool())
-
- case protoreflect.StringKind:
- s := val.String()
- if !e.opts.allowInvalidUTF8 && strs.EnforceUTF8(fd) && !utf8.ValidString(s) {
- return errors.InvalidUTF8(string(fd.FullName()))
- }
- e.WriteString(s)
-
- case protoreflect.Int32Kind, protoreflect.Int64Kind,
- protoreflect.Sint32Kind, protoreflect.Sint64Kind,
- protoreflect.Sfixed32Kind, protoreflect.Sfixed64Kind:
- e.WriteInt(val.Int())
-
- case protoreflect.Uint32Kind, protoreflect.Uint64Kind,
- protoreflect.Fixed32Kind, protoreflect.Fixed64Kind:
- e.WriteUint(val.Uint())
-
- case protoreflect.FloatKind:
- // Encoder.WriteFloat handles the special numbers NaN and infinites.
- e.WriteFloat(val.Float(), 32)
-
- case protoreflect.DoubleKind:
- // Encoder.WriteFloat handles the special numbers NaN and infinites.
- e.WriteFloat(val.Float(), 64)
-
- case protoreflect.BytesKind:
- e.WriteString(string(val.Bytes()))
-
- case protoreflect.EnumKind:
- num := val.Enum()
- if desc := fd.Enum().Values().ByNumber(num); desc != nil {
- e.WriteLiteral(string(desc.Name()))
- } else {
- // Use numeric value if there is no enum description.
- e.WriteInt(int64(num))
- }
-
- case protoreflect.MessageKind, protoreflect.GroupKind:
- return e.marshalMessage(val.Message(), true)
-
- default:
- panic(fmt.Sprintf("%v has unknown kind: %v", fd.FullName(), kind))
- }
- return nil
-}
-
-// marshalList marshals the given protoreflect.List as multiple name-value fields.
-func (e encoder) marshalList(name string, list protoreflect.List, fd protoreflect.FieldDescriptor) error {
- size := list.Len()
- for i := 0; i < size; i++ {
- e.WriteName(name)
- if err := e.marshalSingular(list.Get(i), fd); err != nil {
- return err
- }
- }
- return nil
-}
-
-// marshalMap marshals the given protoreflect.Map as multiple name-value fields.
-func (e encoder) marshalMap(name string, mmap protoreflect.Map, fd protoreflect.FieldDescriptor) error {
- var err error
- order.RangeEntries(mmap, order.GenericKeyOrder, func(key protoreflect.MapKey, val protoreflect.Value) bool {
- e.WriteName(name)
- e.StartMessage()
- defer e.EndMessage()
-
- e.WriteName(string(genid.MapEntry_Key_field_name))
- err = e.marshalSingular(key.Value(), fd.MapKey())
- if err != nil {
- return false
- }
-
- e.WriteName(string(genid.MapEntry_Value_field_name))
- err = e.marshalSingular(val, fd.MapValue())
- if err != nil {
- return false
- }
- return true
- })
- return err
-}
-
-// marshalUnknown parses the given []byte and marshals fields out.
-// This function assumes proper encoding in the given []byte.
-func (e encoder) marshalUnknown(b []byte) {
- const dec = 10
- const hex = 16
- for len(b) > 0 {
- num, wtype, n := protowire.ConsumeTag(b)
- b = b[n:]
- e.WriteName(strconv.FormatInt(int64(num), dec))
-
- switch wtype {
- case protowire.VarintType:
- var v uint64
- v, n = protowire.ConsumeVarint(b)
- e.WriteUint(v)
- case protowire.Fixed32Type:
- var v uint32
- v, n = protowire.ConsumeFixed32(b)
- e.WriteLiteral("0x" + strconv.FormatUint(uint64(v), hex))
- case protowire.Fixed64Type:
- var v uint64
- v, n = protowire.ConsumeFixed64(b)
- e.WriteLiteral("0x" + strconv.FormatUint(v, hex))
- case protowire.BytesType:
- var v []byte
- v, n = protowire.ConsumeBytes(b)
- e.WriteString(string(v))
- case protowire.StartGroupType:
- e.StartMessage()
- var v []byte
- v, n = protowire.ConsumeGroup(num, b)
- e.marshalUnknown(v)
- e.EndMessage()
- default:
- panic(fmt.Sprintf("prototext: error parsing unknown field wire type: %v", wtype))
- }
-
- b = b[n:]
- }
-}
-
-// marshalAny marshals the given google.protobuf.Any message in expanded form.
-// It returns true if it was able to marshal, else false.
-func (e encoder) marshalAny(any protoreflect.Message) bool {
- // Construct the embedded message.
- fds := any.Descriptor().Fields()
- fdType := fds.ByNumber(genid.Any_TypeUrl_field_number)
- typeURL := any.Get(fdType).String()
- mt, err := e.opts.Resolver.FindMessageByURL(typeURL)
- if err != nil {
- return false
- }
- m := mt.New().Interface()
-
- // Unmarshal bytes into embedded message.
- fdValue := fds.ByNumber(genid.Any_Value_field_number)
- value := any.Get(fdValue)
- err = proto.UnmarshalOptions{
- AllowPartial: true,
- Resolver: e.opts.Resolver,
- }.Unmarshal(value.Bytes(), m)
- if err != nil {
- return false
- }
-
- // Get current encoder position. If marshaling fails, reset encoder output
- // back to this position.
- pos := e.Snapshot()
-
- // Field name is the proto field name enclosed in [].
- e.WriteName("[" + typeURL + "]")
- err = e.marshalMessage(m.ProtoReflect(), true)
- if err != nil {
- e.Reset(pos)
- return false
- }
- return true
-}
diff --git a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go b/vendor/google.golang.org/protobuf/encoding/protowire/wire.go
deleted file mode 100644
index e942bc9..0000000
--- a/vendor/google.golang.org/protobuf/encoding/protowire/wire.go
+++ /dev/null
@@ -1,547 +0,0 @@
-// Copyright 2018 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.
-
-// Package protowire parses and formats the raw wire encoding.
-// See https://protobuf.dev/programming-guides/encoding.
-//
-// For marshaling and unmarshaling entire protobuf messages,
-// use the [google.golang.org/protobuf/proto] package instead.
-package protowire
-
-import (
- "io"
- "math"
- "math/bits"
-
- "google.golang.org/protobuf/internal/errors"
-)
-
-// Number represents the field number.
-type Number int32
-
-const (
- MinValidNumber Number = 1
- FirstReservedNumber Number = 19000
- LastReservedNumber Number = 19999
- MaxValidNumber Number = 1<<29 - 1
- DefaultRecursionLimit = 10000
-)
-
-// IsValid reports whether the field number is semantically valid.
-func (n Number) IsValid() bool {
- return MinValidNumber <= n && n <= MaxValidNumber
-}
-
-// Type represents the wire type.
-type Type int8
-
-const (
- VarintType Type = 0
- Fixed32Type Type = 5
- Fixed64Type Type = 1
- BytesType Type = 2
- StartGroupType Type = 3
- EndGroupType Type = 4
-)
-
-const (
- _ = -iota
- errCodeTruncated
- errCodeFieldNumber
- errCodeOverflow
- errCodeReserved
- errCodeEndGroup
- errCodeRecursionDepth
-)
-
-var (
- errFieldNumber = errors.New("invalid field number")
- errOverflow = errors.New("variable length integer overflow")
- errReserved = errors.New("cannot parse reserved wire type")
- errEndGroup = errors.New("mismatching end group marker")
- errParse = errors.New("parse error")
-)
-
-// ParseError converts an error code into an error value.
-// This returns nil if n is a non-negative number.
-func ParseError(n int) error {
- if n >= 0 {
- return nil
- }
- switch n {
- case errCodeTruncated:
- return io.ErrUnexpectedEOF
- case errCodeFieldNumber:
- return errFieldNumber
- case errCodeOverflow:
- return errOverflow
- case errCodeReserved:
- return errReserved
- case errCodeEndGroup:
- return errEndGroup
- default:
- return errParse
- }
-}
-
-// ConsumeField parses an entire field record (both tag and value) and returns
-// the field number, the wire type, and the total length.
-// This returns a negative length upon an error (see [ParseError]).
-//
-// The total length includes the tag header and the end group marker (if the
-// field is a group).
-func ConsumeField(b []byte) (Number, Type, int) {
- num, typ, n := ConsumeTag(b)
- if n < 0 {
- return 0, 0, n // forward error code
- }
- m := ConsumeFieldValue(num, typ, b[n:])
- if m < 0 {
- return 0, 0, m // forward error code
- }
- return num, typ, n + m
-}
-
-// ConsumeFieldValue parses a field value and returns its length.
-// This assumes that the field [Number] and wire [Type] have already been parsed.
-// This returns a negative length upon an error (see [ParseError]).
-//
-// When parsing a group, the length includes the end group marker and
-// the end group is verified to match the starting field number.
-func ConsumeFieldValue(num Number, typ Type, b []byte) (n int) {
- return consumeFieldValueD(num, typ, b, DefaultRecursionLimit)
-}
-
-func consumeFieldValueD(num Number, typ Type, b []byte, depth int) (n int) {
- switch typ {
- case VarintType:
- _, n = ConsumeVarint(b)
- return n
- case Fixed32Type:
- _, n = ConsumeFixed32(b)
- return n
- case Fixed64Type:
- _, n = ConsumeFixed64(b)
- return n
- case BytesType:
- _, n = ConsumeBytes(b)
- return n
- case StartGroupType:
- if depth < 0 {
- return errCodeRecursionDepth
- }
- n0 := len(b)
- for {
- num2, typ2, n := ConsumeTag(b)
- if n < 0 {
- return n // forward error code
- }
- b = b[n:]
- if typ2 == EndGroupType {
- if num != num2 {
- return errCodeEndGroup
- }
- return n0 - len(b)
- }
-
- n = consumeFieldValueD(num2, typ2, b, depth-1)
- if n < 0 {
- return n // forward error code
- }
- b = b[n:]
- }
- case EndGroupType:
- return errCodeEndGroup
- default:
- return errCodeReserved
- }
-}
-
-// AppendTag encodes num and typ as a varint-encoded tag and appends it to b.
-func AppendTag(b []byte, num Number, typ Type) []byte {
- return AppendVarint(b, EncodeTag(num, typ))
-}
-
-// ConsumeTag parses b as a varint-encoded tag, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeTag(b []byte) (Number, Type, int) {
- v, n := ConsumeVarint(b)
- if n < 0 {
- return 0, 0, n // forward error code
- }
- num, typ := DecodeTag(v)
- if num < MinValidNumber {
- return 0, 0, errCodeFieldNumber
- }
- return num, typ, n
-}
-
-func SizeTag(num Number) int {
- return SizeVarint(EncodeTag(num, 0)) // wire type has no effect on size
-}
-
-// AppendVarint appends v to b as a varint-encoded uint64.
-func AppendVarint(b []byte, v uint64) []byte {
- switch {
- case v < 1<<7:
- b = append(b, byte(v))
- case v < 1<<14:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte(v>>7))
- case v < 1<<21:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte(v>>14))
- case v < 1<<28:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte(v>>21))
- case v < 1<<35:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte(v>>28))
- case v < 1<<42:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte(v>>35))
- case v < 1<<49:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte(v>>42))
- case v < 1<<56:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte(v>>49))
- case v < 1<<63:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte(v>>56))
- default:
- b = append(b,
- byte((v>>0)&0x7f|0x80),
- byte((v>>7)&0x7f|0x80),
- byte((v>>14)&0x7f|0x80),
- byte((v>>21)&0x7f|0x80),
- byte((v>>28)&0x7f|0x80),
- byte((v>>35)&0x7f|0x80),
- byte((v>>42)&0x7f|0x80),
- byte((v>>49)&0x7f|0x80),
- byte((v>>56)&0x7f|0x80),
- 1)
- }
- return b
-}
-
-// ConsumeVarint parses b as a varint-encoded uint64, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeVarint(b []byte) (v uint64, n int) {
- var y uint64
- if len(b) <= 0 {
- return 0, errCodeTruncated
- }
- v = uint64(b[0])
- if v < 0x80 {
- return v, 1
- }
- v -= 0x80
-
- if len(b) <= 1 {
- return 0, errCodeTruncated
- }
- y = uint64(b[1])
- v += y << 7
- if y < 0x80 {
- return v, 2
- }
- v -= 0x80 << 7
-
- if len(b) <= 2 {
- return 0, errCodeTruncated
- }
- y = uint64(b[2])
- v += y << 14
- if y < 0x80 {
- return v, 3
- }
- v -= 0x80 << 14
-
- if len(b) <= 3 {
- return 0, errCodeTruncated
- }
- y = uint64(b[3])
- v += y << 21
- if y < 0x80 {
- return v, 4
- }
- v -= 0x80 << 21
-
- if len(b) <= 4 {
- return 0, errCodeTruncated
- }
- y = uint64(b[4])
- v += y << 28
- if y < 0x80 {
- return v, 5
- }
- v -= 0x80 << 28
-
- if len(b) <= 5 {
- return 0, errCodeTruncated
- }
- y = uint64(b[5])
- v += y << 35
- if y < 0x80 {
- return v, 6
- }
- v -= 0x80 << 35
-
- if len(b) <= 6 {
- return 0, errCodeTruncated
- }
- y = uint64(b[6])
- v += y << 42
- if y < 0x80 {
- return v, 7
- }
- v -= 0x80 << 42
-
- if len(b) <= 7 {
- return 0, errCodeTruncated
- }
- y = uint64(b[7])
- v += y << 49
- if y < 0x80 {
- return v, 8
- }
- v -= 0x80 << 49
-
- if len(b) <= 8 {
- return 0, errCodeTruncated
- }
- y = uint64(b[8])
- v += y << 56
- if y < 0x80 {
- return v, 9
- }
- v -= 0x80 << 56
-
- if len(b) <= 9 {
- return 0, errCodeTruncated
- }
- y = uint64(b[9])
- v += y << 63
- if y < 2 {
- return v, 10
- }
- return 0, errCodeOverflow
-}
-
-// SizeVarint returns the encoded size of a varint.
-// The size is guaranteed to be within 1 and 10, inclusive.
-func SizeVarint(v uint64) int {
- // This computes 1 + (bits.Len64(v)-1)/7.
- // 9/64 is a good enough approximation of 1/7
- return int(9*uint32(bits.Len64(v))+64) / 64
-}
-
-// AppendFixed32 appends v to b as a little-endian uint32.
-func AppendFixed32(b []byte, v uint32) []byte {
- return append(b,
- byte(v>>0),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24))
-}
-
-// ConsumeFixed32 parses b as a little-endian uint32, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeFixed32(b []byte) (v uint32, n int) {
- if len(b) < 4 {
- return 0, errCodeTruncated
- }
- v = uint32(b[0])<<0 | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
- return v, 4
-}
-
-// SizeFixed32 returns the encoded size of a fixed32; which is always 4.
-func SizeFixed32() int {
- return 4
-}
-
-// AppendFixed64 appends v to b as a little-endian uint64.
-func AppendFixed64(b []byte, v uint64) []byte {
- return append(b,
- byte(v>>0),
- byte(v>>8),
- byte(v>>16),
- byte(v>>24),
- byte(v>>32),
- byte(v>>40),
- byte(v>>48),
- byte(v>>56))
-}
-
-// ConsumeFixed64 parses b as a little-endian uint64, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeFixed64(b []byte) (v uint64, n int) {
- if len(b) < 8 {
- return 0, errCodeTruncated
- }
- v = uint64(b[0])<<0 | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
- return v, 8
-}
-
-// SizeFixed64 returns the encoded size of a fixed64; which is always 8.
-func SizeFixed64() int {
- return 8
-}
-
-// AppendBytes appends v to b as a length-prefixed bytes value.
-func AppendBytes(b []byte, v []byte) []byte {
- return append(AppendVarint(b, uint64(len(v))), v...)
-}
-
-// ConsumeBytes parses b as a length-prefixed bytes value, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeBytes(b []byte) (v []byte, n int) {
- m, n := ConsumeVarint(b)
- if n < 0 {
- return nil, n // forward error code
- }
- if m > uint64(len(b[n:])) {
- return nil, errCodeTruncated
- }
- return b[n:][:m], n + int(m)
-}
-
-// SizeBytes returns the encoded size of a length-prefixed bytes value,
-// given only the length.
-func SizeBytes(n int) int {
- return SizeVarint(uint64(n)) + n
-}
-
-// AppendString appends v to b as a length-prefixed bytes value.
-func AppendString(b []byte, v string) []byte {
- return append(AppendVarint(b, uint64(len(v))), v...)
-}
-
-// ConsumeString parses b as a length-prefixed bytes value, reporting its length.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeString(b []byte) (v string, n int) {
- bb, n := ConsumeBytes(b)
- return string(bb), n
-}
-
-// AppendGroup appends v to b as group value, with a trailing end group marker.
-// The value v must not contain the end marker.
-func AppendGroup(b []byte, num Number, v []byte) []byte {
- return AppendVarint(append(b, v...), EncodeTag(num, EndGroupType))
-}
-
-// ConsumeGroup parses b as a group value until the trailing end group marker,
-// and verifies that the end marker matches the provided num. The value v
-// does not contain the end marker, while the length does contain the end marker.
-// This returns a negative length upon an error (see [ParseError]).
-func ConsumeGroup(num Number, b []byte) (v []byte, n int) {
- n = ConsumeFieldValue(num, StartGroupType, b)
- if n < 0 {
- return nil, n // forward error code
- }
- b = b[:n]
-
- // Truncate off end group marker, but need to handle denormalized varints.
- // Assuming end marker is never 0 (which is always the case since
- // EndGroupType is non-zero), we can truncate all trailing bytes where the
- // lower 7 bits are all zero (implying that the varint is denormalized).
- for len(b) > 0 && b[len(b)-1]&0x7f == 0 {
- b = b[:len(b)-1]
- }
- b = b[:len(b)-SizeTag(num)]
- return b, n
-}
-
-// SizeGroup returns the encoded size of a group, given only the length.
-func SizeGroup(num Number, n int) int {
- return n + SizeTag(num)
-}
-
-// DecodeTag decodes the field [Number] and wire [Type] from its unified form.
-// The [Number] is -1 if the decoded field number overflows int32.
-// Other than overflow, this does not check for field number validity.
-func DecodeTag(x uint64) (Number, Type) {
- // NOTE: MessageSet allows for larger field numbers than normal.
- if x>>3 > uint64(math.MaxInt32) {
- return -1, 0
- }
- return Number(x >> 3), Type(x & 7)
-}
-
-// EncodeTag encodes the field [Number] and wire [Type] into its unified form.
-func EncodeTag(num Number, typ Type) uint64 {
- return uint64(num)<<3 | uint64(typ&7)
-}
-
-// DecodeZigZag decodes a zig-zag-encoded uint64 as an int64.
-//
-// Input: {…, 5, 3, 1, 0, 2, 4, 6, …}
-// Output: {…, -3, -2, -1, 0, +1, +2, +3, …}
-func DecodeZigZag(x uint64) int64 {
- return int64(x>>1) ^ int64(x)<<63>>63
-}
-
-// EncodeZigZag encodes an int64 as a zig-zag-encoded uint64.
-//
-// Input: {…, -3, -2, -1, 0, +1, +2, +3, …}
-// Output: {…, 5, 3, 1, 0, 2, 4, 6, …}
-func EncodeZigZag(x int64) uint64 {
- return uint64(x<<1) ^ uint64(x>>63)
-}
-
-// DecodeBool decodes a uint64 as a bool.
-//
-// Input: { 0, 1, 2, …}
-// Output: {false, true, true, …}
-func DecodeBool(x uint64) bool {
- return x != 0
-}
-
-// EncodeBool encodes a bool as a uint64.
-//
-// Input: {false, true}
-// Output: { 0, 1}
-func EncodeBool(x bool) uint64 {
- if x {
- return 1
- }
- return 0
-}
diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
deleted file mode 100644
index a45625c..0000000
--- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go
+++ /dev/null
@@ -1,413 +0,0 @@
-// Copyright 2018 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.
-
-// Package descfmt provides functionality to format descriptors.
-package descfmt
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
- "strings"
-
- "google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type list interface {
- Len() int
- pragma.DoNotImplement
-}
-
-func FormatList(s fmt.State, r rune, vs list) {
- io.WriteString(s, formatListOpt(vs, true, r == 'v' && (s.Flag('+') || s.Flag('#'))))
-}
-func formatListOpt(vs list, isRoot, allowMulti bool) string {
- start, end := "[", "]"
- if isRoot {
- var name string
- switch vs.(type) {
- case protoreflect.Names:
- name = "Names"
- case protoreflect.FieldNumbers:
- name = "FieldNumbers"
- case protoreflect.FieldRanges:
- name = "FieldRanges"
- case protoreflect.EnumRanges:
- name = "EnumRanges"
- case protoreflect.FileImports:
- name = "FileImports"
- case protoreflect.Descriptor:
- name = reflect.ValueOf(vs).MethodByName("Get").Type().Out(0).Name() + "s"
- default:
- name = reflect.ValueOf(vs).Elem().Type().Name()
- }
- start, end = name+"{", "}"
- }
-
- var ss []string
- switch vs := vs.(type) {
- case protoreflect.Names:
- for i := 0; i < vs.Len(); i++ {
- ss = append(ss, fmt.Sprint(vs.Get(i)))
- }
- return start + joinStrings(ss, false) + end
- case protoreflect.FieldNumbers:
- for i := 0; i < vs.Len(); i++ {
- ss = append(ss, fmt.Sprint(vs.Get(i)))
- }
- return start + joinStrings(ss, false) + end
- case protoreflect.FieldRanges:
- for i := 0; i < vs.Len(); i++ {
- r := vs.Get(i)
- if r[0]+1 == r[1] {
- ss = append(ss, fmt.Sprintf("%d", r[0]))
- } else {
- ss = append(ss, fmt.Sprintf("%d:%d", r[0], r[1])) // enum ranges are end exclusive
- }
- }
- return start + joinStrings(ss, false) + end
- case protoreflect.EnumRanges:
- for i := 0; i < vs.Len(); i++ {
- r := vs.Get(i)
- if r[0] == r[1] {
- ss = append(ss, fmt.Sprintf("%d", r[0]))
- } else {
- ss = append(ss, fmt.Sprintf("%d:%d", r[0], int64(r[1])+1)) // enum ranges are end inclusive
- }
- }
- return start + joinStrings(ss, false) + end
- case protoreflect.FileImports:
- for i := 0; i < vs.Len(); i++ {
- var rs records
- rv := reflect.ValueOf(vs.Get(i))
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Path"), "Path"},
- {rv.MethodByName("Package"), "Package"},
- {rv.MethodByName("IsPublic"), "IsPublic"},
- {rv.MethodByName("IsWeak"), "IsWeak"},
- }...)
- ss = append(ss, "{"+rs.Join()+"}")
- }
- return start + joinStrings(ss, allowMulti) + end
- default:
- _, isEnumValue := vs.(protoreflect.EnumValueDescriptors)
- for i := 0; i < vs.Len(); i++ {
- m := reflect.ValueOf(vs).MethodByName("Get")
- v := m.Call([]reflect.Value{reflect.ValueOf(i)})[0].Interface()
- ss = append(ss, formatDescOpt(v.(protoreflect.Descriptor), false, allowMulti && !isEnumValue, nil))
- }
- return start + joinStrings(ss, allowMulti && isEnumValue) + end
- }
-}
-
-type methodAndName struct {
- method reflect.Value
- name string
-}
-
-func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) {
- io.WriteString(s, formatDescOpt(t, true, r == 'v' && (s.Flag('+') || s.Flag('#')), nil))
-}
-
-func InternalFormatDescOptForTesting(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
- return formatDescOpt(t, isRoot, allowMulti, record)
-}
-
-func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record func(string)) string {
- rv := reflect.ValueOf(t)
- rt := rv.MethodByName("ProtoType").Type().In(0)
-
- start, end := "{", "}"
- if isRoot {
- start = rt.Name() + "{"
- }
-
- _, isFile := t.(protoreflect.FileDescriptor)
- rs := records{
- allowMulti: allowMulti,
- record: record,
- }
- if t.IsPlaceholder() {
- if isFile {
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Path"), "Path"},
- {rv.MethodByName("Package"), "Package"},
- {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
- }...)
- } else {
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("FullName"), "FullName"},
- {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"},
- }...)
- }
- } else {
- switch {
- case isFile:
- rs.Append(rv, methodAndName{rv.MethodByName("Syntax"), "Syntax"})
- case isRoot:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Syntax"), "Syntax"},
- {rv.MethodByName("FullName"), "FullName"},
- }...)
- default:
- rs.Append(rv, methodAndName{rv.MethodByName("Name"), "Name"})
- }
- switch t := t.(type) {
- case protoreflect.FieldDescriptor:
- accessors := []methodAndName{
- {rv.MethodByName("Number"), "Number"},
- {rv.MethodByName("Cardinality"), "Cardinality"},
- {rv.MethodByName("Kind"), "Kind"},
- {rv.MethodByName("HasJSONName"), "HasJSONName"},
- {rv.MethodByName("JSONName"), "JSONName"},
- {rv.MethodByName("HasPresence"), "HasPresence"},
- {rv.MethodByName("IsExtension"), "IsExtension"},
- {rv.MethodByName("IsPacked"), "IsPacked"},
- {rv.MethodByName("IsWeak"), "IsWeak"},
- {rv.MethodByName("IsList"), "IsList"},
- {rv.MethodByName("IsMap"), "IsMap"},
- {rv.MethodByName("MapKey"), "MapKey"},
- {rv.MethodByName("MapValue"), "MapValue"},
- {rv.MethodByName("HasDefault"), "HasDefault"},
- {rv.MethodByName("Default"), "Default"},
- {rv.MethodByName("ContainingOneof"), "ContainingOneof"},
- {rv.MethodByName("ContainingMessage"), "ContainingMessage"},
- {rv.MethodByName("Message"), "Message"},
- {rv.MethodByName("Enum"), "Enum"},
- }
- for _, s := range accessors {
- switch s.name {
- case "MapKey":
- if k := t.MapKey(); k != nil {
- rs.recs = append(rs.recs, [2]string{"MapKey", k.Kind().String()})
- }
- case "MapValue":
- if v := t.MapValue(); v != nil {
- switch v.Kind() {
- case protoreflect.EnumKind:
- rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Enum().FullName())})
- case protoreflect.MessageKind, protoreflect.GroupKind:
- rs.AppendRecs("MapValue", [2]string{"MapValue", string(v.Message().FullName())})
- default:
- rs.AppendRecs("MapValue", [2]string{"MapValue", v.Kind().String()})
- }
- }
- case "ContainingOneof":
- if od := t.ContainingOneof(); od != nil {
- rs.AppendRecs("ContainingOneof", [2]string{"Oneof", string(od.Name())})
- }
- case "ContainingMessage":
- if t.IsExtension() {
- rs.AppendRecs("ContainingMessage", [2]string{"Extendee", string(t.ContainingMessage().FullName())})
- }
- case "Message":
- if !t.IsMap() {
- rs.Append(rv, s)
- }
- default:
- rs.Append(rv, s)
- }
- }
- case protoreflect.OneofDescriptor:
- var ss []string
- fs := t.Fields()
- for i := 0; i < fs.Len(); i++ {
- ss = append(ss, string(fs.Get(i).Name()))
- }
- if len(ss) > 0 {
- rs.AppendRecs("Fields", [2]string{"Fields", "[" + joinStrings(ss, false) + "]"})
- }
-
- case protoreflect.FileDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Path"), "Path"},
- {rv.MethodByName("Package"), "Package"},
- {rv.MethodByName("Imports"), "Imports"},
- {rv.MethodByName("Messages"), "Messages"},
- {rv.MethodByName("Enums"), "Enums"},
- {rv.MethodByName("Extensions"), "Extensions"},
- {rv.MethodByName("Services"), "Services"},
- }...)
-
- case protoreflect.MessageDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("IsMapEntry"), "IsMapEntry"},
- {rv.MethodByName("Fields"), "Fields"},
- {rv.MethodByName("Oneofs"), "Oneofs"},
- {rv.MethodByName("ReservedNames"), "ReservedNames"},
- {rv.MethodByName("ReservedRanges"), "ReservedRanges"},
- {rv.MethodByName("RequiredNumbers"), "RequiredNumbers"},
- {rv.MethodByName("ExtensionRanges"), "ExtensionRanges"},
- {rv.MethodByName("Messages"), "Messages"},
- {rv.MethodByName("Enums"), "Enums"},
- {rv.MethodByName("Extensions"), "Extensions"},
- }...)
-
- case protoreflect.EnumDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Values"), "Values"},
- {rv.MethodByName("ReservedNames"), "ReservedNames"},
- {rv.MethodByName("ReservedRanges"), "ReservedRanges"},
- }...)
-
- case protoreflect.EnumValueDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Number"), "Number"},
- }...)
-
- case protoreflect.ServiceDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Methods"), "Methods"},
- }...)
-
- case protoreflect.MethodDescriptor:
- rs.Append(rv, []methodAndName{
- {rv.MethodByName("Input"), "Input"},
- {rv.MethodByName("Output"), "Output"},
- {rv.MethodByName("IsStreamingClient"), "IsStreamingClient"},
- {rv.MethodByName("IsStreamingServer"), "IsStreamingServer"},
- }...)
- }
- if m := rv.MethodByName("GoType"); m.IsValid() {
- rs.Append(rv, methodAndName{m, "GoType"})
- }
- }
- return start + rs.Join() + end
-}
-
-type records struct {
- recs [][2]string
- allowMulti bool
-
- // record is a function that will be called for every Append() or
- // AppendRecs() call, to be used for testing with the
- // InternalFormatDescOptForTesting function.
- record func(string)
-}
-
-func (rs *records) AppendRecs(fieldName string, newRecs [2]string) {
- if rs.record != nil {
- rs.record(fieldName)
- }
- rs.recs = append(rs.recs, newRecs)
-}
-
-func (rs *records) Append(v reflect.Value, accessors ...methodAndName) {
- for _, a := range accessors {
- if rs.record != nil {
- rs.record(a.name)
- }
- var rv reflect.Value
- if a.method.IsValid() {
- rv = a.method.Call(nil)[0]
- }
- if v.Kind() == reflect.Struct && !rv.IsValid() {
- rv = v.FieldByName(a.name)
- }
- if !rv.IsValid() {
- panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a.name))
- }
- if _, ok := rv.Interface().(protoreflect.Value); ok {
- rv = rv.MethodByName("Interface").Call(nil)[0]
- if !rv.IsNil() {
- rv = rv.Elem()
- }
- }
-
- // Ignore zero values.
- var isZero bool
- switch rv.Kind() {
- case reflect.Interface, reflect.Slice:
- isZero = rv.IsNil()
- case reflect.Bool:
- isZero = rv.Bool() == false
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- isZero = rv.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- isZero = rv.Uint() == 0
- case reflect.String:
- isZero = rv.String() == ""
- }
- if n, ok := rv.Interface().(list); ok {
- isZero = n.Len() == 0
- }
- if isZero {
- continue
- }
-
- // Format the value.
- var s string
- v := rv.Interface()
- switch v := v.(type) {
- case list:
- s = formatListOpt(v, false, rs.allowMulti)
- case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor:
- s = string(v.(protoreflect.Descriptor).Name())
- case protoreflect.Descriptor:
- s = string(v.FullName())
- case string:
- s = strconv.Quote(v)
- case []byte:
- s = fmt.Sprintf("%q", v)
- default:
- s = fmt.Sprint(v)
- }
- rs.recs = append(rs.recs, [2]string{a.name, s})
- }
-}
-
-func (rs *records) Join() string {
- var ss []string
-
- // In single line mode, simply join all records with commas.
- if !rs.allowMulti {
- for _, r := range rs.recs {
- ss = append(ss, r[0]+formatColon(0)+r[1])
- }
- return joinStrings(ss, false)
- }
-
- // In allowMulti line mode, align single line records for more readable output.
- var maxLen int
- flush := func(i int) {
- for _, r := range rs.recs[len(ss):i] {
- ss = append(ss, r[0]+formatColon(maxLen-len(r[0]))+r[1])
- }
- maxLen = 0
- }
- for i, r := range rs.recs {
- if isMulti := strings.Contains(r[1], "\n"); isMulti {
- flush(i)
- ss = append(ss, r[0]+formatColon(0)+strings.Join(strings.Split(r[1], "\n"), "\n\t"))
- } else if maxLen < len(r[0]) {
- maxLen = len(r[0])
- }
- }
- flush(len(rs.recs))
- return joinStrings(ss, true)
-}
-
-func formatColon(padding int) string {
- // Deliberately introduce instability into the debug output to
- // discourage users from performing string comparisons.
- // This provides us flexibility to change the output in the future.
- if detrand.Bool() {
- return ":" + strings.Repeat(" ", 1+padding) // use non-breaking spaces (U+00a0)
- } else {
- return ":" + strings.Repeat(" ", 1+padding) // use regular spaces (U+0020)
- }
-}
-
-func joinStrings(ss []string, isMulti bool) string {
- if len(ss) == 0 {
- return ""
- }
- if isMulti {
- return "\n\t" + strings.Join(ss, "\n\t") + "\n"
- }
- return strings.Join(ss, ", ")
-}
diff --git a/vendor/google.golang.org/protobuf/internal/descopts/options.go b/vendor/google.golang.org/protobuf/internal/descopts/options.go
deleted file mode 100644
index 8401be8..0000000
--- a/vendor/google.golang.org/protobuf/internal/descopts/options.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-// Package descopts contains the nil pointers to concrete descriptor options.
-//
-// This package exists as a form of reverse dependency injection so that certain
-// packages (e.g., internal/filedesc and internal/filetype can avoid a direct
-// dependency on the descriptor proto package).
-package descopts
-
-import pref "google.golang.org/protobuf/reflect/protoreflect"
-
-// These variables are set by the init function in descriptor.pb.go via logic
-// in internal/filetype. In other words, so long as the descriptor proto package
-// is linked in, these variables will be populated.
-//
-// Each variable is populated with a nil pointer to the options struct.
-var (
- File pref.ProtoMessage
- Enum pref.ProtoMessage
- EnumValue pref.ProtoMessage
- Message pref.ProtoMessage
- Field pref.ProtoMessage
- Oneof pref.ProtoMessage
- ExtensionRange pref.ProtoMessage
- Service pref.ProtoMessage
- Method pref.ProtoMessage
-)
diff --git a/vendor/google.golang.org/protobuf/internal/detrand/rand.go b/vendor/google.golang.org/protobuf/internal/detrand/rand.go
deleted file mode 100644
index 49c8676..0000000
--- a/vendor/google.golang.org/protobuf/internal/detrand/rand.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2018 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.
-
-// Package detrand provides deterministically random functionality.
-//
-// The pseudo-randomness of these functions is seeded by the program binary
-// itself and guarantees that the output does not change within a program,
-// while ensuring that the output is unstable across different builds.
-package detrand
-
-import (
- "encoding/binary"
- "hash/fnv"
- "os"
-)
-
-// Disable disables detrand such that all functions returns the zero value.
-// This function is not concurrent-safe and must be called during program init.
-func Disable() {
- randSeed = 0
-}
-
-// Bool returns a deterministically random boolean.
-func Bool() bool {
- return randSeed%2 == 1
-}
-
-// Intn returns a deterministically random integer between 0 and n-1, inclusive.
-func Intn(n int) int {
- if n <= 0 {
- panic("must be positive")
- }
- return int(randSeed % uint64(n))
-}
-
-// randSeed is a best-effort at an approximate hash of the Go binary.
-var randSeed = binaryHash()
-
-func binaryHash() uint64 {
- // Open the Go binary.
- s, err := os.Executable()
- if err != nil {
- return 0
- }
- f, err := os.Open(s)
- if err != nil {
- return 0
- }
- defer f.Close()
-
- // Hash the size and several samples of the Go binary.
- const numSamples = 8
- var buf [64]byte
- h := fnv.New64()
- fi, err := f.Stat()
- if err != nil {
- return 0
- }
- binary.LittleEndian.PutUint64(buf[:8], uint64(fi.Size()))
- h.Write(buf[:8])
- for i := int64(0); i < numSamples; i++ {
- if _, err := f.ReadAt(buf[:], i*fi.Size()/numSamples); err != nil {
- return 0
- }
- h.Write(buf[:])
- }
- return h.Sum64()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go b/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
deleted file mode 100644
index 328dc73..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2018 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.
-
-// Package defval marshals and unmarshals textual forms of default values.
-//
-// This package handles both the form historically used in Go struct field tags
-// and also the form used by google.protobuf.FieldDescriptorProto.default_value
-// since they differ in superficial ways.
-package defval
-
-import (
- "fmt"
- "math"
- "strconv"
-
- ptext "google.golang.org/protobuf/internal/encoding/text"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// Format is the serialization format used to represent the default value.
-type Format int
-
-const (
- _ Format = iota
-
- // Descriptor uses the serialization format that protoc uses with the
- // google.protobuf.FieldDescriptorProto.default_value field.
- Descriptor
-
- // GoTag uses the historical serialization format in Go struct field tags.
- GoTag
-)
-
-// Unmarshal deserializes the default string s according to the given kind k.
-// When k is an enum, a list of enum value descriptors must be provided.
-func Unmarshal(s string, k protoreflect.Kind, evs protoreflect.EnumValueDescriptors, f Format) (protoreflect.Value, protoreflect.EnumValueDescriptor, error) {
- switch k {
- case protoreflect.BoolKind:
- if f == GoTag {
- switch s {
- case "1":
- return protoreflect.ValueOfBool(true), nil, nil
- case "0":
- return protoreflect.ValueOfBool(false), nil, nil
- }
- } else {
- switch s {
- case "true":
- return protoreflect.ValueOfBool(true), nil, nil
- case "false":
- return protoreflect.ValueOfBool(false), nil, nil
- }
- }
- case protoreflect.EnumKind:
- if f == GoTag {
- // Go tags use the numeric form of the enum value.
- if n, err := strconv.ParseInt(s, 10, 32); err == nil {
- if ev := evs.ByNumber(protoreflect.EnumNumber(n)); ev != nil {
- return protoreflect.ValueOfEnum(ev.Number()), ev, nil
- }
- }
- } else {
- // Descriptor default_value use the enum identifier.
- ev := evs.ByName(protoreflect.Name(s))
- if ev != nil {
- return protoreflect.ValueOfEnum(ev.Number()), ev, nil
- }
- }
- case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
- if v, err := strconv.ParseInt(s, 10, 32); err == nil {
- return protoreflect.ValueOfInt32(int32(v)), nil, nil
- }
- case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
- if v, err := strconv.ParseInt(s, 10, 64); err == nil {
- return protoreflect.ValueOfInt64(int64(v)), nil, nil
- }
- case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
- if v, err := strconv.ParseUint(s, 10, 32); err == nil {
- return protoreflect.ValueOfUint32(uint32(v)), nil, nil
- }
- case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
- if v, err := strconv.ParseUint(s, 10, 64); err == nil {
- return protoreflect.ValueOfUint64(uint64(v)), nil, nil
- }
- case protoreflect.FloatKind, protoreflect.DoubleKind:
- var v float64
- var err error
- switch s {
- case "-inf":
- v = math.Inf(-1)
- case "inf":
- v = math.Inf(+1)
- case "nan":
- v = math.NaN()
- default:
- v, err = strconv.ParseFloat(s, 64)
- }
- if err == nil {
- if k == protoreflect.FloatKind {
- return protoreflect.ValueOfFloat32(float32(v)), nil, nil
- } else {
- return protoreflect.ValueOfFloat64(float64(v)), nil, nil
- }
- }
- case protoreflect.StringKind:
- // String values are already unescaped and can be used as is.
- return protoreflect.ValueOfString(s), nil, nil
- case protoreflect.BytesKind:
- if b, ok := unmarshalBytes(s); ok {
- return protoreflect.ValueOfBytes(b), nil, nil
- }
- }
- return protoreflect.Value{}, nil, errors.New("could not parse value for %v: %q", k, s)
-}
-
-// Marshal serializes v as the default string according to the given kind k.
-// When specifying the Descriptor format for an enum kind, the associated
-// enum value descriptor must be provided.
-func Marshal(v protoreflect.Value, ev protoreflect.EnumValueDescriptor, k protoreflect.Kind, f Format) (string, error) {
- switch k {
- case protoreflect.BoolKind:
- if f == GoTag {
- if v.Bool() {
- return "1", nil
- } else {
- return "0", nil
- }
- } else {
- if v.Bool() {
- return "true", nil
- } else {
- return "false", nil
- }
- }
- case protoreflect.EnumKind:
- if f == GoTag {
- return strconv.FormatInt(int64(v.Enum()), 10), nil
- } else {
- return string(ev.Name()), nil
- }
- case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
- return strconv.FormatInt(v.Int(), 10), nil
- case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
- return strconv.FormatUint(v.Uint(), 10), nil
- case protoreflect.FloatKind, protoreflect.DoubleKind:
- f := v.Float()
- switch {
- case math.IsInf(f, -1):
- return "-inf", nil
- case math.IsInf(f, +1):
- return "inf", nil
- case math.IsNaN(f):
- return "nan", nil
- default:
- if k == protoreflect.FloatKind {
- return strconv.FormatFloat(f, 'g', -1, 32), nil
- } else {
- return strconv.FormatFloat(f, 'g', -1, 64), nil
- }
- }
- case protoreflect.StringKind:
- // String values are serialized as is without any escaping.
- return v.String(), nil
- case protoreflect.BytesKind:
- if s, ok := marshalBytes(v.Bytes()); ok {
- return s, nil
- }
- }
- return "", errors.New("could not format value for %v: %v", k, v)
-}
-
-// unmarshalBytes deserializes bytes by applying C unescaping.
-func unmarshalBytes(s string) ([]byte, bool) {
- // Bytes values use the same escaping as the text format,
- // however they lack the surrounding double quotes.
- v, err := ptext.UnmarshalString(`"` + s + `"`)
- if err != nil {
- return nil, false
- }
- return []byte(v), true
-}
-
-// marshalBytes serializes bytes by using C escaping.
-// To match the exact output of protoc, this is identical to the
-// CEscape function in strutil.cc of the protoc source code.
-func marshalBytes(b []byte) (string, bool) {
- var s []byte
- for _, c := range b {
- switch c {
- case '\n':
- s = append(s, `\n`...)
- case '\r':
- s = append(s, `\r`...)
- case '\t':
- s = append(s, `\t`...)
- case '"':
- s = append(s, `\"`...)
- case '\'':
- s = append(s, `\'`...)
- case '\\':
- s = append(s, `\\`...)
- default:
- if printableASCII := c >= 0x20 && c <= 0x7e; printableASCII {
- s = append(s, c)
- } else {
- s = append(s, fmt.Sprintf(`\%03o`, c)...)
- }
- }
- }
- return string(s), true
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go b/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
deleted file mode 100644
index a6693f0..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// 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.
-
-// Package messageset encodes and decodes the obsolete MessageSet wire format.
-package messageset
-
-import (
- "math"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// The MessageSet wire format is equivalent to a message defined as follows,
-// where each Item defines an extension field with a field number of 'type_id'
-// and content of 'message'. MessageSet extensions must be non-repeated message
-// fields.
-//
-// message MessageSet {
-// repeated group Item = 1 {
-// required int32 type_id = 2;
-// required string message = 3;
-// }
-// }
-const (
- FieldItem = protowire.Number(1)
- FieldTypeID = protowire.Number(2)
- FieldMessage = protowire.Number(3)
-)
-
-// ExtensionName is the field name for extensions of MessageSet.
-//
-// A valid MessageSet extension must be of the form:
-//
-// message MyMessage {
-// extend proto2.bridge.MessageSet {
-// optional MyMessage message_set_extension = 1234;
-// }
-// ...
-// }
-const ExtensionName = "message_set_extension"
-
-// IsMessageSet returns whether the message uses the MessageSet wire format.
-func IsMessageSet(md protoreflect.MessageDescriptor) bool {
- xmd, ok := md.(interface{ IsMessageSet() bool })
- return ok && xmd.IsMessageSet()
-}
-
-// IsMessageSetExtension reports this field properly extends a MessageSet.
-func IsMessageSetExtension(fd protoreflect.FieldDescriptor) bool {
- switch {
- case fd.Name() != ExtensionName:
- return false
- case !IsMessageSet(fd.ContainingMessage()):
- return false
- case fd.FullName().Parent() != fd.Message().FullName():
- return false
- }
- return true
-}
-
-// SizeField returns the size of a MessageSet item field containing an extension
-// with the given field number, not counting the contents of the message subfield.
-func SizeField(num protowire.Number) int {
- return 2*protowire.SizeTag(FieldItem) + protowire.SizeTag(FieldTypeID) + protowire.SizeVarint(uint64(num))
-}
-
-// Unmarshal parses a MessageSet.
-//
-// It calls fn with the type ID and value of each item in the MessageSet.
-// Unknown fields are discarded.
-//
-// If wantLen is true, the item values include the varint length prefix.
-// This is ugly, but simplifies the fast-path decoder in internal/impl.
-func Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error {
- for len(b) > 0 {
- num, wtyp, n := protowire.ConsumeTag(b)
- if n < 0 {
- return protowire.ParseError(n)
- }
- b = b[n:]
- if num != FieldItem || wtyp != protowire.StartGroupType {
- n := protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return protowire.ParseError(n)
- }
- b = b[n:]
- continue
- }
- typeID, value, n, err := ConsumeFieldValue(b, wantLen)
- if err != nil {
- return err
- }
- b = b[n:]
- if typeID == 0 {
- continue
- }
- if err := fn(typeID, value); err != nil {
- return err
- }
- }
- return nil
-}
-
-// ConsumeFieldValue parses b as a MessageSet item field value until and including
-// the trailing end group marker. It assumes the start group tag has already been parsed.
-// It returns the contents of the type_id and message subfields and the total
-// item length.
-//
-// If wantLen is true, the returned message value includes the length prefix.
-func ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error) {
- ilen := len(b)
- for {
- num, wtyp, n := protowire.ConsumeTag(b)
- if n < 0 {
- return 0, nil, 0, protowire.ParseError(n)
- }
- b = b[n:]
- switch {
- case num == FieldItem && wtyp == protowire.EndGroupType:
- if wantLen && len(message) == 0 {
- // The message field was missing, which should never happen.
- // Be prepared for this case anyway.
- message = protowire.AppendVarint(message, 0)
- }
- return typeid, message, ilen - len(b), nil
- case num == FieldTypeID && wtyp == protowire.VarintType:
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, nil, 0, protowire.ParseError(n)
- }
- b = b[n:]
- if v < 1 || v > math.MaxInt32 {
- return 0, nil, 0, errors.New("invalid type_id in message set")
- }
- typeid = protowire.Number(v)
- case num == FieldMessage && wtyp == protowire.BytesType:
- m, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, nil, 0, protowire.ParseError(n)
- }
- if message == nil {
- if wantLen {
- message = b[:n:n]
- } else {
- message = m[:len(m):len(m)]
- }
- } else {
- // This case should never happen in practice, but handle it for
- // correctness: The MessageSet item contains multiple message
- // fields, which need to be merged.
- //
- // In the case where we're returning the length, this becomes
- // quite inefficient since we need to strip the length off
- // the existing data and reconstruct it with the combined length.
- if wantLen {
- _, nn := protowire.ConsumeVarint(message)
- m0 := message[nn:]
- message = nil
- message = protowire.AppendVarint(message, uint64(len(m0)+len(m)))
- message = append(message, m0...)
- message = append(message, m...)
- } else {
- message = append(message, m...)
- }
- }
- b = b[n:]
- default:
- // We have no place to put it, so we just ignore unknown fields.
- n := protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return 0, nil, 0, protowire.ParseError(n)
- }
- b = b[n:]
- }
- }
-}
-
-// AppendFieldStart appends the start of a MessageSet item field containing
-// an extension with the given number. The caller must add the message
-// subfield (including the tag).
-func AppendFieldStart(b []byte, num protowire.Number) []byte {
- b = protowire.AppendTag(b, FieldItem, protowire.StartGroupType)
- b = protowire.AppendTag(b, FieldTypeID, protowire.VarintType)
- b = protowire.AppendVarint(b, uint64(num))
- return b
-}
-
-// AppendFieldEnd appends the trailing end group marker for a MessageSet item field.
-func AppendFieldEnd(b []byte) []byte {
- return protowire.AppendTag(b, FieldItem, protowire.EndGroupType)
-}
-
-// SizeUnknown returns the size of an unknown fields section in MessageSet format.
-//
-// See AppendUnknown.
-func SizeUnknown(unknown []byte) (size int) {
- for len(unknown) > 0 {
- num, typ, n := protowire.ConsumeTag(unknown)
- if n < 0 || typ != protowire.BytesType {
- return 0
- }
- unknown = unknown[n:]
- _, n = protowire.ConsumeBytes(unknown)
- if n < 0 {
- return 0
- }
- unknown = unknown[n:]
- size += SizeField(num) + protowire.SizeTag(FieldMessage) + n
- }
- return size
-}
-
-// AppendUnknown appends unknown fields to b in MessageSet format.
-//
-// For historic reasons, unresolved items in a MessageSet are stored in a
-// message's unknown fields section in non-MessageSet format. That is, an
-// unknown item with typeID T and value V appears in the unknown fields as
-// a field with number T and value V.
-//
-// This function converts the unknown fields back into MessageSet form.
-func AppendUnknown(b, unknown []byte) ([]byte, error) {
- for len(unknown) > 0 {
- num, typ, n := protowire.ConsumeTag(unknown)
- if n < 0 || typ != protowire.BytesType {
- return nil, errors.New("invalid data in message set unknown fields")
- }
- unknown = unknown[n:]
- _, n = protowire.ConsumeBytes(unknown)
- if n < 0 {
- return nil, errors.New("invalid data in message set unknown fields")
- }
- b = AppendFieldStart(b, num)
- b = protowire.AppendTag(b, FieldMessage, protowire.BytesType)
- b = append(b, unknown[:n]...)
- b = AppendFieldEnd(b)
- unknown = unknown[n:]
- }
- return b, nil
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
deleted file mode 100644
index 373d208..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright 2018 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.
-
-// Package tag marshals and unmarshals the legacy struct tags as generated
-// by historical versions of protoc-gen-go.
-package tag
-
-import (
- "reflect"
- "strconv"
- "strings"
-
- "google.golang.org/protobuf/internal/encoding/defval"
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-var byteType = reflect.TypeOf(byte(0))
-
-// Unmarshal decodes the tag into a prototype.Field.
-//
-// The goType is needed to determine the original protoreflect.Kind since the
-// tag does not record sufficient information to determine that.
-// The type is the underlying field type (e.g., a repeated field may be
-// represented by []T, but the Go type passed in is just T).
-// A list of enum value descriptors must be provided for enum fields.
-// This does not populate the Enum or Message (except for weak message).
-//
-// This function is a best effort attempt; parsing errors are ignored.
-func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor {
- f := new(filedesc.Field)
- f.L0.ParentFile = filedesc.SurrogateProto2
- for len(tag) > 0 {
- i := strings.IndexByte(tag, ',')
- if i < 0 {
- i = len(tag)
- }
- switch s := tag[:i]; {
- case strings.HasPrefix(s, "name="):
- f.L0.FullName = protoreflect.FullName(s[len("name="):])
- case strings.Trim(s, "0123456789") == "":
- n, _ := strconv.ParseUint(s, 10, 32)
- f.L1.Number = protoreflect.FieldNumber(n)
- case s == "opt":
- f.L1.Cardinality = protoreflect.Optional
- case s == "req":
- f.L1.Cardinality = protoreflect.Required
- case s == "rep":
- f.L1.Cardinality = protoreflect.Repeated
- case s == "varint":
- switch goType.Kind() {
- case reflect.Bool:
- f.L1.Kind = protoreflect.BoolKind
- case reflect.Int32:
- f.L1.Kind = protoreflect.Int32Kind
- case reflect.Int64:
- f.L1.Kind = protoreflect.Int64Kind
- case reflect.Uint32:
- f.L1.Kind = protoreflect.Uint32Kind
- case reflect.Uint64:
- f.L1.Kind = protoreflect.Uint64Kind
- }
- case s == "zigzag32":
- if goType.Kind() == reflect.Int32 {
- f.L1.Kind = protoreflect.Sint32Kind
- }
- case s == "zigzag64":
- if goType.Kind() == reflect.Int64 {
- f.L1.Kind = protoreflect.Sint64Kind
- }
- case s == "fixed32":
- switch goType.Kind() {
- case reflect.Int32:
- f.L1.Kind = protoreflect.Sfixed32Kind
- case reflect.Uint32:
- f.L1.Kind = protoreflect.Fixed32Kind
- case reflect.Float32:
- f.L1.Kind = protoreflect.FloatKind
- }
- case s == "fixed64":
- switch goType.Kind() {
- case reflect.Int64:
- f.L1.Kind = protoreflect.Sfixed64Kind
- case reflect.Uint64:
- f.L1.Kind = protoreflect.Fixed64Kind
- case reflect.Float64:
- f.L1.Kind = protoreflect.DoubleKind
- }
- case s == "bytes":
- switch {
- case goType.Kind() == reflect.String:
- f.L1.Kind = protoreflect.StringKind
- case goType.Kind() == reflect.Slice && goType.Elem() == byteType:
- f.L1.Kind = protoreflect.BytesKind
- default:
- f.L1.Kind = protoreflect.MessageKind
- }
- case s == "group":
- f.L1.Kind = protoreflect.GroupKind
- case strings.HasPrefix(s, "enum="):
- f.L1.Kind = protoreflect.EnumKind
- case strings.HasPrefix(s, "json="):
- jsonName := s[len("json="):]
- if jsonName != strs.JSONCamelCase(string(f.L0.FullName.Name())) {
- f.L1.StringName.InitJSON(jsonName)
- }
- case s == "packed":
- f.L1.HasPacked = true
- f.L1.IsPacked = true
- case strings.HasPrefix(s, "weak="):
- f.L1.IsWeak = true
- f.L1.Message = filedesc.PlaceholderMessage(protoreflect.FullName(s[len("weak="):]))
- case strings.HasPrefix(s, "def="):
- // The default tag is special in that everything afterwards is the
- // default regardless of the presence of commas.
- s, i = tag[len("def="):], len(tag)
- v, ev, _ := defval.Unmarshal(s, f.L1.Kind, evs, defval.GoTag)
- f.L1.Default = filedesc.DefaultValue(v, ev)
- case s == "proto3":
- f.L0.ParentFile = filedesc.SurrogateProto3
- }
- tag = strings.TrimPrefix(tag[i:], ",")
- }
-
- // The generator uses the group message name instead of the field name.
- // We obtain the real field name by lowercasing the group name.
- if f.L1.Kind == protoreflect.GroupKind {
- f.L0.FullName = protoreflect.FullName(strings.ToLower(string(f.L0.FullName)))
- }
- return f
-}
-
-// Marshal encodes the protoreflect.FieldDescriptor as a tag.
-//
-// The enumName must be provided if the kind is an enum.
-// Historically, the formulation of the enum "name" was the proto package
-// dot-concatenated with the generated Go identifier for the enum type.
-// Depending on the context on how Marshal is called, there are different ways
-// through which that information is determined. As such it is the caller's
-// responsibility to provide a function to obtain that information.
-func Marshal(fd protoreflect.FieldDescriptor, enumName string) string {
- var tag []string
- switch fd.Kind() {
- case protoreflect.BoolKind, protoreflect.EnumKind, protoreflect.Int32Kind, protoreflect.Uint32Kind, protoreflect.Int64Kind, protoreflect.Uint64Kind:
- tag = append(tag, "varint")
- case protoreflect.Sint32Kind:
- tag = append(tag, "zigzag32")
- case protoreflect.Sint64Kind:
- tag = append(tag, "zigzag64")
- case protoreflect.Sfixed32Kind, protoreflect.Fixed32Kind, protoreflect.FloatKind:
- tag = append(tag, "fixed32")
- case protoreflect.Sfixed64Kind, protoreflect.Fixed64Kind, protoreflect.DoubleKind:
- tag = append(tag, "fixed64")
- case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind:
- tag = append(tag, "bytes")
- case protoreflect.GroupKind:
- tag = append(tag, "group")
- }
- tag = append(tag, strconv.Itoa(int(fd.Number())))
- switch fd.Cardinality() {
- case protoreflect.Optional:
- tag = append(tag, "opt")
- case protoreflect.Required:
- tag = append(tag, "req")
- case protoreflect.Repeated:
- tag = append(tag, "rep")
- }
- if fd.IsPacked() {
- tag = append(tag, "packed")
- }
- name := string(fd.Name())
- if fd.Kind() == protoreflect.GroupKind {
- // The name of the FieldDescriptor for a group field is
- // lowercased. To find the original capitalization, we
- // look in the field's MessageType.
- name = string(fd.Message().Name())
- }
- tag = append(tag, "name="+name)
- if jsonName := fd.JSONName(); jsonName != "" && jsonName != name && !fd.IsExtension() {
- // NOTE: The jsonName != name condition is suspect, but it preserve
- // the exact same semantics from the previous generator.
- tag = append(tag, "json="+jsonName)
- }
- if fd.IsWeak() {
- tag = append(tag, "weak="+string(fd.Message().FullName()))
- }
- // The previous implementation does not tag extension fields as proto3,
- // even when the field is defined in a proto3 file. Match that behavior
- // for consistency.
- if fd.Syntax() == protoreflect.Proto3 && !fd.IsExtension() {
- tag = append(tag, "proto3")
- }
- if fd.Kind() == protoreflect.EnumKind && enumName != "" {
- tag = append(tag, "enum="+enumName)
- }
- if fd.ContainingOneof() != nil {
- tag = append(tag, "oneof")
- }
- // This must appear last in the tag, since commas in strings aren't escaped.
- if fd.HasDefault() {
- def, _ := defval.Marshal(fd.Default(), fd.DefaultEnumValue(), fd.Kind(), defval.GoTag)
- tag = append(tag, "def="+def)
- }
- return strings.Join(tag, ",")
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
deleted file mode 100644
index 87853e7..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go
+++ /dev/null
@@ -1,686 +0,0 @@
-// Copyright 2018 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.
-
-package text
-
-import (
- "bytes"
- "fmt"
- "io"
- "strconv"
- "unicode/utf8"
-
- "google.golang.org/protobuf/internal/errors"
-)
-
-// Decoder is a token-based textproto decoder.
-type Decoder struct {
- // lastCall is last method called, either readCall or peekCall.
- // Initial value is readCall.
- lastCall call
-
- // lastToken contains the last read token.
- lastToken Token
-
- // lastErr contains the last read error.
- lastErr error
-
- // openStack is a stack containing the byte characters for MessageOpen and
- // ListOpen kinds. The top of stack represents the message or the list that
- // the current token is nested in. An empty stack means the current token is
- // at the top level message. The characters '{' and '<' both represent the
- // MessageOpen kind.
- openStack []byte
-
- // orig is used in reporting line and column.
- orig []byte
- // in contains the unconsumed input.
- in []byte
-}
-
-// NewDecoder returns a Decoder to read the given []byte.
-func NewDecoder(b []byte) *Decoder {
- return &Decoder{orig: b, in: b}
-}
-
-// ErrUnexpectedEOF means that EOF was encountered in the middle of the input.
-var ErrUnexpectedEOF = errors.New("%v", io.ErrUnexpectedEOF)
-
-// call specifies which Decoder method was invoked.
-type call uint8
-
-const (
- readCall call = iota
- peekCall
-)
-
-// Peek looks ahead and returns the next token and error without advancing a read.
-func (d *Decoder) Peek() (Token, error) {
- defer func() { d.lastCall = peekCall }()
- if d.lastCall == readCall {
- d.lastToken, d.lastErr = d.Read()
- }
- return d.lastToken, d.lastErr
-}
-
-// Read returns the next token.
-// It will return an error if there is no valid token.
-func (d *Decoder) Read() (Token, error) {
- defer func() { d.lastCall = readCall }()
- if d.lastCall == peekCall {
- return d.lastToken, d.lastErr
- }
-
- tok, err := d.parseNext(d.lastToken.kind)
- if err != nil {
- return Token{}, err
- }
-
- switch tok.kind {
- case comma, semicolon:
- tok, err = d.parseNext(tok.kind)
- if err != nil {
- return Token{}, err
- }
- }
- d.lastToken = tok
- return tok, nil
-}
-
-const (
- mismatchedFmt = "mismatched close character %q"
- unexpectedFmt = "unexpected character %q"
-)
-
-// parseNext parses the next Token based on given last kind.
-func (d *Decoder) parseNext(lastKind Kind) (Token, error) {
- // Trim leading spaces.
- d.consume(0)
- isEOF := false
- if len(d.in) == 0 {
- isEOF = true
- }
-
- switch lastKind {
- case EOF:
- return d.consumeToken(EOF, 0, 0), nil
-
- case bof:
- // Start of top level message. Next token can be EOF or Name.
- if isEOF {
- return d.consumeToken(EOF, 0, 0), nil
- }
- return d.parseFieldName()
-
- case Name:
- // Next token can be MessageOpen, ListOpen or Scalar.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case '{', '<':
- d.pushOpenStack(ch)
- return d.consumeToken(MessageOpen, 1, 0), nil
- case '[':
- d.pushOpenStack(ch)
- return d.consumeToken(ListOpen, 1, 0), nil
- default:
- return d.parseScalar()
- }
-
- case Scalar:
- openKind, closeCh := d.currentOpenKind()
- switch openKind {
- case bof:
- // Top level message.
- // Next token can be EOF, comma, semicolon or Name.
- if isEOF {
- return d.consumeToken(EOF, 0, 0), nil
- }
- switch d.in[0] {
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- case MessageOpen:
- // Next token can be MessageClose, comma, semicolon or Name.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(MessageClose, 1, 0), nil
- case otherCloseChar[closeCh]:
- return Token{}, d.newSyntaxError(mismatchedFmt, ch)
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- case ListOpen:
- // Next token can be ListClose or comma.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case ']':
- d.popOpenStack()
- return d.consumeToken(ListClose, 1, 0), nil
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- default:
- return Token{}, d.newSyntaxError(unexpectedFmt, ch)
- }
- }
-
- case MessageOpen:
- // Next token can be MessageClose or Name.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- _, closeCh := d.currentOpenKind()
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(MessageClose, 1, 0), nil
- case otherCloseChar[closeCh]:
- return Token{}, d.newSyntaxError(mismatchedFmt, ch)
- default:
- return d.parseFieldName()
- }
-
- case MessageClose:
- openKind, closeCh := d.currentOpenKind()
- switch openKind {
- case bof:
- // Top level message.
- // Next token can be EOF, comma, semicolon or Name.
- if isEOF {
- return d.consumeToken(EOF, 0, 0), nil
- }
- switch ch := d.in[0]; ch {
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- case MessageOpen:
- // Next token can be MessageClose, comma, semicolon or Name.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(MessageClose, 1, 0), nil
- case otherCloseChar[closeCh]:
- return Token{}, d.newSyntaxError(mismatchedFmt, ch)
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- case ListOpen:
- // Next token can be ListClose or comma
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(ListClose, 1, 0), nil
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- default:
- return Token{}, d.newSyntaxError(unexpectedFmt, ch)
- }
- }
-
- case ListOpen:
- // Next token can be ListClose, MessageStart or Scalar.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case ']':
- d.popOpenStack()
- return d.consumeToken(ListClose, 1, 0), nil
- case '{', '<':
- d.pushOpenStack(ch)
- return d.consumeToken(MessageOpen, 1, 0), nil
- default:
- return d.parseScalar()
- }
-
- case ListClose:
- openKind, closeCh := d.currentOpenKind()
- switch openKind {
- case bof:
- // Top level message.
- // Next token can be EOF, comma, semicolon or Name.
- if isEOF {
- return d.consumeToken(EOF, 0, 0), nil
- }
- switch ch := d.in[0]; ch {
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- case MessageOpen:
- // Next token can be MessageClose, comma, semicolon or Name.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(MessageClose, 1, 0), nil
- case otherCloseChar[closeCh]:
- return Token{}, d.newSyntaxError(mismatchedFmt, ch)
- case ',':
- return d.consumeToken(comma, 1, 0), nil
- case ';':
- return d.consumeToken(semicolon, 1, 0), nil
- default:
- return d.parseFieldName()
- }
-
- default:
- // It is not possible to have this case. Let it panic below.
- }
-
- case comma, semicolon:
- openKind, closeCh := d.currentOpenKind()
- switch openKind {
- case bof:
- // Top level message. Next token can be EOF or Name.
- if isEOF {
- return d.consumeToken(EOF, 0, 0), nil
- }
- return d.parseFieldName()
-
- case MessageOpen:
- // Next token can be MessageClose or Name.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case closeCh:
- d.popOpenStack()
- return d.consumeToken(MessageClose, 1, 0), nil
- case otherCloseChar[closeCh]:
- return Token{}, d.newSyntaxError(mismatchedFmt, ch)
- default:
- return d.parseFieldName()
- }
-
- case ListOpen:
- if lastKind == semicolon {
- // It is not be possible to have this case as logic here
- // should not have produced a semicolon Token when inside a
- // list. Let it panic below.
- break
- }
- // Next token can be MessageOpen or Scalar.
- if isEOF {
- return Token{}, ErrUnexpectedEOF
- }
- switch ch := d.in[0]; ch {
- case '{', '<':
- d.pushOpenStack(ch)
- return d.consumeToken(MessageOpen, 1, 0), nil
- default:
- return d.parseScalar()
- }
- }
- }
-
- line, column := d.Position(len(d.orig) - len(d.in))
- panic(fmt.Sprintf("Decoder.parseNext: bug at handling line %d:%d with lastKind=%v", line, column, lastKind))
-}
-
-var otherCloseChar = map[byte]byte{
- '}': '>',
- '>': '}',
-}
-
-// currentOpenKind indicates whether current position is inside a message, list
-// or top-level message by returning MessageOpen, ListOpen or bof respectively.
-// If the returned kind is either a MessageOpen or ListOpen, it also returns the
-// corresponding closing character.
-func (d *Decoder) currentOpenKind() (Kind, byte) {
- if len(d.openStack) == 0 {
- return bof, 0
- }
- openCh := d.openStack[len(d.openStack)-1]
- switch openCh {
- case '{':
- return MessageOpen, '}'
- case '<':
- return MessageOpen, '>'
- case '[':
- return ListOpen, ']'
- }
- panic(fmt.Sprintf("Decoder: openStack contains invalid byte %c", openCh))
-}
-
-func (d *Decoder) pushOpenStack(ch byte) {
- d.openStack = append(d.openStack, ch)
-}
-
-func (d *Decoder) popOpenStack() {
- d.openStack = d.openStack[:len(d.openStack)-1]
-}
-
-// parseFieldName parses field name and separator.
-func (d *Decoder) parseFieldName() (tok Token, err error) {
- defer func() {
- if err == nil && d.tryConsumeChar(':') {
- tok.attrs |= hasSeparator
- }
- }()
-
- // Extension or Any type URL.
- if d.in[0] == '[' {
- return d.parseTypeName()
- }
-
- // Identifier.
- if size := parseIdent(d.in, false); size > 0 {
- return d.consumeToken(Name, size, uint8(IdentName)), nil
- }
-
- // Field number. Identify if input is a valid number that is not negative
- // and is decimal integer within 32-bit range.
- if num := parseNumber(d.in); num.size > 0 {
- str := num.string(d.in)
- if !num.neg && num.kind == numDec {
- if _, err := strconv.ParseInt(str, 10, 32); err == nil {
- return d.consumeToken(Name, num.size, uint8(FieldNumber)), nil
- }
- }
- return Token{}, d.newSyntaxError("invalid field number: %s", str)
- }
-
- return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in))
-}
-
-// parseTypeName parses Any type URL or extension field name. The name is
-// enclosed in [ and ] characters. The C++ parser does not handle many legal URL
-// strings. This implementation is more liberal and allows for the pattern
-// ^[-_a-zA-Z0-9]+([./][-_a-zA-Z0-9]+)*`). Whitespaces and comments are allowed
-// in between [ ], '.', '/' and the sub names.
-func (d *Decoder) parseTypeName() (Token, error) {
- startPos := len(d.orig) - len(d.in)
- // Use alias s to advance first in order to use d.in for error handling.
- // Caller already checks for [ as first character.
- s := consume(d.in[1:], 0)
- if len(s) == 0 {
- return Token{}, ErrUnexpectedEOF
- }
-
- var name []byte
- for len(s) > 0 && isTypeNameChar(s[0]) {
- name = append(name, s[0])
- s = s[1:]
- }
- s = consume(s, 0)
-
- var closed bool
- for len(s) > 0 && !closed {
- switch {
- case s[0] == ']':
- s = s[1:]
- closed = true
-
- case s[0] == '/', s[0] == '.':
- if len(name) > 0 && (name[len(name)-1] == '/' || name[len(name)-1] == '.') {
- return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s",
- d.orig[startPos:len(d.orig)-len(s)+1])
- }
- name = append(name, s[0])
- s = s[1:]
- s = consume(s, 0)
- for len(s) > 0 && isTypeNameChar(s[0]) {
- name = append(name, s[0])
- s = s[1:]
- }
- s = consume(s, 0)
-
- default:
- return Token{}, d.newSyntaxError(
- "invalid type URL/extension field name: %s", d.orig[startPos:len(d.orig)-len(s)+1])
- }
- }
-
- if !closed {
- return Token{}, ErrUnexpectedEOF
- }
-
- // First character cannot be '.'. Last character cannot be '.' or '/'.
- size := len(name)
- if size == 0 || name[0] == '.' || name[size-1] == '.' || name[size-1] == '/' {
- return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s",
- d.orig[startPos:len(d.orig)-len(s)])
- }
-
- d.in = s
- endPos := len(d.orig) - len(d.in)
- d.consume(0)
-
- return Token{
- kind: Name,
- attrs: uint8(TypeName),
- pos: startPos,
- raw: d.orig[startPos:endPos],
- str: string(name),
- }, nil
-}
-
-func isTypeNameChar(b byte) bool {
- return (b == '-' || b == '_' ||
- ('0' <= b && b <= '9') ||
- ('a' <= b && b <= 'z') ||
- ('A' <= b && b <= 'Z'))
-}
-
-func isWhiteSpace(b byte) bool {
- switch b {
- case ' ', '\n', '\r', '\t':
- return true
- default:
- return false
- }
-}
-
-// parseIdent parses an unquoted proto identifier and returns size.
-// If allowNeg is true, it allows '-' to be the first character in the
-// identifier. This is used when parsing literal values like -infinity, etc.
-// Regular expression matches an identifier: `^[_a-zA-Z][_a-zA-Z0-9]*`
-func parseIdent(input []byte, allowNeg bool) int {
- var size int
-
- s := input
- if len(s) == 0 {
- return 0
- }
-
- if allowNeg && s[0] == '-' {
- s = s[1:]
- size++
- if len(s) == 0 {
- return 0
- }
- }
-
- switch {
- case s[0] == '_',
- 'a' <= s[0] && s[0] <= 'z',
- 'A' <= s[0] && s[0] <= 'Z':
- s = s[1:]
- size++
- default:
- return 0
- }
-
- for len(s) > 0 && (s[0] == '_' ||
- 'a' <= s[0] && s[0] <= 'z' ||
- 'A' <= s[0] && s[0] <= 'Z' ||
- '0' <= s[0] && s[0] <= '9') {
- s = s[1:]
- size++
- }
-
- if len(s) > 0 && !isDelim(s[0]) {
- return 0
- }
-
- return size
-}
-
-// parseScalar parses for a string, literal or number value.
-func (d *Decoder) parseScalar() (Token, error) {
- if d.in[0] == '"' || d.in[0] == '\'' {
- return d.parseStringValue()
- }
-
- if tok, ok := d.parseLiteralValue(); ok {
- return tok, nil
- }
-
- if tok, ok := d.parseNumberValue(); ok {
- return tok, nil
- }
-
- return Token{}, d.newSyntaxError("invalid scalar value: %s", errId(d.in))
-}
-
-// parseLiteralValue parses a literal value. A literal value is used for
-// bools, special floats and enums. This function simply identifies that the
-// field value is a literal.
-func (d *Decoder) parseLiteralValue() (Token, bool) {
- size := parseIdent(d.in, true)
- if size == 0 {
- return Token{}, false
- }
- return d.consumeToken(Scalar, size, literalValue), true
-}
-
-// consumeToken constructs a Token for given Kind from d.in and consumes given
-// size-length from it.
-func (d *Decoder) consumeToken(kind Kind, size int, attrs uint8) Token {
- // Important to compute raw and pos before consuming.
- tok := Token{
- kind: kind,
- attrs: attrs,
- pos: len(d.orig) - len(d.in),
- raw: d.in[:size],
- }
- d.consume(size)
- return tok
-}
-
-// newSyntaxError returns a syntax error with line and column information for
-// current position.
-func (d *Decoder) newSyntaxError(f string, x ...interface{}) error {
- e := errors.New(f, x...)
- line, column := d.Position(len(d.orig) - len(d.in))
- return errors.New("syntax error (line %d:%d): %v", line, column, e)
-}
-
-// Position returns line and column number of given index of the original input.
-// It will panic if index is out of range.
-func (d *Decoder) Position(idx int) (line int, column int) {
- b := d.orig[:idx]
- line = bytes.Count(b, []byte("\n")) + 1
- if i := bytes.LastIndexByte(b, '\n'); i >= 0 {
- b = b[i+1:]
- }
- column = utf8.RuneCount(b) + 1 // ignore multi-rune characters
- return line, column
-}
-
-func (d *Decoder) tryConsumeChar(c byte) bool {
- if len(d.in) > 0 && d.in[0] == c {
- d.consume(1)
- return true
- }
- return false
-}
-
-// consume consumes n bytes of input and any subsequent whitespace or comments.
-func (d *Decoder) consume(n int) {
- d.in = consume(d.in, n)
- return
-}
-
-// consume consumes n bytes of input and any subsequent whitespace or comments.
-func consume(b []byte, n int) []byte {
- b = b[n:]
- for len(b) > 0 {
- switch b[0] {
- case ' ', '\n', '\r', '\t':
- b = b[1:]
- case '#':
- if i := bytes.IndexByte(b, '\n'); i >= 0 {
- b = b[i+len("\n"):]
- } else {
- b = nil
- }
- default:
- return b
- }
- }
- return b
-}
-
-// errId extracts a byte sequence that looks like an invalid ID
-// (for the purposes of error reporting).
-func errId(seq []byte) []byte {
- const maxLen = 32
- for i := 0; i < len(seq); {
- if i > maxLen {
- return append(seq[:i:i], "…"...)
- }
- r, size := utf8.DecodeRune(seq[i:])
- if r > utf8.RuneSelf || (r != '/' && isDelim(byte(r))) {
- if i == 0 {
- // Either the first byte is invalid UTF-8 or a
- // delimiter, or the first rune is non-ASCII.
- // Return it as-is.
- i = size
- }
- return seq[:i:i]
- }
- i += size
- }
- // No delimiter found.
- return seq
-}
-
-// isDelim returns true if given byte is a delimiter character.
-func isDelim(c byte) bool {
- return !(c == '-' || c == '+' || c == '.' || c == '_' ||
- ('a' <= c && c <= 'z') ||
- ('A' <= c && c <= 'Z') ||
- ('0' <= c && c <= '9'))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
deleted file mode 100644
index 45c81f0..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright 2018 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.
-
-package text
-
-// parseNumberValue parses a number from the input and returns a Token object.
-func (d *Decoder) parseNumberValue() (Token, bool) {
- in := d.in
- num := parseNumber(in)
- if num.size == 0 {
- return Token{}, false
- }
- numAttrs := num.kind
- if num.neg {
- numAttrs |= isNegative
- }
- tok := Token{
- kind: Scalar,
- attrs: numberValue,
- pos: len(d.orig) - len(d.in),
- raw: d.in[:num.size],
- str: num.string(d.in),
- numAttrs: numAttrs,
- }
- d.consume(num.size)
- return tok, true
-}
-
-const (
- numDec uint8 = (1 << iota) / 2
- numHex
- numOct
- numFloat
-)
-
-// number is the result of parsing out a valid number from parseNumber. It
-// contains data for doing float or integer conversion via the strconv package
-// in conjunction with the input bytes.
-type number struct {
- kind uint8
- neg bool
- size int
- // if neg, this is the length of whitespace and comments between
- // the minus sign and the rest fo the number literal
- sep int
-}
-
-func (num number) string(data []byte) string {
- strSize := num.size
- last := num.size - 1
- if num.kind == numFloat && (data[last] == 'f' || data[last] == 'F') {
- strSize = last
- }
- if num.neg && num.sep > 0 {
- // strip whitespace/comments between negative sign and the rest
- strLen := strSize - num.sep
- str := make([]byte, strLen)
- str[0] = data[0]
- copy(str[1:], data[num.sep+1:strSize])
- return string(str)
- }
- return string(data[:strSize])
-
-}
-
-// parseNumber constructs a number object from given input. It allows for the
-// following patterns:
-//
-// integer: ^-?([1-9][0-9]*|0[xX][0-9a-fA-F]+|0[0-7]*)
-// float: ^-?((0|[1-9][0-9]*)?([.][0-9]*)?([eE][+-]?[0-9]+)?[fF]?)
-//
-// It also returns the number of parsed bytes for the given number, 0 if it is
-// not a number.
-func parseNumber(input []byte) number {
- kind := numDec
- var size int
- var neg bool
-
- s := input
- if len(s) == 0 {
- return number{}
- }
-
- // Optional -
- var sep int
- if s[0] == '-' {
- neg = true
- s = s[1:]
- size++
- // Consume any whitespace or comments between the
- // negative sign and the rest of the number
- lenBefore := len(s)
- s = consume(s, 0)
- sep = lenBefore - len(s)
- size += sep
- if len(s) == 0 {
- return number{}
- }
- }
-
- switch {
- case s[0] == '0':
- if len(s) > 1 {
- switch {
- case s[1] == 'x' || s[1] == 'X':
- // Parse as hex number.
- kind = numHex
- n := 2
- s = s[2:]
- for len(s) > 0 && (('0' <= s[0] && s[0] <= '9') ||
- ('a' <= s[0] && s[0] <= 'f') ||
- ('A' <= s[0] && s[0] <= 'F')) {
- s = s[1:]
- n++
- }
- if n == 2 {
- return number{}
- }
- size += n
-
- case '0' <= s[1] && s[1] <= '7':
- // Parse as octal number.
- kind = numOct
- n := 2
- s = s[2:]
- for len(s) > 0 && '0' <= s[0] && s[0] <= '7' {
- s = s[1:]
- n++
- }
- size += n
- }
-
- if kind&(numHex|numOct) > 0 {
- if len(s) > 0 && !isDelim(s[0]) {
- return number{}
- }
- return number{kind: kind, neg: neg, size: size, sep: sep}
- }
- }
- s = s[1:]
- size++
-
- case '1' <= s[0] && s[0] <= '9':
- n := 1
- s = s[1:]
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- n++
- }
- size += n
-
- case s[0] == '.':
- // Set kind to numFloat to signify the intent to parse as float. And
- // that it needs to have other digits after '.'.
- kind = numFloat
-
- default:
- return number{}
- }
-
- // . followed by 0 or more digits.
- if len(s) > 0 && s[0] == '.' {
- n := 1
- s = s[1:]
- // If decimal point was before any digits, it should be followed by
- // other digits.
- if len(s) == 0 && kind == numFloat {
- return number{}
- }
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- n++
- }
- size += n
- kind = numFloat
- }
-
- // e or E followed by an optional - or + and 1 or more digits.
- if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {
- kind = numFloat
- s = s[1:]
- n := 1
- if s[0] == '+' || s[0] == '-' {
- s = s[1:]
- n++
- if len(s) == 0 {
- return number{}
- }
- }
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- n++
- }
- size += n
- }
-
- // Optional suffix f or F for floats.
- if len(s) > 0 && (s[0] == 'f' || s[0] == 'F') {
- kind = numFloat
- s = s[1:]
- size++
- }
-
- // Check that next byte is a delimiter or it is at the end.
- if len(s) > 0 && !isDelim(s[0]) {
- return number{}
- }
-
- return number{kind: kind, neg: neg, size: size, sep: sep}
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go
deleted file mode 100644
index d4d3490..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright 2018 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.
-
-package text
-
-import (
- "bytes"
- "strconv"
- "strings"
- "unicode"
- "unicode/utf16"
- "unicode/utf8"
-
- "google.golang.org/protobuf/internal/strs"
-)
-
-// parseStringValue parses string field token.
-// This differs from parseString since the text format allows
-// multiple back-to-back string literals where they are semantically treated
-// as a single large string with all values concatenated.
-//
-// E.g., `"foo" "bar" "baz"` => "foobarbaz"
-func (d *Decoder) parseStringValue() (Token, error) {
- // Note that the ending quote is sufficient to unambiguously mark the end
- // of a string. Thus, the text grammar does not require intervening
- // whitespace or control characters in-between strings.
- // Thus, the following is valid:
- // `"foo"'bar'"baz"` => "foobarbaz"
- in0 := d.in
- var ss []string
- for len(d.in) > 0 && (d.in[0] == '"' || d.in[0] == '\'') {
- s, err := d.parseString()
- if err != nil {
- return Token{}, err
- }
- ss = append(ss, s)
- }
- // d.in already points to the end of the value at this point.
- return Token{
- kind: Scalar,
- attrs: stringValue,
- pos: len(d.orig) - len(in0),
- raw: in0[:len(in0)-len(d.in)],
- str: strings.Join(ss, ""),
- }, nil
-}
-
-// parseString parses a string value enclosed in " or '.
-func (d *Decoder) parseString() (string, error) {
- in := d.in
- if len(in) == 0 {
- return "", ErrUnexpectedEOF
- }
- quote := in[0]
- in = in[1:]
- i := indexNeedEscapeInBytes(in)
- in, out := in[i:], in[:i:i] // set cap to prevent mutations
- for len(in) > 0 {
- switch r, n := utf8.DecodeRune(in); {
- case r == utf8.RuneError && n == 1:
- return "", d.newSyntaxError("invalid UTF-8 detected")
- case r == 0 || r == '\n':
- return "", d.newSyntaxError("invalid character %q in string", r)
- case r == rune(quote):
- in = in[1:]
- d.consume(len(d.in) - len(in))
- return string(out), nil
- case r == '\\':
- if len(in) < 2 {
- return "", ErrUnexpectedEOF
- }
- switch r := in[1]; r {
- case '"', '\'', '\\', '?':
- in, out = in[2:], append(out, r)
- case 'a':
- in, out = in[2:], append(out, '\a')
- case 'b':
- in, out = in[2:], append(out, '\b')
- case 'n':
- in, out = in[2:], append(out, '\n')
- case 'r':
- in, out = in[2:], append(out, '\r')
- case 't':
- in, out = in[2:], append(out, '\t')
- case 'v':
- in, out = in[2:], append(out, '\v')
- case 'f':
- in, out = in[2:], append(out, '\f')
- case '0', '1', '2', '3', '4', '5', '6', '7':
- // One, two, or three octal characters.
- n := len(in[1:]) - len(bytes.TrimLeft(in[1:], "01234567"))
- if n > 3 {
- n = 3
- }
- v, err := strconv.ParseUint(string(in[1:1+n]), 8, 8)
- if err != nil {
- return "", d.newSyntaxError("invalid octal escape code %q in string", in[:1+n])
- }
- in, out = in[1+n:], append(out, byte(v))
- case 'x':
- // One or two hexadecimal characters.
- n := len(in[2:]) - len(bytes.TrimLeft(in[2:], "0123456789abcdefABCDEF"))
- if n > 2 {
- n = 2
- }
- v, err := strconv.ParseUint(string(in[2:2+n]), 16, 8)
- if err != nil {
- return "", d.newSyntaxError("invalid hex escape code %q in string", in[:2+n])
- }
- in, out = in[2+n:], append(out, byte(v))
- case 'u', 'U':
- // Four or eight hexadecimal characters
- n := 6
- if r == 'U' {
- n = 10
- }
- if len(in) < n {
- return "", ErrUnexpectedEOF
- }
- v, err := strconv.ParseUint(string(in[2:n]), 16, 32)
- if utf8.MaxRune < v || err != nil {
- return "", d.newSyntaxError("invalid Unicode escape code %q in string", in[:n])
- }
- in = in[n:]
-
- r := rune(v)
- if utf16.IsSurrogate(r) {
- if len(in) < 6 {
- return "", ErrUnexpectedEOF
- }
- v, err := strconv.ParseUint(string(in[2:6]), 16, 16)
- r = utf16.DecodeRune(r, rune(v))
- if in[0] != '\\' || in[1] != 'u' || r == unicode.ReplacementChar || err != nil {
- return "", d.newSyntaxError("invalid Unicode escape code %q in string", in[:6])
- }
- in = in[6:]
- }
- out = append(out, string(r)...)
- default:
- return "", d.newSyntaxError("invalid escape code %q in string", in[:2])
- }
- default:
- i := indexNeedEscapeInBytes(in[n:])
- in, out = in[n+i:], append(out, in[:n+i]...)
- }
- }
- return "", ErrUnexpectedEOF
-}
-
-// indexNeedEscapeInString returns the index of the character that needs
-// escaping. If no characters need escaping, this returns the input length.
-func indexNeedEscapeInBytes(b []byte) int { return indexNeedEscapeInString(strs.UnsafeString(b)) }
-
-// UnmarshalString returns an unescaped string given a textproto string value.
-// String value needs to contain single or double quotes. This is only used by
-// internal/encoding/defval package for unmarshaling bytes.
-func UnmarshalString(s string) (string, error) {
- d := NewDecoder([]byte(s))
- return d.parseString()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go
deleted file mode 100644
index 83d2b0d..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go
+++ /dev/null
@@ -1,373 +0,0 @@
-// Copyright 2018 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.
-
-package text
-
-import (
- "bytes"
- "fmt"
- "math"
- "strconv"
- "strings"
-
- "google.golang.org/protobuf/internal/flags"
-)
-
-// Kind represents a token kind expressible in the textproto format.
-type Kind uint8
-
-// Kind values.
-const (
- Invalid Kind = iota
- EOF
- Name // Name indicates the field name.
- Scalar // Scalar are scalar values, e.g. "string", 47, ENUM_LITERAL, true.
- MessageOpen
- MessageClose
- ListOpen
- ListClose
-
- // comma and semi-colon are only for parsing in between values and should not be exposed.
- comma
- semicolon
-
- // bof indicates beginning of file, which is the default token
- // kind at the beginning of parsing.
- bof = Invalid
-)
-
-func (t Kind) String() string {
- switch t {
- case Invalid:
- return ""
- case EOF:
- return "eof"
- case Scalar:
- return "scalar"
- case Name:
- return "name"
- case MessageOpen:
- return "{"
- case MessageClose:
- return "}"
- case ListOpen:
- return "["
- case ListClose:
- return "]"
- case comma:
- return ","
- case semicolon:
- return ";"
- default:
- return fmt.Sprintf("", uint8(t))
- }
-}
-
-// NameKind represents different types of field names.
-type NameKind uint8
-
-// NameKind values.
-const (
- IdentName NameKind = iota + 1
- TypeName
- FieldNumber
-)
-
-func (t NameKind) String() string {
- switch t {
- case IdentName:
- return "IdentName"
- case TypeName:
- return "TypeName"
- case FieldNumber:
- return "FieldNumber"
- default:
- return fmt.Sprintf("", uint8(t))
- }
-}
-
-// Bit mask in Token.attrs to indicate if a Name token is followed by the
-// separator char ':'. The field name separator char is optional for message
-// field or repeated message field, but required for all other types. Decoder
-// simply indicates whether a Name token is followed by separator or not. It is
-// up to the prototext package to validate.
-const hasSeparator = 1 << 7
-
-// Scalar value types.
-const (
- numberValue = iota + 1
- stringValue
- literalValue
-)
-
-// Bit mask in Token.numAttrs to indicate that the number is a negative.
-const isNegative = 1 << 7
-
-// Token provides a parsed token kind and value. Values are provided by the
-// different accessor methods.
-type Token struct {
- // Kind of the Token object.
- kind Kind
- // attrs contains metadata for the following Kinds:
- // Name: hasSeparator bit and one of NameKind.
- // Scalar: one of numberValue, stringValue, literalValue.
- attrs uint8
- // numAttrs contains metadata for numberValue:
- // - highest bit is whether negative or positive.
- // - lower bits indicate one of numDec, numHex, numOct, numFloat.
- numAttrs uint8
- // pos provides the position of the token in the original input.
- pos int
- // raw bytes of the serialized token.
- // This is a subslice into the original input.
- raw []byte
- // str contains parsed string for the following:
- // - stringValue of Scalar kind
- // - numberValue of Scalar kind
- // - TypeName of Name kind
- str string
-}
-
-// Kind returns the token kind.
-func (t Token) Kind() Kind {
- return t.kind
-}
-
-// RawString returns the read value in string.
-func (t Token) RawString() string {
- return string(t.raw)
-}
-
-// Pos returns the token position from the input.
-func (t Token) Pos() int {
- return t.pos
-}
-
-// NameKind returns IdentName, TypeName or FieldNumber.
-// It panics if type is not Name.
-func (t Token) NameKind() NameKind {
- if t.kind == Name {
- return NameKind(t.attrs &^ hasSeparator)
- }
- panic(fmt.Sprintf("Token is not a Name type: %s", t.kind))
-}
-
-// HasSeparator returns true if the field name is followed by the separator char
-// ':', else false. It panics if type is not Name.
-func (t Token) HasSeparator() bool {
- if t.kind == Name {
- return t.attrs&hasSeparator != 0
- }
- panic(fmt.Sprintf("Token is not a Name type: %s", t.kind))
-}
-
-// IdentName returns the value for IdentName type.
-func (t Token) IdentName() string {
- if t.kind == Name && t.attrs&uint8(IdentName) != 0 {
- return string(t.raw)
- }
- panic(fmt.Sprintf("Token is not an IdentName: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator)))
-}
-
-// TypeName returns the value for TypeName type.
-func (t Token) TypeName() string {
- if t.kind == Name && t.attrs&uint8(TypeName) != 0 {
- return t.str
- }
- panic(fmt.Sprintf("Token is not a TypeName: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator)))
-}
-
-// FieldNumber returns the value for FieldNumber type. It returns a
-// non-negative int32 value. Caller will still need to validate for the correct
-// field number range.
-func (t Token) FieldNumber() int32 {
- if t.kind != Name || t.attrs&uint8(FieldNumber) == 0 {
- panic(fmt.Sprintf("Token is not a FieldNumber: %s:%s", t.kind, NameKind(t.attrs&^hasSeparator)))
- }
- // Following should not return an error as it had already been called right
- // before this Token was constructed.
- num, _ := strconv.ParseInt(string(t.raw), 10, 32)
- return int32(num)
-}
-
-// String returns the string value for a Scalar type.
-func (t Token) String() (string, bool) {
- if t.kind != Scalar || t.attrs != stringValue {
- return "", false
- }
- return t.str, true
-}
-
-// Enum returns the literal value for a Scalar type for use as enum literals.
-func (t Token) Enum() (string, bool) {
- if t.kind != Scalar || t.attrs != literalValue || (len(t.raw) > 0 && t.raw[0] == '-') {
- return "", false
- }
- return string(t.raw), true
-}
-
-// Bool returns the bool value for a Scalar type.
-func (t Token) Bool() (bool, bool) {
- if t.kind != Scalar {
- return false, false
- }
- switch t.attrs {
- case literalValue:
- if b, ok := boolLits[string(t.raw)]; ok {
- return b, true
- }
- case numberValue:
- // Unsigned integer representation of 0 or 1 is permitted: 00, 0x0, 01,
- // 0x1, etc.
- n, err := strconv.ParseUint(t.str, 0, 64)
- if err == nil {
- switch n {
- case 0:
- return false, true
- case 1:
- return true, true
- }
- }
- }
- return false, false
-}
-
-// These exact boolean literals are the ones supported in C++.
-var boolLits = map[string]bool{
- "t": true,
- "true": true,
- "True": true,
- "f": false,
- "false": false,
- "False": false,
-}
-
-// Uint64 returns the uint64 value for a Scalar type.
-func (t Token) Uint64() (uint64, bool) {
- if t.kind != Scalar || t.attrs != numberValue ||
- t.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {
- return 0, false
- }
- n, err := strconv.ParseUint(t.str, 0, 64)
- if err != nil {
- return 0, false
- }
- return n, true
-}
-
-// Uint32 returns the uint32 value for a Scalar type.
-func (t Token) Uint32() (uint32, bool) {
- if t.kind != Scalar || t.attrs != numberValue ||
- t.numAttrs&isNegative > 0 || t.numAttrs&numFloat > 0 {
- return 0, false
- }
- n, err := strconv.ParseUint(t.str, 0, 32)
- if err != nil {
- return 0, false
- }
- return uint32(n), true
-}
-
-// Int64 returns the int64 value for a Scalar type.
-func (t Token) Int64() (int64, bool) {
- if t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {
- return 0, false
- }
- if n, err := strconv.ParseInt(t.str, 0, 64); err == nil {
- return n, true
- }
- // C++ accepts large positive hex numbers as negative values.
- // This feature is here for proto1 backwards compatibility purposes.
- if flags.ProtoLegacy && (t.numAttrs == numHex) {
- if n, err := strconv.ParseUint(t.str, 0, 64); err == nil {
- return int64(n), true
- }
- }
- return 0, false
-}
-
-// Int32 returns the int32 value for a Scalar type.
-func (t Token) Int32() (int32, bool) {
- if t.kind != Scalar || t.attrs != numberValue || t.numAttrs&numFloat > 0 {
- return 0, false
- }
- if n, err := strconv.ParseInt(t.str, 0, 32); err == nil {
- return int32(n), true
- }
- // C++ accepts large positive hex numbers as negative values.
- // This feature is here for proto1 backwards compatibility purposes.
- if flags.ProtoLegacy && (t.numAttrs == numHex) {
- if n, err := strconv.ParseUint(t.str, 0, 32); err == nil {
- return int32(n), true
- }
- }
- return 0, false
-}
-
-// Float64 returns the float64 value for a Scalar type.
-func (t Token) Float64() (float64, bool) {
- if t.kind != Scalar {
- return 0, false
- }
- switch t.attrs {
- case literalValue:
- if f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {
- return f, true
- }
- case numberValue:
- n, err := strconv.ParseFloat(t.str, 64)
- if err == nil {
- return n, true
- }
- nerr := err.(*strconv.NumError)
- if nerr.Err == strconv.ErrRange {
- return n, true
- }
- }
- return 0, false
-}
-
-// Float32 returns the float32 value for a Scalar type.
-func (t Token) Float32() (float32, bool) {
- if t.kind != Scalar {
- return 0, false
- }
- switch t.attrs {
- case literalValue:
- if f, ok := floatLits[strings.ToLower(string(t.raw))]; ok {
- return float32(f), true
- }
- case numberValue:
- n, err := strconv.ParseFloat(t.str, 64)
- if err == nil {
- // Overflows are treated as (-)infinity.
- return float32(n), true
- }
- nerr := err.(*strconv.NumError)
- if nerr.Err == strconv.ErrRange {
- return float32(n), true
- }
- }
- return 0, false
-}
-
-// These are the supported float literals which C++ permits case-insensitive
-// variants of these.
-var floatLits = map[string]float64{
- "nan": math.NaN(),
- "inf": math.Inf(1),
- "infinity": math.Inf(1),
- "-inf": math.Inf(-1),
- "-infinity": math.Inf(-1),
-}
-
-// TokenEquals returns true if given Tokens are equal, else false.
-func TokenEquals(x, y Token) bool {
- return x.kind == y.kind &&
- x.attrs == y.attrs &&
- x.numAttrs == y.numAttrs &&
- x.pos == y.pos &&
- bytes.Equal(x.raw, y.raw) &&
- x.str == y.str
-}
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go b/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
deleted file mode 100644
index 7ae6c2a..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 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.
-
-// Package text implements the text format for protocol buffers.
-// This package has no semantic understanding for protocol buffers and is only
-// a parser and composer for the format.
-//
-// There is no formal specification for the protobuf text format, as such the
-// C++ implementation (see google::protobuf::TextFormat) is the reference
-// implementation of the text format.
-//
-// This package is neither a superset nor a subset of the C++ implementation.
-// This implementation permits a more liberal grammar in some cases to be
-// backwards compatible with the historical Go implementation.
-// Future parsings unique to Go should not be added.
-// Some grammars allowed by the C++ implementation are deliberately
-// not implemented here because they are considered a bug by the protobuf team
-// and should not be replicated.
-//
-// The Go implementation should implement a sufficient amount of the C++
-// grammar such that the default text serialization by C++ can be parsed by Go.
-// However, just because the C++ parser accepts some input does not mean that
-// the Go implementation should as well.
-//
-// The text format is almost a superset of JSON except:
-// - message keys are not quoted strings, but identifiers
-// - the top-level value must be a message without the delimiters
-package text
diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
deleted file mode 100644
index cf7aed7..0000000
--- a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go
+++ /dev/null
@@ -1,272 +0,0 @@
-// Copyright 2018 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.
-
-package text
-
-import (
- "math"
- "math/bits"
- "strconv"
- "strings"
- "unicode/utf8"
-
- "google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/errors"
-)
-
-// encType represents an encoding type.
-type encType uint8
-
-const (
- _ encType = (1 << iota) / 2
- name
- scalar
- messageOpen
- messageClose
-)
-
-// Encoder provides methods to write out textproto constructs and values. The user is
-// responsible for producing valid sequences of constructs and values.
-type Encoder struct {
- encoderState
-
- indent string
- delims [2]byte
- outputASCII bool
-}
-
-type encoderState struct {
- lastType encType
- indents []byte
- out []byte
-}
-
-// NewEncoder returns an Encoder.
-//
-// If indent is a non-empty string, it causes every entry in a List or Message
-// to be preceded by the indent and trailed by a newline.
-//
-// If delims is not the zero value, it controls the delimiter characters used
-// for messages (e.g., "{}" vs "<>").
-//
-// If outputASCII is true, strings will be serialized in such a way that
-// multi-byte UTF-8 sequences are escaped. This property ensures that the
-// overall output is ASCII (as opposed to UTF-8).
-func NewEncoder(buf []byte, indent string, delims [2]byte, outputASCII bool) (*Encoder, error) {
- e := &Encoder{
- encoderState: encoderState{out: buf},
- }
- if len(indent) > 0 {
- if strings.Trim(indent, " \t") != "" {
- return nil, errors.New("indent may only be composed of space and tab characters")
- }
- e.indent = indent
- }
- switch delims {
- case [2]byte{0, 0}:
- e.delims = [2]byte{'{', '}'}
- case [2]byte{'{', '}'}, [2]byte{'<', '>'}:
- e.delims = delims
- default:
- return nil, errors.New("delimiters may only be \"{}\" or \"<>\"")
- }
- e.outputASCII = outputASCII
-
- return e, nil
-}
-
-// Bytes returns the content of the written bytes.
-func (e *Encoder) Bytes() []byte {
- return e.out
-}
-
-// StartMessage writes out the '{' or '<' symbol.
-func (e *Encoder) StartMessage() {
- e.prepareNext(messageOpen)
- e.out = append(e.out, e.delims[0])
-}
-
-// EndMessage writes out the '}' or '>' symbol.
-func (e *Encoder) EndMessage() {
- e.prepareNext(messageClose)
- e.out = append(e.out, e.delims[1])
-}
-
-// WriteName writes out the field name and the separator ':'.
-func (e *Encoder) WriteName(s string) {
- e.prepareNext(name)
- e.out = append(e.out, s...)
- e.out = append(e.out, ':')
-}
-
-// WriteBool writes out the given boolean value.
-func (e *Encoder) WriteBool(b bool) {
- if b {
- e.WriteLiteral("true")
- } else {
- e.WriteLiteral("false")
- }
-}
-
-// WriteString writes out the given string value.
-func (e *Encoder) WriteString(s string) {
- e.prepareNext(scalar)
- e.out = appendString(e.out, s, e.outputASCII)
-}
-
-func appendString(out []byte, in string, outputASCII bool) []byte {
- out = append(out, '"')
- i := indexNeedEscapeInString(in)
- in, out = in[i:], append(out, in[:i]...)
- for len(in) > 0 {
- switch r, n := utf8.DecodeRuneInString(in); {
- case r == utf8.RuneError && n == 1:
- // We do not report invalid UTF-8 because strings in the text format
- // are used to represent both the proto string and bytes type.
- r = rune(in[0])
- fallthrough
- case r < ' ' || r == '"' || r == '\\' || r == 0x7f:
- out = append(out, '\\')
- switch r {
- case '"', '\\':
- out = append(out, byte(r))
- case '\n':
- out = append(out, 'n')
- case '\r':
- out = append(out, 'r')
- case '\t':
- out = append(out, 't')
- default:
- out = append(out, 'x')
- out = append(out, "00"[1+(bits.Len32(uint32(r))-1)/4:]...)
- out = strconv.AppendUint(out, uint64(r), 16)
- }
- in = in[n:]
- case r >= utf8.RuneSelf && (outputASCII || r <= 0x009f):
- out = append(out, '\\')
- if r <= math.MaxUint16 {
- out = append(out, 'u')
- out = append(out, "0000"[1+(bits.Len32(uint32(r))-1)/4:]...)
- out = strconv.AppendUint(out, uint64(r), 16)
- } else {
- out = append(out, 'U')
- out = append(out, "00000000"[1+(bits.Len32(uint32(r))-1)/4:]...)
- out = strconv.AppendUint(out, uint64(r), 16)
- }
- in = in[n:]
- default:
- i := indexNeedEscapeInString(in[n:])
- in, out = in[n+i:], append(out, in[:n+i]...)
- }
- }
- out = append(out, '"')
- return out
-}
-
-// indexNeedEscapeInString returns the index of the character that needs
-// escaping. If no characters need escaping, this returns the input length.
-func indexNeedEscapeInString(s string) int {
- for i := 0; i < len(s); i++ {
- if c := s[i]; c < ' ' || c == '"' || c == '\'' || c == '\\' || c >= 0x7f {
- return i
- }
- }
- return len(s)
-}
-
-// WriteFloat writes out the given float value for given bitSize.
-func (e *Encoder) WriteFloat(n float64, bitSize int) {
- e.prepareNext(scalar)
- e.out = appendFloat(e.out, n, bitSize)
-}
-
-func appendFloat(out []byte, n float64, bitSize int) []byte {
- switch {
- case math.IsNaN(n):
- return append(out, "nan"...)
- case math.IsInf(n, +1):
- return append(out, "inf"...)
- case math.IsInf(n, -1):
- return append(out, "-inf"...)
- default:
- return strconv.AppendFloat(out, n, 'g', -1, bitSize)
- }
-}
-
-// WriteInt writes out the given signed integer value.
-func (e *Encoder) WriteInt(n int64) {
- e.prepareNext(scalar)
- e.out = strconv.AppendInt(e.out, n, 10)
-}
-
-// WriteUint writes out the given unsigned integer value.
-func (e *Encoder) WriteUint(n uint64) {
- e.prepareNext(scalar)
- e.out = strconv.AppendUint(e.out, n, 10)
-}
-
-// WriteLiteral writes out the given string as a literal value without quotes.
-// This is used for writing enum literal strings.
-func (e *Encoder) WriteLiteral(s string) {
- e.prepareNext(scalar)
- e.out = append(e.out, s...)
-}
-
-// prepareNext adds possible space and indentation for the next value based
-// on last encType and indent option. It also updates e.lastType to next.
-func (e *Encoder) prepareNext(next encType) {
- defer func() {
- e.lastType = next
- }()
-
- // Single line.
- if len(e.indent) == 0 {
- // Add space after each field before the next one.
- if e.lastType&(scalar|messageClose) != 0 && next == name {
- e.out = append(e.out, ' ')
- // Add a random extra space to make output unstable.
- if detrand.Bool() {
- e.out = append(e.out, ' ')
- }
- }
- return
- }
-
- // Multi-line.
- switch {
- case e.lastType == name:
- e.out = append(e.out, ' ')
- // Add a random extra space after name: to make output unstable.
- if detrand.Bool() {
- e.out = append(e.out, ' ')
- }
-
- case e.lastType == messageOpen && next != messageClose:
- e.indents = append(e.indents, e.indent...)
- e.out = append(e.out, '\n')
- e.out = append(e.out, e.indents...)
-
- case e.lastType&(scalar|messageClose) != 0:
- if next == messageClose {
- e.indents = e.indents[:len(e.indents)-len(e.indent)]
- }
- e.out = append(e.out, '\n')
- e.out = append(e.out, e.indents...)
- }
-}
-
-// Snapshot returns the current snapshot for use in Reset.
-func (e *Encoder) Snapshot() encoderState {
- return e.encoderState
-}
-
-// Reset resets the Encoder to the given encoderState from a Snapshot.
-func (e *Encoder) Reset(es encoderState) {
- e.encoderState = es
-}
-
-// AppendString appends the escaped form of the input string to b.
-func AppendString(b []byte, s string) []byte {
- return appendString(b, s, false)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/errors/errors.go b/vendor/google.golang.org/protobuf/internal/errors/errors.go
deleted file mode 100644
index 20c17b3..0000000
--- a/vendor/google.golang.org/protobuf/internal/errors/errors.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2018 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.
-
-// Package errors implements functions to manipulate errors.
-package errors
-
-import (
- "errors"
- "fmt"
-
- "google.golang.org/protobuf/internal/detrand"
-)
-
-// Error is a sentinel matching all errors produced by this package.
-var Error = errors.New("protobuf error")
-
-// New formats a string according to the format specifier and arguments and
-// returns an error that has a "proto" prefix.
-func New(f string, x ...interface{}) error {
- return &prefixError{s: format(f, x...)}
-}
-
-type prefixError struct{ s string }
-
-var prefix = func() string {
- // Deliberately introduce instability into the error message string to
- // discourage users from performing error string comparisons.
- if detrand.Bool() {
- return "proto: " // use non-breaking spaces (U+00a0)
- } else {
- return "proto: " // use regular spaces (U+0020)
- }
-}()
-
-func (e *prefixError) Error() string {
- return prefix + e.s
-}
-
-func (e *prefixError) Unwrap() error {
- return Error
-}
-
-// Wrap returns an error that has a "proto" prefix, the formatted string described
-// by the format specifier and arguments, and a suffix of err. The error wraps err.
-func Wrap(err error, f string, x ...interface{}) error {
- return &wrapError{
- s: format(f, x...),
- err: err,
- }
-}
-
-type wrapError struct {
- s string
- err error
-}
-
-func (e *wrapError) Error() string {
- return format("%v%v: %v", prefix, e.s, e.err)
-}
-
-func (e *wrapError) Unwrap() error {
- return e.err
-}
-
-func (e *wrapError) Is(target error) bool {
- return target == Error
-}
-
-func format(f string, x ...interface{}) string {
- // avoid "proto: " prefix when chaining
- for i := 0; i < len(x); i++ {
- switch e := x[i].(type) {
- case *prefixError:
- x[i] = e.s
- case *wrapError:
- x[i] = format("%v: %v", e.s, e.err)
- }
- }
- return fmt.Sprintf(f, x...)
-}
-
-func InvalidUTF8(name string) error {
- return New("field %v contains invalid UTF-8", name)
-}
-
-func RequiredNotSet(name string) error {
- return New("required field %v not set", name)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go b/vendor/google.golang.org/protobuf/internal/errors/is_go112.go
deleted file mode 100644
index fbcd349..0000000
--- a/vendor/google.golang.org/protobuf/internal/errors/is_go112.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2020 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.
-
-//go:build !go1.13
-// +build !go1.13
-
-package errors
-
-import "reflect"
-
-// Is is a copy of Go 1.13's errors.Is for use with older Go versions.
-func Is(err, target error) bool {
- if target == nil {
- return err == target
- }
-
- isComparable := reflect.TypeOf(target).Comparable()
- for {
- if isComparable && err == target {
- return true
- }
- if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) {
- return true
- }
- if err = unwrap(err); err == nil {
- return false
- }
- }
-}
-
-func unwrap(err error) error {
- u, ok := err.(interface {
- Unwrap() error
- })
- if !ok {
- return nil
- }
- return u.Unwrap()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go b/vendor/google.golang.org/protobuf/internal/errors/is_go113.go
deleted file mode 100644
index 5e72f1c..0000000
--- a/vendor/google.golang.org/protobuf/internal/errors/is_go113.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2020 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.
-
-//go:build go1.13
-// +build go1.13
-
-package errors
-
-import "errors"
-
-// Is is errors.Is.
-func Is(err, target error) bool { return errors.Is(err, target) }
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/build.go b/vendor/google.golang.org/protobuf/internal/filedesc/build.go
deleted file mode 100644
index 7cac1c1..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/build.go
+++ /dev/null
@@ -1,157 +0,0 @@
-// 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.
-
-// Package filedesc provides functionality for constructing descriptors.
-//
-// The types in this package implement interfaces in the protoreflect package
-// related to protobuf descripriptors.
-package filedesc
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// Builder construct a protoreflect.FileDescriptor from the raw descriptor.
-type Builder struct {
- // GoPackagePath is the Go package path that is invoking this builder.
- GoPackagePath string
-
- // RawDescriptor is the wire-encoded bytes of FileDescriptorProto
- // and must be populated.
- RawDescriptor []byte
-
- // NumEnums is the total number of enums declared in the file.
- NumEnums int32
- // NumMessages is the total number of messages declared in the file.
- // It includes the implicit message declarations for map entries.
- NumMessages int32
- // NumExtensions is the total number of extensions declared in the file.
- NumExtensions int32
- // NumServices is the total number of services declared in the file.
- NumServices int32
-
- // TypeResolver resolves extension field types for descriptor options.
- // If nil, it uses protoregistry.GlobalTypes.
- TypeResolver interface {
- protoregistry.ExtensionTypeResolver
- }
-
- // FileRegistry is use to lookup file, enum, and message dependencies.
- // Once constructed, the file descriptor is registered here.
- // If nil, it uses protoregistry.GlobalFiles.
- FileRegistry interface {
- FindFileByPath(string) (protoreflect.FileDescriptor, error)
- FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
- RegisterFile(protoreflect.FileDescriptor) error
- }
-}
-
-// resolverByIndex is an interface Builder.FileRegistry may implement.
-// If so, it permits looking up an enum or message dependency based on the
-// sub-list and element index into filetype.Builder.DependencyIndexes.
-type resolverByIndex interface {
- FindEnumByIndex(int32, int32, []Enum, []Message) protoreflect.EnumDescriptor
- FindMessageByIndex(int32, int32, []Enum, []Message) protoreflect.MessageDescriptor
-}
-
-// Indexes of each sub-list in filetype.Builder.DependencyIndexes.
-const (
- listFieldDeps int32 = iota
- listExtTargets
- listExtDeps
- listMethInDeps
- listMethOutDeps
-)
-
-// Out is the output of the Builder.
-type Out struct {
- File protoreflect.FileDescriptor
-
- // Enums is all enum descriptors in "flattened ordering".
- Enums []Enum
- // Messages is all message descriptors in "flattened ordering".
- // It includes the implicit message declarations for map entries.
- Messages []Message
- // Extensions is all extension descriptors in "flattened ordering".
- Extensions []Extension
- // Service is all service descriptors in "flattened ordering".
- Services []Service
-}
-
-// Build constructs a FileDescriptor given the parameters set in Builder.
-// It assumes that the inputs are well-formed and panics if any inconsistencies
-// are encountered.
-//
-// If NumEnums+NumMessages+NumExtensions+NumServices is zero,
-// then Build automatically derives them from the raw descriptor.
-func (db Builder) Build() (out Out) {
- // Populate the counts if uninitialized.
- if db.NumEnums+db.NumMessages+db.NumExtensions+db.NumServices == 0 {
- db.unmarshalCounts(db.RawDescriptor, true)
- }
-
- // Initialize resolvers and registries if unpopulated.
- if db.TypeResolver == nil {
- db.TypeResolver = protoregistry.GlobalTypes
- }
- if db.FileRegistry == nil {
- db.FileRegistry = protoregistry.GlobalFiles
- }
-
- fd := newRawFile(db)
- out.File = fd
- out.Enums = fd.allEnums
- out.Messages = fd.allMessages
- out.Extensions = fd.allExtensions
- out.Services = fd.allServices
-
- if err := db.FileRegistry.RegisterFile(fd); err != nil {
- panic(err)
- }
- return out
-}
-
-// unmarshalCounts counts the number of enum, message, extension, and service
-// declarations in the raw message, which is either a FileDescriptorProto
-// or a MessageDescriptorProto depending on whether isFile is set.
-func (db *Builder) unmarshalCounts(b []byte, isFile bool) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- if isFile {
- switch num {
- case genid.FileDescriptorProto_EnumType_field_number:
- db.NumEnums++
- case genid.FileDescriptorProto_MessageType_field_number:
- db.unmarshalCounts(v, false)
- db.NumMessages++
- case genid.FileDescriptorProto_Extension_field_number:
- db.NumExtensions++
- case genid.FileDescriptorProto_Service_field_number:
- db.NumServices++
- }
- } else {
- switch num {
- case genid.DescriptorProto_EnumType_field_number:
- db.NumEnums++
- case genid.DescriptorProto_NestedType_field_number:
- db.unmarshalCounts(v, false)
- db.NumMessages++
- case genid.DescriptorProto_Extension_field_number:
- db.NumExtensions++
- }
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
deleted file mode 100644
index 193c68e..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go
+++ /dev/null
@@ -1,678 +0,0 @@
-// 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.
-
-package filedesc
-
-import (
- "bytes"
- "fmt"
- "sync"
- "sync/atomic"
-
- "google.golang.org/protobuf/internal/descfmt"
- "google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/encoding/defval"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// Edition is an Enum for proto2.Edition
-type Edition int32
-
-// These values align with the value of Enum in descriptor.proto which allows
-// direct conversion between the proto enum and this enum.
-const (
- EditionUnknown Edition = 0
- EditionProto2 Edition = 998
- EditionProto3 Edition = 999
- Edition2023 Edition = 1000
- EditionUnsupported Edition = 100000
-)
-
-// The types in this file may have a suffix:
-// • L0: Contains fields common to all descriptors (except File) and
-// must be initialized up front.
-// • L1: Contains fields specific to a descriptor and
-// must be initialized up front. If the associated proto uses Editions, the
-// Editions features must always be resolved. If not explicitly set, the
-// appropriate default must be resolved and set.
-// • L2: Contains fields that are lazily initialized when constructing
-// from the raw file descriptor. When constructing as a literal, the L2
-// fields must be initialized up front.
-//
-// The types are exported so that packages like reflect/protodesc can
-// directly construct descriptors.
-
-type (
- File struct {
- fileRaw
- L1 FileL1
-
- once uint32 // atomically set if L2 is valid
- mu sync.Mutex // protects L2
- L2 *FileL2
- }
- FileL1 struct {
- Syntax protoreflect.Syntax
- Edition Edition // Only used if Syntax == Editions
- Path string
- Package protoreflect.FullName
-
- Enums Enums
- Messages Messages
- Extensions Extensions
- Services Services
-
- EditionFeatures FileEditionFeatures
- }
- FileL2 struct {
- Options func() protoreflect.ProtoMessage
- Imports FileImports
- Locations SourceLocations
- }
-
- FileEditionFeatures struct {
- // IsFieldPresence is true if field_presence is EXPLICIT
- // https://protobuf.dev/editions/features/#field_presence
- IsFieldPresence bool
- // IsOpenEnum is true if enum_type is OPEN
- // https://protobuf.dev/editions/features/#enum_type
- IsOpenEnum bool
- // IsPacked is true if repeated_field_encoding is PACKED
- // https://protobuf.dev/editions/features/#repeated_field_encoding
- IsPacked bool
- // IsUTF8Validated is true if utf_validation is VERIFY
- // https://protobuf.dev/editions/features/#utf8_validation
- IsUTF8Validated bool
- // IsDelimitedEncoded is true if message_encoding is DELIMITED
- // https://protobuf.dev/editions/features/#message_encoding
- IsDelimitedEncoded bool
- // IsJSONCompliant is true if json_format is ALLOW
- // https://protobuf.dev/editions/features/#json_format
- IsJSONCompliant bool
- }
-)
-
-func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd }
-func (fd *File) Parent() protoreflect.Descriptor { return nil }
-func (fd *File) Index() int { return 0 }
-func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax }
-func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() }
-func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package }
-func (fd *File) IsPlaceholder() bool { return false }
-func (fd *File) Options() protoreflect.ProtoMessage {
- if f := fd.lazyInit().Options; f != nil {
- return f()
- }
- return descopts.File
-}
-func (fd *File) Path() string { return fd.L1.Path }
-func (fd *File) Package() protoreflect.FullName { return fd.L1.Package }
-func (fd *File) Imports() protoreflect.FileImports { return &fd.lazyInit().Imports }
-func (fd *File) Enums() protoreflect.EnumDescriptors { return &fd.L1.Enums }
-func (fd *File) Messages() protoreflect.MessageDescriptors { return &fd.L1.Messages }
-func (fd *File) Extensions() protoreflect.ExtensionDescriptors { return &fd.L1.Extensions }
-func (fd *File) Services() protoreflect.ServiceDescriptors { return &fd.L1.Services }
-func (fd *File) SourceLocations() protoreflect.SourceLocations { return &fd.lazyInit().Locations }
-func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
-func (fd *File) ProtoType(protoreflect.FileDescriptor) {}
-func (fd *File) ProtoInternal(pragma.DoNotImplement) {}
-
-func (fd *File) lazyInit() *FileL2 {
- if atomic.LoadUint32(&fd.once) == 0 {
- fd.lazyInitOnce()
- }
- return fd.L2
-}
-
-func (fd *File) lazyInitOnce() {
- fd.mu.Lock()
- if fd.L2 == nil {
- fd.lazyRawInit() // recursively initializes all L2 structures
- }
- atomic.StoreUint32(&fd.once, 1)
- fd.mu.Unlock()
-}
-
-// GoPackagePath is a pseudo-internal API for determining the Go package path
-// that this file descriptor is declared in.
-//
-// WARNING: This method is exempt from the compatibility promise and may be
-// removed in the future without warning.
-func (fd *File) GoPackagePath() string {
- return fd.builder.GoPackagePath
-}
-
-type (
- Enum struct {
- Base
- L1 EnumL1
- L2 *EnumL2 // protected by fileDesc.once
- }
- EnumL1 struct {
- eagerValues bool // controls whether EnumL2.Values is already populated
- }
- EnumL2 struct {
- Options func() protoreflect.ProtoMessage
- Values EnumValues
- ReservedNames Names
- ReservedRanges EnumRanges
- }
-
- EnumValue struct {
- Base
- L1 EnumValueL1
- }
- EnumValueL1 struct {
- Options func() protoreflect.ProtoMessage
- Number protoreflect.EnumNumber
- }
-)
-
-func (ed *Enum) Options() protoreflect.ProtoMessage {
- if f := ed.lazyInit().Options; f != nil {
- return f()
- }
- return descopts.Enum
-}
-func (ed *Enum) Values() protoreflect.EnumValueDescriptors {
- if ed.L1.eagerValues {
- return &ed.L2.Values
- }
- return &ed.lazyInit().Values
-}
-func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit().ReservedNames }
-func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges }
-func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
-func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {}
-func (ed *Enum) lazyInit() *EnumL2 {
- ed.L0.ParentFile.lazyInit() // implicitly initializes L2
- return ed.L2
-}
-
-func (ed *EnumValue) Options() protoreflect.ProtoMessage {
- if f := ed.L1.Options; f != nil {
- return f()
- }
- return descopts.EnumValue
-}
-func (ed *EnumValue) Number() protoreflect.EnumNumber { return ed.L1.Number }
-func (ed *EnumValue) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) }
-func (ed *EnumValue) ProtoType(protoreflect.EnumValueDescriptor) {}
-
-type (
- Message struct {
- Base
- L1 MessageL1
- L2 *MessageL2 // protected by fileDesc.once
- }
- MessageL1 struct {
- Enums Enums
- Messages Messages
- Extensions Extensions
- IsMapEntry bool // promoted from google.protobuf.MessageOptions
- IsMessageSet bool // promoted from google.protobuf.MessageOptions
- }
- MessageL2 struct {
- Options func() protoreflect.ProtoMessage
- Fields Fields
- Oneofs Oneofs
- ReservedNames Names
- ReservedRanges FieldRanges
- RequiredNumbers FieldNumbers // must be consistent with Fields.Cardinality
- ExtensionRanges FieldRanges
- ExtensionRangeOptions []func() protoreflect.ProtoMessage // must be same length as ExtensionRanges
- }
-
- Field struct {
- Base
- L1 FieldL1
- }
- FieldL1 struct {
- Options func() protoreflect.ProtoMessage
- Number protoreflect.FieldNumber
- Cardinality protoreflect.Cardinality // must be consistent with Message.RequiredNumbers
- Kind protoreflect.Kind
- StringName stringName
- IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
- IsWeak bool // promoted from google.protobuf.FieldOptions
- HasPacked bool // promoted from google.protobuf.FieldOptions
- IsPacked bool // promoted from google.protobuf.FieldOptions
- HasEnforceUTF8 bool // promoted from google.protobuf.FieldOptions
- EnforceUTF8 bool // promoted from google.protobuf.FieldOptions
- Default defaultValue
- ContainingOneof protoreflect.OneofDescriptor // must be consistent with Message.Oneofs.Fields
- Enum protoreflect.EnumDescriptor
- Message protoreflect.MessageDescriptor
-
- // Edition features.
- Presence bool
- }
-
- Oneof struct {
- Base
- L1 OneofL1
- }
- OneofL1 struct {
- Options func() protoreflect.ProtoMessage
- Fields OneofFields // must be consistent with Message.Fields.ContainingOneof
- }
-)
-
-func (md *Message) Options() protoreflect.ProtoMessage {
- if f := md.lazyInit().Options; f != nil {
- return f()
- }
- return descopts.Message
-}
-func (md *Message) IsMapEntry() bool { return md.L1.IsMapEntry }
-func (md *Message) Fields() protoreflect.FieldDescriptors { return &md.lazyInit().Fields }
-func (md *Message) Oneofs() protoreflect.OneofDescriptors { return &md.lazyInit().Oneofs }
-func (md *Message) ReservedNames() protoreflect.Names { return &md.lazyInit().ReservedNames }
-func (md *Message) ReservedRanges() protoreflect.FieldRanges { return &md.lazyInit().ReservedRanges }
-func (md *Message) RequiredNumbers() protoreflect.FieldNumbers { return &md.lazyInit().RequiredNumbers }
-func (md *Message) ExtensionRanges() protoreflect.FieldRanges { return &md.lazyInit().ExtensionRanges }
-func (md *Message) ExtensionRangeOptions(i int) protoreflect.ProtoMessage {
- if f := md.lazyInit().ExtensionRangeOptions[i]; f != nil {
- return f()
- }
- return descopts.ExtensionRange
-}
-func (md *Message) Enums() protoreflect.EnumDescriptors { return &md.L1.Enums }
-func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L1.Messages }
-func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions }
-func (md *Message) ProtoType(protoreflect.MessageDescriptor) {}
-func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
-func (md *Message) lazyInit() *MessageL2 {
- md.L0.ParentFile.lazyInit() // implicitly initializes L2
- return md.L2
-}
-
-// IsMessageSet is a pseudo-internal API for checking whether a message
-// should serialize in the proto1 message format.
-//
-// WARNING: This method is exempt from the compatibility promise and may be
-// removed in the future without warning.
-func (md *Message) IsMessageSet() bool {
- return md.L1.IsMessageSet
-}
-
-func (fd *Field) Options() protoreflect.ProtoMessage {
- if f := fd.L1.Options; f != nil {
- return f()
- }
- return descopts.Field
-}
-func (fd *Field) Number() protoreflect.FieldNumber { return fd.L1.Number }
-func (fd *Field) Cardinality() protoreflect.Cardinality { return fd.L1.Cardinality }
-func (fd *Field) Kind() protoreflect.Kind { return fd.L1.Kind }
-func (fd *Field) HasJSONName() bool { return fd.L1.StringName.hasJSON }
-func (fd *Field) JSONName() string { return fd.L1.StringName.getJSON(fd) }
-func (fd *Field) TextName() string { return fd.L1.StringName.getText(fd) }
-func (fd *Field) HasPresence() bool {
- if fd.L0.ParentFile.L1.Syntax == protoreflect.Editions {
- return fd.L1.Presence || fd.L1.Message != nil || fd.L1.ContainingOneof != nil
- }
- return fd.L1.Cardinality != protoreflect.Repeated && (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 || fd.L1.Message != nil || fd.L1.ContainingOneof != nil)
-}
-func (fd *Field) HasOptionalKeyword() bool {
- return (fd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Optional && fd.L1.ContainingOneof == nil) || fd.L1.IsProto3Optional
-}
-func (fd *Field) IsPacked() bool {
- if !fd.L1.HasPacked && fd.L0.ParentFile.L1.Syntax != protoreflect.Proto2 && fd.L1.Cardinality == protoreflect.Repeated {
- switch fd.L1.Kind {
- case protoreflect.StringKind, protoreflect.BytesKind, protoreflect.MessageKind, protoreflect.GroupKind:
- default:
- return true
- }
- }
- return fd.L1.IsPacked
-}
-func (fd *Field) IsExtension() bool { return false }
-func (fd *Field) IsWeak() bool { return fd.L1.IsWeak }
-func (fd *Field) IsList() bool { return fd.Cardinality() == protoreflect.Repeated && !fd.IsMap() }
-func (fd *Field) IsMap() bool { return fd.Message() != nil && fd.Message().IsMapEntry() }
-func (fd *Field) MapKey() protoreflect.FieldDescriptor {
- if !fd.IsMap() {
- return nil
- }
- return fd.Message().Fields().ByNumber(genid.MapEntry_Key_field_number)
-}
-func (fd *Field) MapValue() protoreflect.FieldDescriptor {
- if !fd.IsMap() {
- return nil
- }
- return fd.Message().Fields().ByNumber(genid.MapEntry_Value_field_number)
-}
-func (fd *Field) HasDefault() bool { return fd.L1.Default.has }
-func (fd *Field) Default() protoreflect.Value { return fd.L1.Default.get(fd) }
-func (fd *Field) DefaultEnumValue() protoreflect.EnumValueDescriptor { return fd.L1.Default.enum }
-func (fd *Field) ContainingOneof() protoreflect.OneofDescriptor { return fd.L1.ContainingOneof }
-func (fd *Field) ContainingMessage() protoreflect.MessageDescriptor {
- return fd.L0.Parent.(protoreflect.MessageDescriptor)
-}
-func (fd *Field) Enum() protoreflect.EnumDescriptor {
- return fd.L1.Enum
-}
-func (fd *Field) Message() protoreflect.MessageDescriptor {
- if fd.L1.IsWeak {
- if d, _ := protoregistry.GlobalFiles.FindDescriptorByName(fd.L1.Message.FullName()); d != nil {
- return d.(protoreflect.MessageDescriptor)
- }
- }
- return fd.L1.Message
-}
-func (fd *Field) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, fd) }
-func (fd *Field) ProtoType(protoreflect.FieldDescriptor) {}
-
-// EnforceUTF8 is a pseudo-internal API to determine whether to enforce UTF-8
-// validation for the string field. This exists for Google-internal use only
-// since proto3 did not enforce UTF-8 validity prior to the open-source release.
-// If this method does not exist, the default is to enforce valid UTF-8.
-//
-// WARNING: This method is exempt from the compatibility promise and may be
-// removed in the future without warning.
-func (fd *Field) EnforceUTF8() bool {
- if fd.L1.HasEnforceUTF8 {
- return fd.L1.EnforceUTF8
- }
- return fd.L0.ParentFile.L1.Syntax == protoreflect.Proto3
-}
-
-func (od *Oneof) IsSynthetic() bool {
- return od.L0.ParentFile.L1.Syntax == protoreflect.Proto3 && len(od.L1.Fields.List) == 1 && od.L1.Fields.List[0].HasOptionalKeyword()
-}
-func (od *Oneof) Options() protoreflect.ProtoMessage {
- if f := od.L1.Options; f != nil {
- return f()
- }
- return descopts.Oneof
-}
-func (od *Oneof) Fields() protoreflect.FieldDescriptors { return &od.L1.Fields }
-func (od *Oneof) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, od) }
-func (od *Oneof) ProtoType(protoreflect.OneofDescriptor) {}
-
-type (
- Extension struct {
- Base
- L1 ExtensionL1
- L2 *ExtensionL2 // protected by fileDesc.once
- }
- ExtensionL1 struct {
- Number protoreflect.FieldNumber
- Extendee protoreflect.MessageDescriptor
- Cardinality protoreflect.Cardinality
- Kind protoreflect.Kind
- }
- ExtensionL2 struct {
- Options func() protoreflect.ProtoMessage
- StringName stringName
- IsProto3Optional bool // promoted from google.protobuf.FieldDescriptorProto
- IsPacked bool // promoted from google.protobuf.FieldOptions
- Default defaultValue
- Enum protoreflect.EnumDescriptor
- Message protoreflect.MessageDescriptor
- }
-)
-
-func (xd *Extension) Options() protoreflect.ProtoMessage {
- if f := xd.lazyInit().Options; f != nil {
- return f()
- }
- return descopts.Field
-}
-func (xd *Extension) Number() protoreflect.FieldNumber { return xd.L1.Number }
-func (xd *Extension) Cardinality() protoreflect.Cardinality { return xd.L1.Cardinality }
-func (xd *Extension) Kind() protoreflect.Kind { return xd.L1.Kind }
-func (xd *Extension) HasJSONName() bool { return xd.lazyInit().StringName.hasJSON }
-func (xd *Extension) JSONName() string { return xd.lazyInit().StringName.getJSON(xd) }
-func (xd *Extension) TextName() string { return xd.lazyInit().StringName.getText(xd) }
-func (xd *Extension) HasPresence() bool { return xd.L1.Cardinality != protoreflect.Repeated }
-func (xd *Extension) HasOptionalKeyword() bool {
- return (xd.L0.ParentFile.L1.Syntax == protoreflect.Proto2 && xd.L1.Cardinality == protoreflect.Optional) || xd.lazyInit().IsProto3Optional
-}
-func (xd *Extension) IsPacked() bool { return xd.lazyInit().IsPacked }
-func (xd *Extension) IsExtension() bool { return true }
-func (xd *Extension) IsWeak() bool { return false }
-func (xd *Extension) IsList() bool { return xd.Cardinality() == protoreflect.Repeated }
-func (xd *Extension) IsMap() bool { return false }
-func (xd *Extension) MapKey() protoreflect.FieldDescriptor { return nil }
-func (xd *Extension) MapValue() protoreflect.FieldDescriptor { return nil }
-func (xd *Extension) HasDefault() bool { return xd.lazyInit().Default.has }
-func (xd *Extension) Default() protoreflect.Value { return xd.lazyInit().Default.get(xd) }
-func (xd *Extension) DefaultEnumValue() protoreflect.EnumValueDescriptor {
- return xd.lazyInit().Default.enum
-}
-func (xd *Extension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
-func (xd *Extension) ContainingMessage() protoreflect.MessageDescriptor { return xd.L1.Extendee }
-func (xd *Extension) Enum() protoreflect.EnumDescriptor { return xd.lazyInit().Enum }
-func (xd *Extension) Message() protoreflect.MessageDescriptor { return xd.lazyInit().Message }
-func (xd *Extension) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, xd) }
-func (xd *Extension) ProtoType(protoreflect.FieldDescriptor) {}
-func (xd *Extension) ProtoInternal(pragma.DoNotImplement) {}
-func (xd *Extension) lazyInit() *ExtensionL2 {
- xd.L0.ParentFile.lazyInit() // implicitly initializes L2
- return xd.L2
-}
-
-type (
- Service struct {
- Base
- L1 ServiceL1
- L2 *ServiceL2 // protected by fileDesc.once
- }
- ServiceL1 struct{}
- ServiceL2 struct {
- Options func() protoreflect.ProtoMessage
- Methods Methods
- }
-
- Method struct {
- Base
- L1 MethodL1
- }
- MethodL1 struct {
- Options func() protoreflect.ProtoMessage
- Input protoreflect.MessageDescriptor
- Output protoreflect.MessageDescriptor
- IsStreamingClient bool
- IsStreamingServer bool
- }
-)
-
-func (sd *Service) Options() protoreflect.ProtoMessage {
- if f := sd.lazyInit().Options; f != nil {
- return f()
- }
- return descopts.Service
-}
-func (sd *Service) Methods() protoreflect.MethodDescriptors { return &sd.lazyInit().Methods }
-func (sd *Service) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, sd) }
-func (sd *Service) ProtoType(protoreflect.ServiceDescriptor) {}
-func (sd *Service) ProtoInternal(pragma.DoNotImplement) {}
-func (sd *Service) lazyInit() *ServiceL2 {
- sd.L0.ParentFile.lazyInit() // implicitly initializes L2
- return sd.L2
-}
-
-func (md *Method) Options() protoreflect.ProtoMessage {
- if f := md.L1.Options; f != nil {
- return f()
- }
- return descopts.Method
-}
-func (md *Method) Input() protoreflect.MessageDescriptor { return md.L1.Input }
-func (md *Method) Output() protoreflect.MessageDescriptor { return md.L1.Output }
-func (md *Method) IsStreamingClient() bool { return md.L1.IsStreamingClient }
-func (md *Method) IsStreamingServer() bool { return md.L1.IsStreamingServer }
-func (md *Method) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) }
-func (md *Method) ProtoType(protoreflect.MethodDescriptor) {}
-func (md *Method) ProtoInternal(pragma.DoNotImplement) {}
-
-// Surrogate files are can be used to create standalone descriptors
-// where the syntax is only information derived from the parent file.
-var (
- SurrogateProto2 = &File{L1: FileL1{Syntax: protoreflect.Proto2}, L2: &FileL2{}}
- SurrogateProto3 = &File{L1: FileL1{Syntax: protoreflect.Proto3}, L2: &FileL2{}}
-)
-
-type (
- Base struct {
- L0 BaseL0
- }
- BaseL0 struct {
- FullName protoreflect.FullName // must be populated
- ParentFile *File // must be populated
- Parent protoreflect.Descriptor
- Index int
- }
-)
-
-func (d *Base) Name() protoreflect.Name { return d.L0.FullName.Name() }
-func (d *Base) FullName() protoreflect.FullName { return d.L0.FullName }
-func (d *Base) ParentFile() protoreflect.FileDescriptor {
- if d.L0.ParentFile == SurrogateProto2 || d.L0.ParentFile == SurrogateProto3 {
- return nil // surrogate files are not real parents
- }
- return d.L0.ParentFile
-}
-func (d *Base) Parent() protoreflect.Descriptor { return d.L0.Parent }
-func (d *Base) Index() int { return d.L0.Index }
-func (d *Base) Syntax() protoreflect.Syntax { return d.L0.ParentFile.Syntax() }
-func (d *Base) IsPlaceholder() bool { return false }
-func (d *Base) ProtoInternal(pragma.DoNotImplement) {}
-
-type stringName struct {
- hasJSON bool
- once sync.Once
- nameJSON string
- nameText string
-}
-
-// InitJSON initializes the name. It is exported for use by other internal packages.
-func (s *stringName) InitJSON(name string) {
- s.hasJSON = true
- s.nameJSON = name
-}
-
-func (s *stringName) lazyInit(fd protoreflect.FieldDescriptor) *stringName {
- s.once.Do(func() {
- if fd.IsExtension() {
- // For extensions, JSON and text are formatted the same way.
- var name string
- if messageset.IsMessageSetExtension(fd) {
- name = string("[" + fd.FullName().Parent() + "]")
- } else {
- name = string("[" + fd.FullName() + "]")
- }
- s.nameJSON = name
- s.nameText = name
- } else {
- // Format the JSON name.
- if !s.hasJSON {
- s.nameJSON = strs.JSONCamelCase(string(fd.Name()))
- }
-
- // Format the text name.
- s.nameText = string(fd.Name())
- if fd.Kind() == protoreflect.GroupKind {
- s.nameText = string(fd.Message().Name())
- }
- }
- })
- return s
-}
-
-func (s *stringName) getJSON(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameJSON }
-func (s *stringName) getText(fd protoreflect.FieldDescriptor) string { return s.lazyInit(fd).nameText }
-
-func DefaultValue(v protoreflect.Value, ev protoreflect.EnumValueDescriptor) defaultValue {
- dv := defaultValue{has: v.IsValid(), val: v, enum: ev}
- if b, ok := v.Interface().([]byte); ok {
- // Store a copy of the default bytes, so that we can detect
- // accidental mutations of the original value.
- dv.bytes = append([]byte(nil), b...)
- }
- return dv
-}
-
-func unmarshalDefault(b []byte, k protoreflect.Kind, pf *File, ed protoreflect.EnumDescriptor) defaultValue {
- var evs protoreflect.EnumValueDescriptors
- if k == protoreflect.EnumKind {
- // If the enum is declared within the same file, be careful not to
- // blindly call the Values method, lest we bind ourselves in a deadlock.
- if e, ok := ed.(*Enum); ok && e.L0.ParentFile == pf {
- evs = &e.L2.Values
- } else {
- evs = ed.Values()
- }
-
- // If we are unable to resolve the enum dependency, use a placeholder
- // enum value since we will not be able to parse the default value.
- if ed.IsPlaceholder() && protoreflect.Name(b).IsValid() {
- v := protoreflect.ValueOfEnum(0)
- ev := PlaceholderEnumValue(ed.FullName().Parent().Append(protoreflect.Name(b)))
- return DefaultValue(v, ev)
- }
- }
-
- v, ev, err := defval.Unmarshal(string(b), k, evs, defval.Descriptor)
- if err != nil {
- panic(err)
- }
- return DefaultValue(v, ev)
-}
-
-type defaultValue struct {
- has bool
- val protoreflect.Value
- enum protoreflect.EnumValueDescriptor
- bytes []byte
-}
-
-func (dv *defaultValue) get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- // Return the zero value as the default if unpopulated.
- if !dv.has {
- if fd.Cardinality() == protoreflect.Repeated {
- return protoreflect.Value{}
- }
- switch fd.Kind() {
- case protoreflect.BoolKind:
- return protoreflect.ValueOfBool(false)
- case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
- return protoreflect.ValueOfInt32(0)
- case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
- return protoreflect.ValueOfInt64(0)
- case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
- return protoreflect.ValueOfUint32(0)
- case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
- return protoreflect.ValueOfUint64(0)
- case protoreflect.FloatKind:
- return protoreflect.ValueOfFloat32(0)
- case protoreflect.DoubleKind:
- return protoreflect.ValueOfFloat64(0)
- case protoreflect.StringKind:
- return protoreflect.ValueOfString("")
- case protoreflect.BytesKind:
- return protoreflect.ValueOfBytes(nil)
- case protoreflect.EnumKind:
- if evs := fd.Enum().Values(); evs.Len() > 0 {
- return protoreflect.ValueOfEnum(evs.Get(0).Number())
- }
- return protoreflect.ValueOfEnum(0)
- }
- }
-
- if len(dv.bytes) > 0 && !bytes.Equal(dv.bytes, dv.val.Bytes()) {
- // TODO: Avoid panic if we're running with the race detector
- // and instead spawn a goroutine that periodically resets
- // this value back to the original to induce a race.
- panic(fmt.Sprintf("detected mutation on the default bytes for %v", fd.FullName()))
- }
- return dv.val
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
deleted file mode 100644
index 4a1584c..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go
+++ /dev/null
@@ -1,471 +0,0 @@
-// 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.
-
-package filedesc
-
-import (
- "sync"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// fileRaw is a data struct used when initializing a file descriptor from
-// a raw FileDescriptorProto.
-type fileRaw struct {
- builder Builder
- allEnums []Enum
- allMessages []Message
- allExtensions []Extension
- allServices []Service
-}
-
-func newRawFile(db Builder) *File {
- fd := &File{fileRaw: fileRaw{builder: db}}
- fd.initDecls(db.NumEnums, db.NumMessages, db.NumExtensions, db.NumServices)
- fd.unmarshalSeed(db.RawDescriptor)
-
- // Extended message targets are eagerly resolved since registration
- // needs this information at program init time.
- for i := range fd.allExtensions {
- xd := &fd.allExtensions[i]
- xd.L1.Extendee = fd.resolveMessageDependency(xd.L1.Extendee, listExtTargets, int32(i))
- }
-
- fd.checkDecls()
- return fd
-}
-
-// initDecls pre-allocates slices for the exact number of enums, messages
-// (including map entries), extensions, and services declared in the proto file.
-// This is done to avoid regrowing the slice, which would change the address
-// for any previously seen declaration.
-//
-// The alloc methods "allocates" slices by pulling from the capacity.
-func (fd *File) initDecls(numEnums, numMessages, numExtensions, numServices int32) {
- fd.allEnums = make([]Enum, 0, numEnums)
- fd.allMessages = make([]Message, 0, numMessages)
- fd.allExtensions = make([]Extension, 0, numExtensions)
- fd.allServices = make([]Service, 0, numServices)
-}
-
-func (fd *File) allocEnums(n int) []Enum {
- total := len(fd.allEnums)
- es := fd.allEnums[total : total+n]
- fd.allEnums = fd.allEnums[:total+n]
- return es
-}
-func (fd *File) allocMessages(n int) []Message {
- total := len(fd.allMessages)
- ms := fd.allMessages[total : total+n]
- fd.allMessages = fd.allMessages[:total+n]
- return ms
-}
-func (fd *File) allocExtensions(n int) []Extension {
- total := len(fd.allExtensions)
- xs := fd.allExtensions[total : total+n]
- fd.allExtensions = fd.allExtensions[:total+n]
- return xs
-}
-func (fd *File) allocServices(n int) []Service {
- total := len(fd.allServices)
- xs := fd.allServices[total : total+n]
- fd.allServices = fd.allServices[:total+n]
- return xs
-}
-
-// checkDecls performs a sanity check that the expected number of expected
-// declarations matches the number that were found in the descriptor proto.
-func (fd *File) checkDecls() {
- switch {
- case len(fd.allEnums) != cap(fd.allEnums):
- case len(fd.allMessages) != cap(fd.allMessages):
- case len(fd.allExtensions) != cap(fd.allExtensions):
- case len(fd.allServices) != cap(fd.allServices):
- default:
- return
- }
- panic("mismatching cardinality")
-}
-
-func (fd *File) unmarshalSeed(b []byte) {
- sb := getBuilder()
- defer putBuilder(sb)
-
- var prevField protoreflect.FieldNumber
- var numEnums, numMessages, numExtensions, numServices int
- var posEnums, posMessages, posExtensions, posServices int
- b0 := b
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FileDescriptorProto_Syntax_field_number:
- switch string(v) {
- case "proto2":
- fd.L1.Syntax = protoreflect.Proto2
- case "proto3":
- fd.L1.Syntax = protoreflect.Proto3
- default:
- panic("invalid syntax")
- }
- case genid.FileDescriptorProto_Name_field_number:
- fd.L1.Path = sb.MakeString(v)
- case genid.FileDescriptorProto_Package_field_number:
- fd.L1.Package = protoreflect.FullName(sb.MakeString(v))
- case genid.FileDescriptorProto_EnumType_field_number:
- if prevField != genid.FileDescriptorProto_EnumType_field_number {
- if numEnums > 0 {
- panic("non-contiguous repeated field")
- }
- posEnums = len(b0) - len(b) - n - m
- }
- numEnums++
- case genid.FileDescriptorProto_MessageType_field_number:
- if prevField != genid.FileDescriptorProto_MessageType_field_number {
- if numMessages > 0 {
- panic("non-contiguous repeated field")
- }
- posMessages = len(b0) - len(b) - n - m
- }
- numMessages++
- case genid.FileDescriptorProto_Extension_field_number:
- if prevField != genid.FileDescriptorProto_Extension_field_number {
- if numExtensions > 0 {
- panic("non-contiguous repeated field")
- }
- posExtensions = len(b0) - len(b) - n - m
- }
- numExtensions++
- case genid.FileDescriptorProto_Service_field_number:
- if prevField != genid.FileDescriptorProto_Service_field_number {
- if numServices > 0 {
- panic("non-contiguous repeated field")
- }
- posServices = len(b0) - len(b) - n - m
- }
- numServices++
- }
- prevField = num
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- prevField = -1 // ignore known field numbers of unknown wire type
- }
- }
-
- // If syntax is missing, it is assumed to be proto2.
- if fd.L1.Syntax == 0 {
- fd.L1.Syntax = protoreflect.Proto2
- }
-
- // Must allocate all declarations before parsing each descriptor type
- // to ensure we handled all descriptors in "flattened ordering".
- if numEnums > 0 {
- fd.L1.Enums.List = fd.allocEnums(numEnums)
- }
- if numMessages > 0 {
- fd.L1.Messages.List = fd.allocMessages(numMessages)
- }
- if numExtensions > 0 {
- fd.L1.Extensions.List = fd.allocExtensions(numExtensions)
- }
- if numServices > 0 {
- fd.L1.Services.List = fd.allocServices(numServices)
- }
-
- if numEnums > 0 {
- b := b0[posEnums:]
- for i := range fd.L1.Enums.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- fd.L1.Enums.List[i].unmarshalSeed(v, sb, fd, fd, i)
- b = b[n+m:]
- }
- }
- if numMessages > 0 {
- b := b0[posMessages:]
- for i := range fd.L1.Messages.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- fd.L1.Messages.List[i].unmarshalSeed(v, sb, fd, fd, i)
- b = b[n+m:]
- }
- }
- if numExtensions > 0 {
- b := b0[posExtensions:]
- for i := range fd.L1.Extensions.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- fd.L1.Extensions.List[i].unmarshalSeed(v, sb, fd, fd, i)
- b = b[n+m:]
- }
- }
- if numServices > 0 {
- b := b0[posServices:]
- for i := range fd.L1.Services.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- fd.L1.Services.List[i].unmarshalSeed(v, sb, fd, fd, i)
- b = b[n+m:]
- }
- }
-}
-
-func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- ed.L0.ParentFile = pf
- ed.L0.Parent = pd
- ed.L0.Index = i
-
- var numValues int
- for b := b; len(b) > 0; {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.EnumDescriptorProto_Name_field_number:
- ed.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.EnumDescriptorProto_Value_field_number:
- numValues++
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-
- // Only construct enum value descriptors for top-level enums since
- // they are needed for registration.
- if pd != pf {
- return
- }
- ed.L1.eagerValues = true
- ed.L2 = new(EnumL2)
- ed.L2.Values.List = make([]EnumValue, numValues)
- for i := 0; len(b) > 0; {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.EnumDescriptorProto_Value_field_number:
- ed.L2.Values.List[i].unmarshalFull(v, sb, pf, ed, i)
- i++
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- md.L0.ParentFile = pf
- md.L0.Parent = pd
- md.L0.Index = i
-
- var prevField protoreflect.FieldNumber
- var numEnums, numMessages, numExtensions int
- var posEnums, posMessages, posExtensions int
- b0 := b
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_Name_field_number:
- md.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.DescriptorProto_EnumType_field_number:
- if prevField != genid.DescriptorProto_EnumType_field_number {
- if numEnums > 0 {
- panic("non-contiguous repeated field")
- }
- posEnums = len(b0) - len(b) - n - m
- }
- numEnums++
- case genid.DescriptorProto_NestedType_field_number:
- if prevField != genid.DescriptorProto_NestedType_field_number {
- if numMessages > 0 {
- panic("non-contiguous repeated field")
- }
- posMessages = len(b0) - len(b) - n - m
- }
- numMessages++
- case genid.DescriptorProto_Extension_field_number:
- if prevField != genid.DescriptorProto_Extension_field_number {
- if numExtensions > 0 {
- panic("non-contiguous repeated field")
- }
- posExtensions = len(b0) - len(b) - n - m
- }
- numExtensions++
- case genid.DescriptorProto_Options_field_number:
- md.unmarshalSeedOptions(v)
- }
- prevField = num
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- prevField = -1 // ignore known field numbers of unknown wire type
- }
- }
-
- // Must allocate all declarations before parsing each descriptor type
- // to ensure we handled all descriptors in "flattened ordering".
- if numEnums > 0 {
- md.L1.Enums.List = pf.allocEnums(numEnums)
- }
- if numMessages > 0 {
- md.L1.Messages.List = pf.allocMessages(numMessages)
- }
- if numExtensions > 0 {
- md.L1.Extensions.List = pf.allocExtensions(numExtensions)
- }
-
- if numEnums > 0 {
- b := b0[posEnums:]
- for i := range md.L1.Enums.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- md.L1.Enums.List[i].unmarshalSeed(v, sb, pf, md, i)
- b = b[n+m:]
- }
- }
- if numMessages > 0 {
- b := b0[posMessages:]
- for i := range md.L1.Messages.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- md.L1.Messages.List[i].unmarshalSeed(v, sb, pf, md, i)
- b = b[n+m:]
- }
- }
- if numExtensions > 0 {
- b := b0[posExtensions:]
- for i := range md.L1.Extensions.List {
- _, n := protowire.ConsumeVarint(b)
- v, m := protowire.ConsumeBytes(b[n:])
- md.L1.Extensions.List[i].unmarshalSeed(v, sb, pf, md, i)
- b = b[n+m:]
- }
- }
-}
-
-func (md *Message) unmarshalSeedOptions(b []byte) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.MessageOptions_MapEntry_field_number:
- md.L1.IsMapEntry = protowire.DecodeBool(v)
- case genid.MessageOptions_MessageSetWireFormat_field_number:
- md.L1.IsMessageSet = protowire.DecodeBool(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func (xd *Extension) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- xd.L0.ParentFile = pf
- xd.L0.Parent = pd
- xd.L0.Index = i
-
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_Number_field_number:
- xd.L1.Number = protoreflect.FieldNumber(v)
- case genid.FieldDescriptorProto_Label_field_number:
- xd.L1.Cardinality = protoreflect.Cardinality(v)
- case genid.FieldDescriptorProto_Type_field_number:
- xd.L1.Kind = protoreflect.Kind(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_Name_field_number:
- xd.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.FieldDescriptorProto_Extendee_field_number:
- xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func (sd *Service) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- sd.L0.ParentFile = pf
- sd.L0.Parent = pd
- sd.L0.Index = i
-
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.ServiceDescriptorProto_Name_field_number:
- sd.L0.FullName = appendFullName(sb, pd.FullName(), v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-var nameBuilderPool = sync.Pool{
- New: func() interface{} { return new(strs.Builder) },
-}
-
-func getBuilder() *strs.Builder {
- return nameBuilderPool.Get().(*strs.Builder)
-}
-func putBuilder(b *strs.Builder) {
- nameBuilderPool.Put(b)
-}
-
-// makeFullName converts b to a protoreflect.FullName,
-// where b must start with a leading dot.
-func makeFullName(sb *strs.Builder, b []byte) protoreflect.FullName {
- if len(b) == 0 || b[0] != '.' {
- panic("name reference must be fully qualified")
- }
- return protoreflect.FullName(sb.MakeString(b[1:]))
-}
-
-func appendFullName(sb *strs.Builder, prefix protoreflect.FullName, suffix []byte) protoreflect.FullName {
- return sb.AppendFullName(prefix, protoreflect.Name(strs.UnsafeString(suffix)))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
deleted file mode 100644
index 736a19a..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go
+++ /dev/null
@@ -1,704 +0,0 @@
-// 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.
-
-package filedesc
-
-import (
- "reflect"
- "sync"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-func (fd *File) lazyRawInit() {
- fd.unmarshalFull(fd.builder.RawDescriptor)
- fd.resolveMessages()
- fd.resolveExtensions()
- fd.resolveServices()
-}
-
-func (file *File) resolveMessages() {
- var depIdx int32
- for i := range file.allMessages {
- md := &file.allMessages[i]
-
- // Resolve message field dependencies.
- for j := range md.L2.Fields.List {
- fd := &md.L2.Fields.List[j]
-
- // Weak fields are resolved upon actual use.
- if fd.L1.IsWeak {
- continue
- }
-
- // Resolve message field dependency.
- switch fd.L1.Kind {
- case protoreflect.EnumKind:
- fd.L1.Enum = file.resolveEnumDependency(fd.L1.Enum, listFieldDeps, depIdx)
- depIdx++
- case protoreflect.MessageKind, protoreflect.GroupKind:
- fd.L1.Message = file.resolveMessageDependency(fd.L1.Message, listFieldDeps, depIdx)
- depIdx++
- }
-
- // Default is resolved here since it depends on Enum being resolved.
- if v := fd.L1.Default.val; v.IsValid() {
- fd.L1.Default = unmarshalDefault(v.Bytes(), fd.L1.Kind, file, fd.L1.Enum)
- }
- }
- }
-}
-
-func (file *File) resolveExtensions() {
- var depIdx int32
- for i := range file.allExtensions {
- xd := &file.allExtensions[i]
-
- // Resolve extension field dependency.
- switch xd.L1.Kind {
- case protoreflect.EnumKind:
- xd.L2.Enum = file.resolveEnumDependency(xd.L2.Enum, listExtDeps, depIdx)
- depIdx++
- case protoreflect.MessageKind, protoreflect.GroupKind:
- xd.L2.Message = file.resolveMessageDependency(xd.L2.Message, listExtDeps, depIdx)
- depIdx++
- }
-
- // Default is resolved here since it depends on Enum being resolved.
- if v := xd.L2.Default.val; v.IsValid() {
- xd.L2.Default = unmarshalDefault(v.Bytes(), xd.L1.Kind, file, xd.L2.Enum)
- }
- }
-}
-
-func (file *File) resolveServices() {
- var depIdx int32
- for i := range file.allServices {
- sd := &file.allServices[i]
-
- // Resolve method dependencies.
- for j := range sd.L2.Methods.List {
- md := &sd.L2.Methods.List[j]
- md.L1.Input = file.resolveMessageDependency(md.L1.Input, listMethInDeps, depIdx)
- md.L1.Output = file.resolveMessageDependency(md.L1.Output, listMethOutDeps, depIdx)
- depIdx++
- }
- }
-}
-
-func (file *File) resolveEnumDependency(ed protoreflect.EnumDescriptor, i, j int32) protoreflect.EnumDescriptor {
- r := file.builder.FileRegistry
- if r, ok := r.(resolverByIndex); ok {
- if ed2 := r.FindEnumByIndex(i, j, file.allEnums, file.allMessages); ed2 != nil {
- return ed2
- }
- }
- for i := range file.allEnums {
- if ed2 := &file.allEnums[i]; ed2.L0.FullName == ed.FullName() {
- return ed2
- }
- }
- if d, _ := r.FindDescriptorByName(ed.FullName()); d != nil {
- return d.(protoreflect.EnumDescriptor)
- }
- return ed
-}
-
-func (file *File) resolveMessageDependency(md protoreflect.MessageDescriptor, i, j int32) protoreflect.MessageDescriptor {
- r := file.builder.FileRegistry
- if r, ok := r.(resolverByIndex); ok {
- if md2 := r.FindMessageByIndex(i, j, file.allEnums, file.allMessages); md2 != nil {
- return md2
- }
- }
- for i := range file.allMessages {
- if md2 := &file.allMessages[i]; md2.L0.FullName == md.FullName() {
- return md2
- }
- }
- if d, _ := r.FindDescriptorByName(md.FullName()); d != nil {
- return d.(protoreflect.MessageDescriptor)
- }
- return md
-}
-
-func (fd *File) unmarshalFull(b []byte) {
- sb := getBuilder()
- defer putBuilder(sb)
-
- var enumIdx, messageIdx, extensionIdx, serviceIdx int
- var rawOptions []byte
- fd.L2 = new(FileL2)
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FileDescriptorProto_PublicDependency_field_number:
- fd.L2.Imports[v].IsPublic = true
- case genid.FileDescriptorProto_WeakDependency_field_number:
- fd.L2.Imports[v].IsWeak = true
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FileDescriptorProto_Dependency_field_number:
- path := sb.MakeString(v)
- imp, _ := fd.builder.FileRegistry.FindFileByPath(path)
- if imp == nil {
- imp = PlaceholderFile(path)
- }
- fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp})
- case genid.FileDescriptorProto_EnumType_field_number:
- fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
- enumIdx++
- case genid.FileDescriptorProto_MessageType_field_number:
- fd.L1.Messages.List[messageIdx].unmarshalFull(v, sb)
- messageIdx++
- case genid.FileDescriptorProto_Extension_field_number:
- fd.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)
- extensionIdx++
- case genid.FileDescriptorProto_Service_field_number:
- fd.L1.Services.List[serviceIdx].unmarshalFull(v, sb)
- serviceIdx++
- case genid.FileDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- fd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions)
-}
-
-func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) {
- var rawValues [][]byte
- var rawOptions []byte
- if !ed.L1.eagerValues {
- ed.L2 = new(EnumL2)
- }
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.EnumDescriptorProto_Value_field_number:
- rawValues = append(rawValues, v)
- case genid.EnumDescriptorProto_ReservedName_field_number:
- ed.L2.ReservedNames.List = append(ed.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
- case genid.EnumDescriptorProto_ReservedRange_field_number:
- ed.L2.ReservedRanges.List = append(ed.L2.ReservedRanges.List, unmarshalEnumReservedRange(v))
- case genid.EnumDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- if !ed.L1.eagerValues && len(rawValues) > 0 {
- ed.L2.Values.List = make([]EnumValue, len(rawValues))
- for i, b := range rawValues {
- ed.L2.Values.List[i].unmarshalFull(b, sb, ed.L0.ParentFile, ed, i)
- }
- }
- ed.L2.Options = ed.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Enum, rawOptions)
-}
-
-func unmarshalEnumReservedRange(b []byte) (r [2]protoreflect.EnumNumber) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.EnumDescriptorProto_EnumReservedRange_Start_field_number:
- r[0] = protoreflect.EnumNumber(v)
- case genid.EnumDescriptorProto_EnumReservedRange_End_field_number:
- r[1] = protoreflect.EnumNumber(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- return r
-}
-
-func (vd *EnumValue) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- vd.L0.ParentFile = pf
- vd.L0.Parent = pd
- vd.L0.Index = i
-
- var rawOptions []byte
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.EnumValueDescriptorProto_Number_field_number:
- vd.L1.Number = protoreflect.EnumNumber(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.EnumValueDescriptorProto_Name_field_number:
- // NOTE: Enum values are in the same scope as the enum parent.
- vd.L0.FullName = appendFullName(sb, pd.Parent().FullName(), v)
- case genid.EnumValueDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- vd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.EnumValue, rawOptions)
-}
-
-func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) {
- var rawFields, rawOneofs [][]byte
- var enumIdx, messageIdx, extensionIdx int
- var rawOptions []byte
- md.L2 = new(MessageL2)
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_Field_field_number:
- rawFields = append(rawFields, v)
- case genid.DescriptorProto_OneofDecl_field_number:
- rawOneofs = append(rawOneofs, v)
- case genid.DescriptorProto_ReservedName_field_number:
- md.L2.ReservedNames.List = append(md.L2.ReservedNames.List, protoreflect.Name(sb.MakeString(v)))
- case genid.DescriptorProto_ReservedRange_field_number:
- md.L2.ReservedRanges.List = append(md.L2.ReservedRanges.List, unmarshalMessageReservedRange(v))
- case genid.DescriptorProto_ExtensionRange_field_number:
- r, rawOptions := unmarshalMessageExtensionRange(v)
- opts := md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.ExtensionRange, rawOptions)
- md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, r)
- md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, opts)
- case genid.DescriptorProto_EnumType_field_number:
- md.L1.Enums.List[enumIdx].unmarshalFull(v, sb)
- enumIdx++
- case genid.DescriptorProto_NestedType_field_number:
- md.L1.Messages.List[messageIdx].unmarshalFull(v, sb)
- messageIdx++
- case genid.DescriptorProto_Extension_field_number:
- md.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb)
- extensionIdx++
- case genid.DescriptorProto_Options_field_number:
- md.unmarshalOptions(v)
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- if len(rawFields) > 0 || len(rawOneofs) > 0 {
- md.L2.Fields.List = make([]Field, len(rawFields))
- md.L2.Oneofs.List = make([]Oneof, len(rawOneofs))
- for i, b := range rawFields {
- fd := &md.L2.Fields.List[i]
- fd.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
- if fd.L1.Cardinality == protoreflect.Required {
- md.L2.RequiredNumbers.List = append(md.L2.RequiredNumbers.List, fd.L1.Number)
- }
- }
- for i, b := range rawOneofs {
- od := &md.L2.Oneofs.List[i]
- od.unmarshalFull(b, sb, md.L0.ParentFile, md, i)
- }
- }
- md.L2.Options = md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Message, rawOptions)
-}
-
-func (md *Message) unmarshalOptions(b []byte) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.MessageOptions_MapEntry_field_number:
- md.L1.IsMapEntry = protowire.DecodeBool(v)
- case genid.MessageOptions_MessageSetWireFormat_field_number:
- md.L1.IsMessageSet = protowire.DecodeBool(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func unmarshalMessageReservedRange(b []byte) (r [2]protoreflect.FieldNumber) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_ReservedRange_Start_field_number:
- r[0] = protoreflect.FieldNumber(v)
- case genid.DescriptorProto_ReservedRange_End_field_number:
- r[1] = protoreflect.FieldNumber(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- return r
-}
-
-func unmarshalMessageExtensionRange(b []byte) (r [2]protoreflect.FieldNumber, rawOptions []byte) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_ExtensionRange_Start_field_number:
- r[0] = protoreflect.FieldNumber(v)
- case genid.DescriptorProto_ExtensionRange_End_field_number:
- r[1] = protoreflect.FieldNumber(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.DescriptorProto_ExtensionRange_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- return r, rawOptions
-}
-
-func (fd *Field) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- fd.L0.ParentFile = pf
- fd.L0.Parent = pd
- fd.L0.Index = i
-
- var rawTypeName []byte
- var rawOptions []byte
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_Number_field_number:
- fd.L1.Number = protoreflect.FieldNumber(v)
- case genid.FieldDescriptorProto_Label_field_number:
- fd.L1.Cardinality = protoreflect.Cardinality(v)
- case genid.FieldDescriptorProto_Type_field_number:
- fd.L1.Kind = protoreflect.Kind(v)
- case genid.FieldDescriptorProto_OneofIndex_field_number:
- // In Message.unmarshalFull, we allocate slices for both
- // the field and oneof descriptors before unmarshaling either
- // of them. This ensures pointers to slice elements are stable.
- od := &pd.(*Message).L2.Oneofs.List[v]
- od.L1.Fields.List = append(od.L1.Fields.List, fd)
- if fd.L1.ContainingOneof != nil {
- panic("oneof type already set")
- }
- fd.L1.ContainingOneof = od
- case genid.FieldDescriptorProto_Proto3Optional_field_number:
- fd.L1.IsProto3Optional = protowire.DecodeBool(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_Name_field_number:
- fd.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.FieldDescriptorProto_JsonName_field_number:
- fd.L1.StringName.InitJSON(sb.MakeString(v))
- case genid.FieldDescriptorProto_DefaultValue_field_number:
- fd.L1.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveMessages
- case genid.FieldDescriptorProto_TypeName_field_number:
- rawTypeName = v
- case genid.FieldDescriptorProto_Options_field_number:
- fd.unmarshalOptions(v)
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- if rawTypeName != nil {
- name := makeFullName(sb, rawTypeName)
- switch fd.L1.Kind {
- case protoreflect.EnumKind:
- fd.L1.Enum = PlaceholderEnum(name)
- case protoreflect.MessageKind, protoreflect.GroupKind:
- fd.L1.Message = PlaceholderMessage(name)
- }
- }
- fd.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Field, rawOptions)
-}
-
-func (fd *Field) unmarshalOptions(b []byte) {
- const FieldOptions_EnforceUTF8 = 13
-
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldOptions_Packed_field_number:
- fd.L1.HasPacked = true
- fd.L1.IsPacked = protowire.DecodeBool(v)
- case genid.FieldOptions_Weak_field_number:
- fd.L1.IsWeak = protowire.DecodeBool(v)
- case FieldOptions_EnforceUTF8:
- fd.L1.HasEnforceUTF8 = true
- fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func (od *Oneof) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- od.L0.ParentFile = pf
- od.L0.Parent = pd
- od.L0.Index = i
-
- var rawOptions []byte
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.OneofDescriptorProto_Name_field_number:
- od.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.OneofDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- od.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Oneof, rawOptions)
-}
-
-func (xd *Extension) unmarshalFull(b []byte, sb *strs.Builder) {
- var rawTypeName []byte
- var rawOptions []byte
- xd.L2 = new(ExtensionL2)
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_Proto3Optional_field_number:
- xd.L2.IsProto3Optional = protowire.DecodeBool(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.FieldDescriptorProto_JsonName_field_number:
- xd.L2.StringName.InitJSON(sb.MakeString(v))
- case genid.FieldDescriptorProto_DefaultValue_field_number:
- xd.L2.Default.val = protoreflect.ValueOfBytes(v) // temporarily store as bytes; later resolved in resolveExtensions
- case genid.FieldDescriptorProto_TypeName_field_number:
- rawTypeName = v
- case genid.FieldDescriptorProto_Options_field_number:
- xd.unmarshalOptions(v)
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- if rawTypeName != nil {
- name := makeFullName(sb, rawTypeName)
- switch xd.L1.Kind {
- case protoreflect.EnumKind:
- xd.L2.Enum = PlaceholderEnum(name)
- case protoreflect.MessageKind, protoreflect.GroupKind:
- xd.L2.Message = PlaceholderMessage(name)
- }
- }
- xd.L2.Options = xd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Field, rawOptions)
-}
-
-func (xd *Extension) unmarshalOptions(b []byte) {
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.FieldOptions_Packed_field_number:
- xd.L2.IsPacked = protowire.DecodeBool(v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
-}
-
-func (sd *Service) unmarshalFull(b []byte, sb *strs.Builder) {
- var rawMethods [][]byte
- var rawOptions []byte
- sd.L2 = new(ServiceL2)
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.ServiceDescriptorProto_Method_field_number:
- rawMethods = append(rawMethods, v)
- case genid.ServiceDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- if len(rawMethods) > 0 {
- sd.L2.Methods.List = make([]Method, len(rawMethods))
- for i, b := range rawMethods {
- sd.L2.Methods.List[i].unmarshalFull(b, sb, sd.L0.ParentFile, sd, i)
- }
- }
- sd.L2.Options = sd.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Service, rawOptions)
-}
-
-func (md *Method) unmarshalFull(b []byte, sb *strs.Builder, pf *File, pd protoreflect.Descriptor, i int) {
- md.L0.ParentFile = pf
- md.L0.Parent = pd
- md.L0.Index = i
-
- var rawOptions []byte
- for len(b) > 0 {
- num, typ, n := protowire.ConsumeTag(b)
- b = b[n:]
- switch typ {
- case protowire.VarintType:
- v, m := protowire.ConsumeVarint(b)
- b = b[m:]
- switch num {
- case genid.MethodDescriptorProto_ClientStreaming_field_number:
- md.L1.IsStreamingClient = protowire.DecodeBool(v)
- case genid.MethodDescriptorProto_ServerStreaming_field_number:
- md.L1.IsStreamingServer = protowire.DecodeBool(v)
- }
- case protowire.BytesType:
- v, m := protowire.ConsumeBytes(b)
- b = b[m:]
- switch num {
- case genid.MethodDescriptorProto_Name_field_number:
- md.L0.FullName = appendFullName(sb, pd.FullName(), v)
- case genid.MethodDescriptorProto_InputType_field_number:
- md.L1.Input = PlaceholderMessage(makeFullName(sb, v))
- case genid.MethodDescriptorProto_OutputType_field_number:
- md.L1.Output = PlaceholderMessage(makeFullName(sb, v))
- case genid.MethodDescriptorProto_Options_field_number:
- rawOptions = appendOptions(rawOptions, v)
- }
- default:
- m := protowire.ConsumeFieldValue(num, typ, b)
- b = b[m:]
- }
- }
- md.L1.Options = pf.builder.optionsUnmarshaler(&descopts.Method, rawOptions)
-}
-
-// appendOptions appends src to dst, where the returned slice is never nil.
-// This is necessary to distinguish between empty and unpopulated options.
-func appendOptions(dst, src []byte) []byte {
- if dst == nil {
- dst = []byte{}
- }
- return append(dst, src...)
-}
-
-// optionsUnmarshaler constructs a lazy unmarshal function for an options message.
-//
-// The type of message to unmarshal to is passed as a pointer since the
-// vars in descopts may not yet be populated at the time this function is called.
-func (db *Builder) optionsUnmarshaler(p *protoreflect.ProtoMessage, b []byte) func() protoreflect.ProtoMessage {
- if b == nil {
- return nil
- }
- var opts protoreflect.ProtoMessage
- var once sync.Once
- return func() protoreflect.ProtoMessage {
- once.Do(func() {
- if *p == nil {
- panic("Descriptor.Options called without importing the descriptor package")
- }
- opts = reflect.New(reflect.TypeOf(*p).Elem()).Interface().(protoreflect.ProtoMessage)
- if err := (proto.UnmarshalOptions{
- AllowPartial: true,
- Resolver: db.TypeResolver,
- }).Unmarshal(b, opts); err != nil {
- panic(err)
- }
- })
- return opts
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
deleted file mode 100644
index e3b6587..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go
+++ /dev/null
@@ -1,457 +0,0 @@
-// 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.
-
-package filedesc
-
-import (
- "fmt"
- "math"
- "sort"
- "sync"
-
- "google.golang.org/protobuf/internal/genid"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/descfmt"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type FileImports []protoreflect.FileImport
-
-func (p *FileImports) Len() int { return len(*p) }
-func (p *FileImports) Get(i int) protoreflect.FileImport { return (*p)[i] }
-func (p *FileImports) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *FileImports) ProtoInternal(pragma.DoNotImplement) {}
-
-type Names struct {
- List []protoreflect.Name
- once sync.Once
- has map[protoreflect.Name]int // protected by once
-}
-
-func (p *Names) Len() int { return len(p.List) }
-func (p *Names) Get(i int) protoreflect.Name { return p.List[i] }
-func (p *Names) Has(s protoreflect.Name) bool { return p.lazyInit().has[s] > 0 }
-func (p *Names) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *Names) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Names) lazyInit() *Names {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.has = make(map[protoreflect.Name]int, len(p.List))
- for _, s := range p.List {
- p.has[s] = p.has[s] + 1
- }
- }
- })
- return p
-}
-
-// CheckValid reports any errors with the set of names with an error message
-// that completes the sentence: "ranges is invalid because it has ..."
-func (p *Names) CheckValid() error {
- for s, n := range p.lazyInit().has {
- switch {
- case n > 1:
- return errors.New("duplicate name: %q", s)
- case false && !s.IsValid():
- // NOTE: The C++ implementation does not validate the identifier.
- // See https://github.com/protocolbuffers/protobuf/issues/6335.
- return errors.New("invalid name: %q", s)
- }
- }
- return nil
-}
-
-type EnumRanges struct {
- List [][2]protoreflect.EnumNumber // start inclusive; end inclusive
- once sync.Once
- sorted [][2]protoreflect.EnumNumber // protected by once
-}
-
-func (p *EnumRanges) Len() int { return len(p.List) }
-func (p *EnumRanges) Get(i int) [2]protoreflect.EnumNumber { return p.List[i] }
-func (p *EnumRanges) Has(n protoreflect.EnumNumber) bool {
- for ls := p.lazyInit().sorted; len(ls) > 0; {
- i := len(ls) / 2
- switch r := enumRange(ls[i]); {
- case n < r.Start():
- ls = ls[:i] // search lower
- case n > r.End():
- ls = ls[i+1:] // search upper
- default:
- return true
- }
- }
- return false
-}
-func (p *EnumRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *EnumRanges) ProtoInternal(pragma.DoNotImplement) {}
-func (p *EnumRanges) lazyInit() *EnumRanges {
- p.once.Do(func() {
- p.sorted = append(p.sorted, p.List...)
- sort.Slice(p.sorted, func(i, j int) bool {
- return p.sorted[i][0] < p.sorted[j][0]
- })
- })
- return p
-}
-
-// CheckValid reports any errors with the set of names with an error message
-// that completes the sentence: "ranges is invalid because it has ..."
-func (p *EnumRanges) CheckValid() error {
- var rp enumRange
- for i, r := range p.lazyInit().sorted {
- r := enumRange(r)
- switch {
- case !(r.Start() <= r.End()):
- return errors.New("invalid range: %v", r)
- case !(rp.End() < r.Start()) && i > 0:
- return errors.New("overlapping ranges: %v with %v", rp, r)
- }
- rp = r
- }
- return nil
-}
-
-type enumRange [2]protoreflect.EnumNumber
-
-func (r enumRange) Start() protoreflect.EnumNumber { return r[0] } // inclusive
-func (r enumRange) End() protoreflect.EnumNumber { return r[1] } // inclusive
-func (r enumRange) String() string {
- if r.Start() == r.End() {
- return fmt.Sprintf("%d", r.Start())
- }
- return fmt.Sprintf("%d to %d", r.Start(), r.End())
-}
-
-type FieldRanges struct {
- List [][2]protoreflect.FieldNumber // start inclusive; end exclusive
- once sync.Once
- sorted [][2]protoreflect.FieldNumber // protected by once
-}
-
-func (p *FieldRanges) Len() int { return len(p.List) }
-func (p *FieldRanges) Get(i int) [2]protoreflect.FieldNumber { return p.List[i] }
-func (p *FieldRanges) Has(n protoreflect.FieldNumber) bool {
- for ls := p.lazyInit().sorted; len(ls) > 0; {
- i := len(ls) / 2
- switch r := fieldRange(ls[i]); {
- case n < r.Start():
- ls = ls[:i] // search lower
- case n > r.End():
- ls = ls[i+1:] // search upper
- default:
- return true
- }
- }
- return false
-}
-func (p *FieldRanges) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *FieldRanges) ProtoInternal(pragma.DoNotImplement) {}
-func (p *FieldRanges) lazyInit() *FieldRanges {
- p.once.Do(func() {
- p.sorted = append(p.sorted, p.List...)
- sort.Slice(p.sorted, func(i, j int) bool {
- return p.sorted[i][0] < p.sorted[j][0]
- })
- })
- return p
-}
-
-// CheckValid reports any errors with the set of ranges with an error message
-// that completes the sentence: "ranges is invalid because it has ..."
-func (p *FieldRanges) CheckValid(isMessageSet bool) error {
- var rp fieldRange
- for i, r := range p.lazyInit().sorted {
- r := fieldRange(r)
- switch {
- case !isValidFieldNumber(r.Start(), isMessageSet):
- return errors.New("invalid field number: %d", r.Start())
- case !isValidFieldNumber(r.End(), isMessageSet):
- return errors.New("invalid field number: %d", r.End())
- case !(r.Start() <= r.End()):
- return errors.New("invalid range: %v", r)
- case !(rp.End() < r.Start()) && i > 0:
- return errors.New("overlapping ranges: %v with %v", rp, r)
- }
- rp = r
- }
- return nil
-}
-
-// isValidFieldNumber reports whether the field number is valid.
-// Unlike the FieldNumber.IsValid method, it allows ranges that cover the
-// reserved number range.
-func isValidFieldNumber(n protoreflect.FieldNumber, isMessageSet bool) bool {
- return protowire.MinValidNumber <= n && (n <= protowire.MaxValidNumber || isMessageSet)
-}
-
-// CheckOverlap reports an error if p and q overlap.
-func (p *FieldRanges) CheckOverlap(q *FieldRanges) error {
- rps := p.lazyInit().sorted
- rqs := q.lazyInit().sorted
- for pi, qi := 0, 0; pi < len(rps) && qi < len(rqs); {
- rp := fieldRange(rps[pi])
- rq := fieldRange(rqs[qi])
- if !(rp.End() < rq.Start() || rq.End() < rp.Start()) {
- return errors.New("overlapping ranges: %v with %v", rp, rq)
- }
- if rp.Start() < rq.Start() {
- pi++
- } else {
- qi++
- }
- }
- return nil
-}
-
-type fieldRange [2]protoreflect.FieldNumber
-
-func (r fieldRange) Start() protoreflect.FieldNumber { return r[0] } // inclusive
-func (r fieldRange) End() protoreflect.FieldNumber { return r[1] - 1 } // inclusive
-func (r fieldRange) String() string {
- if r.Start() == r.End() {
- return fmt.Sprintf("%d", r.Start())
- }
- return fmt.Sprintf("%d to %d", r.Start(), r.End())
-}
-
-type FieldNumbers struct {
- List []protoreflect.FieldNumber
- once sync.Once
- has map[protoreflect.FieldNumber]struct{} // protected by once
-}
-
-func (p *FieldNumbers) Len() int { return len(p.List) }
-func (p *FieldNumbers) Get(i int) protoreflect.FieldNumber { return p.List[i] }
-func (p *FieldNumbers) Has(n protoreflect.FieldNumber) bool {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.has = make(map[protoreflect.FieldNumber]struct{}, len(p.List))
- for _, n := range p.List {
- p.has[n] = struct{}{}
- }
- }
- })
- _, ok := p.has[n]
- return ok
-}
-func (p *FieldNumbers) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *FieldNumbers) ProtoInternal(pragma.DoNotImplement) {}
-
-type OneofFields struct {
- List []protoreflect.FieldDescriptor
- once sync.Once
- byName map[protoreflect.Name]protoreflect.FieldDescriptor // protected by once
- byJSON map[string]protoreflect.FieldDescriptor // protected by once
- byText map[string]protoreflect.FieldDescriptor // protected by once
- byNum map[protoreflect.FieldNumber]protoreflect.FieldDescriptor // protected by once
-}
-
-func (p *OneofFields) Len() int { return len(p.List) }
-func (p *OneofFields) Get(i int) protoreflect.FieldDescriptor { return p.List[i] }
-func (p *OneofFields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
- return p.lazyInit().byName[s]
-}
-func (p *OneofFields) ByJSONName(s string) protoreflect.FieldDescriptor {
- return p.lazyInit().byJSON[s]
-}
-func (p *OneofFields) ByTextName(s string) protoreflect.FieldDescriptor {
- return p.lazyInit().byText[s]
-}
-func (p *OneofFields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
- return p.lazyInit().byNum[n]
-}
-func (p *OneofFields) Format(s fmt.State, r rune) { descfmt.FormatList(s, r, p) }
-func (p *OneofFields) ProtoInternal(pragma.DoNotImplement) {}
-
-func (p *OneofFields) lazyInit() *OneofFields {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]protoreflect.FieldDescriptor, len(p.List))
- p.byJSON = make(map[string]protoreflect.FieldDescriptor, len(p.List))
- p.byText = make(map[string]protoreflect.FieldDescriptor, len(p.List))
- p.byNum = make(map[protoreflect.FieldNumber]protoreflect.FieldDescriptor, len(p.List))
- for _, f := range p.List {
- // Field names and numbers are guaranteed to be unique.
- p.byName[f.Name()] = f
- p.byJSON[f.JSONName()] = f
- p.byText[f.TextName()] = f
- p.byNum[f.Number()] = f
- }
- }
- })
- return p
-}
-
-type SourceLocations struct {
- // List is a list of SourceLocations.
- // The SourceLocation.Next field does not need to be populated
- // as it will be lazily populated upon first need.
- List []protoreflect.SourceLocation
-
- // File is the parent file descriptor that these locations are relative to.
- // If non-nil, ByDescriptor verifies that the provided descriptor
- // is a child of this file descriptor.
- File protoreflect.FileDescriptor
-
- once sync.Once
- byPath map[pathKey]int
-}
-
-func (p *SourceLocations) Len() int { return len(p.List) }
-func (p *SourceLocations) Get(i int) protoreflect.SourceLocation { return p.lazyInit().List[i] }
-func (p *SourceLocations) byKey(k pathKey) protoreflect.SourceLocation {
- if i, ok := p.lazyInit().byPath[k]; ok {
- return p.List[i]
- }
- return protoreflect.SourceLocation{}
-}
-func (p *SourceLocations) ByPath(path protoreflect.SourcePath) protoreflect.SourceLocation {
- return p.byKey(newPathKey(path))
-}
-func (p *SourceLocations) ByDescriptor(desc protoreflect.Descriptor) protoreflect.SourceLocation {
- if p.File != nil && desc != nil && p.File != desc.ParentFile() {
- return protoreflect.SourceLocation{} // mismatching parent files
- }
- var pathArr [16]int32
- path := pathArr[:0]
- for {
- switch desc.(type) {
- case protoreflect.FileDescriptor:
- // Reverse the path since it was constructed in reverse.
- for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
- path[i], path[j] = path[j], path[i]
- }
- return p.byKey(newPathKey(path))
- case protoreflect.MessageDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.FileDescriptor:
- path = append(path, int32(genid.FileDescriptorProto_MessageType_field_number))
- case protoreflect.MessageDescriptor:
- path = append(path, int32(genid.DescriptorProto_NestedType_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- case protoreflect.FieldDescriptor:
- isExtension := desc.(protoreflect.FieldDescriptor).IsExtension()
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- if isExtension {
- switch desc.(type) {
- case protoreflect.FileDescriptor:
- path = append(path, int32(genid.FileDescriptorProto_Extension_field_number))
- case protoreflect.MessageDescriptor:
- path = append(path, int32(genid.DescriptorProto_Extension_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- } else {
- switch desc.(type) {
- case protoreflect.MessageDescriptor:
- path = append(path, int32(genid.DescriptorProto_Field_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- }
- case protoreflect.OneofDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.MessageDescriptor:
- path = append(path, int32(genid.DescriptorProto_OneofDecl_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- case protoreflect.EnumDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.FileDescriptor:
- path = append(path, int32(genid.FileDescriptorProto_EnumType_field_number))
- case protoreflect.MessageDescriptor:
- path = append(path, int32(genid.DescriptorProto_EnumType_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- case protoreflect.EnumValueDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.EnumDescriptor:
- path = append(path, int32(genid.EnumDescriptorProto_Value_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- case protoreflect.ServiceDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.FileDescriptor:
- path = append(path, int32(genid.FileDescriptorProto_Service_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- case protoreflect.MethodDescriptor:
- path = append(path, int32(desc.Index()))
- desc = desc.Parent()
- switch desc.(type) {
- case protoreflect.ServiceDescriptor:
- path = append(path, int32(genid.ServiceDescriptorProto_Method_field_number))
- default:
- return protoreflect.SourceLocation{}
- }
- default:
- return protoreflect.SourceLocation{}
- }
- }
-}
-func (p *SourceLocations) lazyInit() *SourceLocations {
- p.once.Do(func() {
- if len(p.List) > 0 {
- // Collect all the indexes for a given path.
- pathIdxs := make(map[pathKey][]int, len(p.List))
- for i, l := range p.List {
- k := newPathKey(l.Path)
- pathIdxs[k] = append(pathIdxs[k], i)
- }
-
- // Update the next index for all locations.
- p.byPath = make(map[pathKey]int, len(p.List))
- for k, idxs := range pathIdxs {
- for i := 0; i < len(idxs)-1; i++ {
- p.List[idxs[i]].Next = idxs[i+1]
- }
- p.List[idxs[len(idxs)-1]].Next = 0
- p.byPath[k] = idxs[0] // record the first location for this path
- }
- }
- })
- return p
-}
-func (p *SourceLocations) ProtoInternal(pragma.DoNotImplement) {}
-
-// pathKey is a comparable representation of protoreflect.SourcePath.
-type pathKey struct {
- arr [16]uint8 // first n-1 path segments; last element is the length
- str string // used if the path does not fit in arr
-}
-
-func newPathKey(p protoreflect.SourcePath) (k pathKey) {
- if len(p) < len(k.arr) {
- for i, ps := range p {
- if ps < 0 || math.MaxUint8 <= ps {
- return pathKey{str: p.String()}
- }
- k.arr[i] = uint8(ps)
- }
- k.arr[len(k.arr)-1] = uint8(len(p))
- return k
- }
- return pathKey{str: p.String()}
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
deleted file mode 100644
index 30db19f..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package filedesc
-
-import (
- "fmt"
- "sync"
-
- "google.golang.org/protobuf/internal/descfmt"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type Enums struct {
- List []Enum
- once sync.Once
- byName map[protoreflect.Name]*Enum // protected by once
-}
-
-func (p *Enums) Len() int {
- return len(p.List)
-}
-func (p *Enums) Get(i int) protoreflect.EnumDescriptor {
- return &p.List[i]
-}
-func (p *Enums) ByName(s protoreflect.Name) protoreflect.EnumDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Enums) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Enums) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Enums) lazyInit() *Enums {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Enum, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
-
-type EnumValues struct {
- List []EnumValue
- once sync.Once
- byName map[protoreflect.Name]*EnumValue // protected by once
- byNum map[protoreflect.EnumNumber]*EnumValue // protected by once
-}
-
-func (p *EnumValues) Len() int {
- return len(p.List)
-}
-func (p *EnumValues) Get(i int) protoreflect.EnumValueDescriptor {
- return &p.List[i]
-}
-func (p *EnumValues) ByName(s protoreflect.Name) protoreflect.EnumValueDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *EnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
- if d := p.lazyInit().byNum[n]; d != nil {
- return d
- }
- return nil
-}
-func (p *EnumValues) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *EnumValues) ProtoInternal(pragma.DoNotImplement) {}
-func (p *EnumValues) lazyInit() *EnumValues {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*EnumValue, len(p.List))
- p.byNum = make(map[protoreflect.EnumNumber]*EnumValue, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- if _, ok := p.byNum[d.Number()]; !ok {
- p.byNum[d.Number()] = d
- }
- }
- }
- })
- return p
-}
-
-type Messages struct {
- List []Message
- once sync.Once
- byName map[protoreflect.Name]*Message // protected by once
-}
-
-func (p *Messages) Len() int {
- return len(p.List)
-}
-func (p *Messages) Get(i int) protoreflect.MessageDescriptor {
- return &p.List[i]
-}
-func (p *Messages) ByName(s protoreflect.Name) protoreflect.MessageDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Messages) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Messages) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Messages) lazyInit() *Messages {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Message, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
-
-type Fields struct {
- List []Field
- once sync.Once
- byName map[protoreflect.Name]*Field // protected by once
- byJSON map[string]*Field // protected by once
- byText map[string]*Field // protected by once
- byNum map[protoreflect.FieldNumber]*Field // protected by once
-}
-
-func (p *Fields) Len() int {
- return len(p.List)
-}
-func (p *Fields) Get(i int) protoreflect.FieldDescriptor {
- return &p.List[i]
-}
-func (p *Fields) ByName(s protoreflect.Name) protoreflect.FieldDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Fields) ByJSONName(s string) protoreflect.FieldDescriptor {
- if d := p.lazyInit().byJSON[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Fields) ByTextName(s string) protoreflect.FieldDescriptor {
- if d := p.lazyInit().byText[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Fields) ByNumber(n protoreflect.FieldNumber) protoreflect.FieldDescriptor {
- if d := p.lazyInit().byNum[n]; d != nil {
- return d
- }
- return nil
-}
-func (p *Fields) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Fields) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Fields) lazyInit() *Fields {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Field, len(p.List))
- p.byJSON = make(map[string]*Field, len(p.List))
- p.byText = make(map[string]*Field, len(p.List))
- p.byNum = make(map[protoreflect.FieldNumber]*Field, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- if _, ok := p.byJSON[d.JSONName()]; !ok {
- p.byJSON[d.JSONName()] = d
- }
- if _, ok := p.byText[d.TextName()]; !ok {
- p.byText[d.TextName()] = d
- }
- if _, ok := p.byNum[d.Number()]; !ok {
- p.byNum[d.Number()] = d
- }
- }
- }
- })
- return p
-}
-
-type Oneofs struct {
- List []Oneof
- once sync.Once
- byName map[protoreflect.Name]*Oneof // protected by once
-}
-
-func (p *Oneofs) Len() int {
- return len(p.List)
-}
-func (p *Oneofs) Get(i int) protoreflect.OneofDescriptor {
- return &p.List[i]
-}
-func (p *Oneofs) ByName(s protoreflect.Name) protoreflect.OneofDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Oneofs) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Oneofs) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Oneofs) lazyInit() *Oneofs {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Oneof, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
-
-type Extensions struct {
- List []Extension
- once sync.Once
- byName map[protoreflect.Name]*Extension // protected by once
-}
-
-func (p *Extensions) Len() int {
- return len(p.List)
-}
-func (p *Extensions) Get(i int) protoreflect.ExtensionDescriptor {
- return &p.List[i]
-}
-func (p *Extensions) ByName(s protoreflect.Name) protoreflect.ExtensionDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Extensions) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Extensions) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Extensions) lazyInit() *Extensions {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Extension, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
-
-type Services struct {
- List []Service
- once sync.Once
- byName map[protoreflect.Name]*Service // protected by once
-}
-
-func (p *Services) Len() int {
- return len(p.List)
-}
-func (p *Services) Get(i int) protoreflect.ServiceDescriptor {
- return &p.List[i]
-}
-func (p *Services) ByName(s protoreflect.Name) protoreflect.ServiceDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Services) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Services) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Services) lazyInit() *Services {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Service, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
-
-type Methods struct {
- List []Method
- once sync.Once
- byName map[protoreflect.Name]*Method // protected by once
-}
-
-func (p *Methods) Len() int {
- return len(p.List)
-}
-func (p *Methods) Get(i int) protoreflect.MethodDescriptor {
- return &p.List[i]
-}
-func (p *Methods) ByName(s protoreflect.Name) protoreflect.MethodDescriptor {
- if d := p.lazyInit().byName[s]; d != nil {
- return d
- }
- return nil
-}
-func (p *Methods) Format(s fmt.State, r rune) {
- descfmt.FormatList(s, r, p)
-}
-func (p *Methods) ProtoInternal(pragma.DoNotImplement) {}
-func (p *Methods) lazyInit() *Methods {
- p.once.Do(func() {
- if len(p.List) > 0 {
- p.byName = make(map[protoreflect.Name]*Method, len(p.List))
- for i := range p.List {
- d := &p.List[i]
- if _, ok := p.byName[d.Name()]; !ok {
- p.byName[d.Name()] = d
- }
- }
- }
- })
- return p
-}
diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go b/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
deleted file mode 100644
index 28240eb..0000000
--- a/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// 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.
-
-package filedesc
-
-import (
- "google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-var (
- emptyNames = new(Names)
- emptyEnumRanges = new(EnumRanges)
- emptyFieldRanges = new(FieldRanges)
- emptyFieldNumbers = new(FieldNumbers)
- emptySourceLocations = new(SourceLocations)
-
- emptyFiles = new(FileImports)
- emptyMessages = new(Messages)
- emptyFields = new(Fields)
- emptyOneofs = new(Oneofs)
- emptyEnums = new(Enums)
- emptyEnumValues = new(EnumValues)
- emptyExtensions = new(Extensions)
- emptyServices = new(Services)
-)
-
-// PlaceholderFile is a placeholder, representing only the file path.
-type PlaceholderFile string
-
-func (f PlaceholderFile) ParentFile() protoreflect.FileDescriptor { return f }
-func (f PlaceholderFile) Parent() protoreflect.Descriptor { return nil }
-func (f PlaceholderFile) Index() int { return 0 }
-func (f PlaceholderFile) Syntax() protoreflect.Syntax { return 0 }
-func (f PlaceholderFile) Name() protoreflect.Name { return "" }
-func (f PlaceholderFile) FullName() protoreflect.FullName { return "" }
-func (f PlaceholderFile) IsPlaceholder() bool { return true }
-func (f PlaceholderFile) Options() protoreflect.ProtoMessage { return descopts.File }
-func (f PlaceholderFile) Path() string { return string(f) }
-func (f PlaceholderFile) Package() protoreflect.FullName { return "" }
-func (f PlaceholderFile) Imports() protoreflect.FileImports { return emptyFiles }
-func (f PlaceholderFile) Messages() protoreflect.MessageDescriptors { return emptyMessages }
-func (f PlaceholderFile) Enums() protoreflect.EnumDescriptors { return emptyEnums }
-func (f PlaceholderFile) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
-func (f PlaceholderFile) Services() protoreflect.ServiceDescriptors { return emptyServices }
-func (f PlaceholderFile) SourceLocations() protoreflect.SourceLocations { return emptySourceLocations }
-func (f PlaceholderFile) ProtoType(protoreflect.FileDescriptor) { return }
-func (f PlaceholderFile) ProtoInternal(pragma.DoNotImplement) { return }
-
-// PlaceholderEnum is a placeholder, representing only the full name.
-type PlaceholderEnum protoreflect.FullName
-
-func (e PlaceholderEnum) ParentFile() protoreflect.FileDescriptor { return nil }
-func (e PlaceholderEnum) Parent() protoreflect.Descriptor { return nil }
-func (e PlaceholderEnum) Index() int { return 0 }
-func (e PlaceholderEnum) Syntax() protoreflect.Syntax { return 0 }
-func (e PlaceholderEnum) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
-func (e PlaceholderEnum) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
-func (e PlaceholderEnum) IsPlaceholder() bool { return true }
-func (e PlaceholderEnum) Options() protoreflect.ProtoMessage { return descopts.Enum }
-func (e PlaceholderEnum) Values() protoreflect.EnumValueDescriptors { return emptyEnumValues }
-func (e PlaceholderEnum) ReservedNames() protoreflect.Names { return emptyNames }
-func (e PlaceholderEnum) ReservedRanges() protoreflect.EnumRanges { return emptyEnumRanges }
-func (e PlaceholderEnum) ProtoType(protoreflect.EnumDescriptor) { return }
-func (e PlaceholderEnum) ProtoInternal(pragma.DoNotImplement) { return }
-
-// PlaceholderEnumValue is a placeholder, representing only the full name.
-type PlaceholderEnumValue protoreflect.FullName
-
-func (e PlaceholderEnumValue) ParentFile() protoreflect.FileDescriptor { return nil }
-func (e PlaceholderEnumValue) Parent() protoreflect.Descriptor { return nil }
-func (e PlaceholderEnumValue) Index() int { return 0 }
-func (e PlaceholderEnumValue) Syntax() protoreflect.Syntax { return 0 }
-func (e PlaceholderEnumValue) Name() protoreflect.Name { return protoreflect.FullName(e).Name() }
-func (e PlaceholderEnumValue) FullName() protoreflect.FullName { return protoreflect.FullName(e) }
-func (e PlaceholderEnumValue) IsPlaceholder() bool { return true }
-func (e PlaceholderEnumValue) Options() protoreflect.ProtoMessage { return descopts.EnumValue }
-func (e PlaceholderEnumValue) Number() protoreflect.EnumNumber { return 0 }
-func (e PlaceholderEnumValue) ProtoType(protoreflect.EnumValueDescriptor) { return }
-func (e PlaceholderEnumValue) ProtoInternal(pragma.DoNotImplement) { return }
-
-// PlaceholderMessage is a placeholder, representing only the full name.
-type PlaceholderMessage protoreflect.FullName
-
-func (m PlaceholderMessage) ParentFile() protoreflect.FileDescriptor { return nil }
-func (m PlaceholderMessage) Parent() protoreflect.Descriptor { return nil }
-func (m PlaceholderMessage) Index() int { return 0 }
-func (m PlaceholderMessage) Syntax() protoreflect.Syntax { return 0 }
-func (m PlaceholderMessage) Name() protoreflect.Name { return protoreflect.FullName(m).Name() }
-func (m PlaceholderMessage) FullName() protoreflect.FullName { return protoreflect.FullName(m) }
-func (m PlaceholderMessage) IsPlaceholder() bool { return true }
-func (m PlaceholderMessage) Options() protoreflect.ProtoMessage { return descopts.Message }
-func (m PlaceholderMessage) IsMapEntry() bool { return false }
-func (m PlaceholderMessage) Fields() protoreflect.FieldDescriptors { return emptyFields }
-func (m PlaceholderMessage) Oneofs() protoreflect.OneofDescriptors { return emptyOneofs }
-func (m PlaceholderMessage) ReservedNames() protoreflect.Names { return emptyNames }
-func (m PlaceholderMessage) ReservedRanges() protoreflect.FieldRanges { return emptyFieldRanges }
-func (m PlaceholderMessage) RequiredNumbers() protoreflect.FieldNumbers { return emptyFieldNumbers }
-func (m PlaceholderMessage) ExtensionRanges() protoreflect.FieldRanges { return emptyFieldRanges }
-func (m PlaceholderMessage) ExtensionRangeOptions(int) protoreflect.ProtoMessage {
- panic("index out of range")
-}
-func (m PlaceholderMessage) Messages() protoreflect.MessageDescriptors { return emptyMessages }
-func (m PlaceholderMessage) Enums() protoreflect.EnumDescriptors { return emptyEnums }
-func (m PlaceholderMessage) Extensions() protoreflect.ExtensionDescriptors { return emptyExtensions }
-func (m PlaceholderMessage) ProtoType(protoreflect.MessageDescriptor) { return }
-func (m PlaceholderMessage) ProtoInternal(pragma.DoNotImplement) { return }
diff --git a/vendor/google.golang.org/protobuf/internal/filetype/build.go b/vendor/google.golang.org/protobuf/internal/filetype/build.go
deleted file mode 100644
index f0e38c4..0000000
--- a/vendor/google.golang.org/protobuf/internal/filetype/build.go
+++ /dev/null
@@ -1,296 +0,0 @@
-// 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.
-
-// Package filetype provides functionality for wrapping descriptors
-// with Go type information.
-package filetype
-
-import (
- "reflect"
-
- "google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/filedesc"
- pimpl "google.golang.org/protobuf/internal/impl"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// Builder constructs type descriptors from a raw file descriptor
-// and associated Go types for each enum and message declaration.
-//
-// # Flattened Ordering
-//
-// The protobuf type system represents declarations as a tree. Certain nodes in
-// the tree require us to either associate it with a concrete Go type or to
-// resolve a dependency, which is information that must be provided separately
-// since it cannot be derived from the file descriptor alone.
-//
-// However, representing a tree as Go literals is difficult to simply do in a
-// space and time efficient way. Thus, we store them as a flattened list of
-// objects where the serialization order from the tree-based form is important.
-//
-// The "flattened ordering" is defined as a tree traversal of all enum, message,
-// extension, and service declarations using the following algorithm:
-//
-// def VisitFileDecls(fd):
-// for e in fd.Enums: yield e
-// for m in fd.Messages: yield m
-// for x in fd.Extensions: yield x
-// for s in fd.Services: yield s
-// for m in fd.Messages: yield from VisitMessageDecls(m)
-//
-// def VisitMessageDecls(md):
-// for e in md.Enums: yield e
-// for m in md.Messages: yield m
-// for x in md.Extensions: yield x
-// for m in md.Messages: yield from VisitMessageDecls(m)
-//
-// The traversal starts at the root file descriptor and yields each direct
-// declaration within each node before traversing into sub-declarations
-// that children themselves may have.
-type Builder struct {
- // File is the underlying file descriptor builder.
- File filedesc.Builder
-
- // GoTypes is a unique set of the Go types for all declarations and
- // dependencies. Each type is represented as a zero value of the Go type.
- //
- // Declarations are Go types generated for enums and messages directly
- // declared (not publicly imported) in the proto source file.
- // Messages for map entries are accounted for, but represented by nil.
- // Enum declarations in "flattened ordering" come first, followed by
- // message declarations in "flattened ordering".
- //
- // Dependencies are Go types for enums or messages referenced by
- // message fields (excluding weak fields), for parent extended messages of
- // extension fields, for enums or messages referenced by extension fields,
- // and for input and output messages referenced by service methods.
- // Dependencies must come after declarations, but the ordering of
- // dependencies themselves is unspecified.
- GoTypes []interface{}
-
- // DependencyIndexes is an ordered list of indexes into GoTypes for the
- // dependencies of messages, extensions, or services.
- //
- // There are 5 sub-lists in "flattened ordering" concatenated back-to-back:
- // 0. Message field dependencies: list of the enum or message type
- // referred to by every message field.
- // 1. Extension field targets: list of the extended parent message of
- // every extension.
- // 2. Extension field dependencies: list of the enum or message type
- // referred to by every extension field.
- // 3. Service method inputs: list of the input message type
- // referred to by every service method.
- // 4. Service method outputs: list of the output message type
- // referred to by every service method.
- //
- // The offset into DependencyIndexes for the start of each sub-list
- // is appended to the end in reverse order.
- DependencyIndexes []int32
-
- // EnumInfos is a list of enum infos in "flattened ordering".
- EnumInfos []pimpl.EnumInfo
-
- // MessageInfos is a list of message infos in "flattened ordering".
- // If provided, the GoType and PBType for each element is populated.
- //
- // Requirement: len(MessageInfos) == len(Build.Messages)
- MessageInfos []pimpl.MessageInfo
-
- // ExtensionInfos is a list of extension infos in "flattened ordering".
- // Each element is initialized and registered with the protoregistry package.
- //
- // Requirement: len(LegacyExtensions) == len(Build.Extensions)
- ExtensionInfos []pimpl.ExtensionInfo
-
- // TypeRegistry is the registry to register each type descriptor.
- // If nil, it uses protoregistry.GlobalTypes.
- TypeRegistry interface {
- RegisterMessage(protoreflect.MessageType) error
- RegisterEnum(protoreflect.EnumType) error
- RegisterExtension(protoreflect.ExtensionType) error
- }
-}
-
-// Out is the output of the builder.
-type Out struct {
- File protoreflect.FileDescriptor
-}
-
-func (tb Builder) Build() (out Out) {
- // Replace the resolver with one that resolves dependencies by index,
- // which is faster and more reliable than relying on the global registry.
- if tb.File.FileRegistry == nil {
- tb.File.FileRegistry = protoregistry.GlobalFiles
- }
- tb.File.FileRegistry = &resolverByIndex{
- goTypes: tb.GoTypes,
- depIdxs: tb.DependencyIndexes,
- fileRegistry: tb.File.FileRegistry,
- }
-
- // Initialize registry if unpopulated.
- if tb.TypeRegistry == nil {
- tb.TypeRegistry = protoregistry.GlobalTypes
- }
-
- fbOut := tb.File.Build()
- out.File = fbOut.File
-
- // Process enums.
- enumGoTypes := tb.GoTypes[:len(fbOut.Enums)]
- if len(tb.EnumInfos) != len(fbOut.Enums) {
- panic("mismatching enum lengths")
- }
- if len(fbOut.Enums) > 0 {
- for i := range fbOut.Enums {
- tb.EnumInfos[i] = pimpl.EnumInfo{
- GoReflectType: reflect.TypeOf(enumGoTypes[i]),
- Desc: &fbOut.Enums[i],
- }
- // Register enum types.
- if err := tb.TypeRegistry.RegisterEnum(&tb.EnumInfos[i]); err != nil {
- panic(err)
- }
- }
- }
-
- // Process messages.
- messageGoTypes := tb.GoTypes[len(fbOut.Enums):][:len(fbOut.Messages)]
- if len(tb.MessageInfos) != len(fbOut.Messages) {
- panic("mismatching message lengths")
- }
- if len(fbOut.Messages) > 0 {
- for i := range fbOut.Messages {
- if messageGoTypes[i] == nil {
- continue // skip map entry
- }
-
- tb.MessageInfos[i].GoReflectType = reflect.TypeOf(messageGoTypes[i])
- tb.MessageInfos[i].Desc = &fbOut.Messages[i]
-
- // Register message types.
- if err := tb.TypeRegistry.RegisterMessage(&tb.MessageInfos[i]); err != nil {
- panic(err)
- }
- }
-
- // As a special-case for descriptor.proto,
- // locally register concrete message type for the options.
- if out.File.Path() == "google/protobuf/descriptor.proto" && out.File.Package() == "google.protobuf" {
- for i := range fbOut.Messages {
- switch fbOut.Messages[i].Name() {
- case "FileOptions":
- descopts.File = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "EnumOptions":
- descopts.Enum = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "EnumValueOptions":
- descopts.EnumValue = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "MessageOptions":
- descopts.Message = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "FieldOptions":
- descopts.Field = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "OneofOptions":
- descopts.Oneof = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "ExtensionRangeOptions":
- descopts.ExtensionRange = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "ServiceOptions":
- descopts.Service = messageGoTypes[i].(protoreflect.ProtoMessage)
- case "MethodOptions":
- descopts.Method = messageGoTypes[i].(protoreflect.ProtoMessage)
- }
- }
- }
- }
-
- // Process extensions.
- if len(tb.ExtensionInfos) != len(fbOut.Extensions) {
- panic("mismatching extension lengths")
- }
- var depIdx int32
- for i := range fbOut.Extensions {
- // For enum and message kinds, determine the referent Go type so
- // that we can construct their constructors.
- const listExtDeps = 2
- var goType reflect.Type
- switch fbOut.Extensions[i].L1.Kind {
- case protoreflect.EnumKind:
- j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
- goType = reflect.TypeOf(tb.GoTypes[j])
- depIdx++
- case protoreflect.MessageKind, protoreflect.GroupKind:
- j := depIdxs.Get(tb.DependencyIndexes, listExtDeps, depIdx)
- goType = reflect.TypeOf(tb.GoTypes[j])
- depIdx++
- default:
- goType = goTypeForPBKind[fbOut.Extensions[i].L1.Kind]
- }
- if fbOut.Extensions[i].IsList() {
- goType = reflect.SliceOf(goType)
- }
-
- pimpl.InitExtensionInfo(&tb.ExtensionInfos[i], &fbOut.Extensions[i], goType)
-
- // Register extension types.
- if err := tb.TypeRegistry.RegisterExtension(&tb.ExtensionInfos[i]); err != nil {
- panic(err)
- }
- }
-
- return out
-}
-
-var goTypeForPBKind = map[protoreflect.Kind]reflect.Type{
- protoreflect.BoolKind: reflect.TypeOf(bool(false)),
- protoreflect.Int32Kind: reflect.TypeOf(int32(0)),
- protoreflect.Sint32Kind: reflect.TypeOf(int32(0)),
- protoreflect.Sfixed32Kind: reflect.TypeOf(int32(0)),
- protoreflect.Int64Kind: reflect.TypeOf(int64(0)),
- protoreflect.Sint64Kind: reflect.TypeOf(int64(0)),
- protoreflect.Sfixed64Kind: reflect.TypeOf(int64(0)),
- protoreflect.Uint32Kind: reflect.TypeOf(uint32(0)),
- protoreflect.Fixed32Kind: reflect.TypeOf(uint32(0)),
- protoreflect.Uint64Kind: reflect.TypeOf(uint64(0)),
- protoreflect.Fixed64Kind: reflect.TypeOf(uint64(0)),
- protoreflect.FloatKind: reflect.TypeOf(float32(0)),
- protoreflect.DoubleKind: reflect.TypeOf(float64(0)),
- protoreflect.StringKind: reflect.TypeOf(string("")),
- protoreflect.BytesKind: reflect.TypeOf([]byte(nil)),
-}
-
-type depIdxs []int32
-
-// Get retrieves the jth element of the ith sub-list.
-func (x depIdxs) Get(i, j int32) int32 {
- return x[x[int32(len(x))-i-1]+j]
-}
-
-type (
- resolverByIndex struct {
- goTypes []interface{}
- depIdxs depIdxs
- fileRegistry
- }
- fileRegistry interface {
- FindFileByPath(string) (protoreflect.FileDescriptor, error)
- FindDescriptorByName(protoreflect.FullName) (protoreflect.Descriptor, error)
- RegisterFile(protoreflect.FileDescriptor) error
- }
-)
-
-func (r *resolverByIndex) FindEnumByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.EnumDescriptor {
- if depIdx := int(r.depIdxs.Get(i, j)); int(depIdx) < len(es)+len(ms) {
- return &es[depIdx]
- } else {
- return pimpl.Export{}.EnumDescriptorOf(r.goTypes[depIdx])
- }
-}
-
-func (r *resolverByIndex) FindMessageByIndex(i, j int32, es []filedesc.Enum, ms []filedesc.Message) protoreflect.MessageDescriptor {
- if depIdx := int(r.depIdxs.Get(i, j)); depIdx < len(es)+len(ms) {
- return &ms[depIdx-len(es)]
- } else {
- return pimpl.Export{}.MessageDescriptorOf(r.goTypes[depIdx])
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/flags/flags.go b/vendor/google.golang.org/protobuf/internal/flags/flags.go
deleted file mode 100644
index 58372dd..0000000
--- a/vendor/google.golang.org/protobuf/internal/flags/flags.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2018 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.
-
-// Package flags provides a set of flags controlled by build tags.
-package flags
-
-// ProtoLegacy specifies whether to enable support for legacy functionality
-// such as MessageSets, weak fields, and various other obscure behavior
-// that is necessary to maintain backwards compatibility with proto1 or
-// the pre-release variants of proto2 and proto3.
-//
-// This is disabled by default unless built with the "protolegacy" tag.
-//
-// WARNING: The compatibility agreement covers nothing provided by this flag.
-// As such, functionality may suddenly be removed or changed at our discretion.
-const ProtoLegacy = protoLegacy
-
-// LazyUnmarshalExtensions specifies whether to lazily unmarshal extensions.
-//
-// Lazy extension unmarshaling validates the contents of message-valued
-// extension fields at unmarshal time, but defers creating the message
-// structure until the extension is first accessed.
-const LazyUnmarshalExtensions = ProtoLegacy
diff --git a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go b/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
deleted file mode 100644
index bda8e8c..0000000
--- a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !protolegacy
-// +build !protolegacy
-
-package flags
-
-const protoLegacy = false
diff --git a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go b/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
deleted file mode 100644
index 6d8d9bd..0000000
--- a/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2018 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.
-
-//go:build protolegacy
-// +build protolegacy
-
-package flags
-
-const protoLegacy = true
diff --git a/vendor/google.golang.org/protobuf/internal/genid/any_gen.go b/vendor/google.golang.org/protobuf/internal/genid/any_gen.go
deleted file mode 100644
index e6f7d47..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/any_gen.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_any_proto = "google/protobuf/any.proto"
-
-// Names for google.protobuf.Any.
-const (
- Any_message_name protoreflect.Name = "Any"
- Any_message_fullname protoreflect.FullName = "google.protobuf.Any"
-)
-
-// Field names for google.protobuf.Any.
-const (
- Any_TypeUrl_field_name protoreflect.Name = "type_url"
- Any_Value_field_name protoreflect.Name = "value"
-
- Any_TypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Any.type_url"
- Any_Value_field_fullname protoreflect.FullName = "google.protobuf.Any.value"
-)
-
-// Field numbers for google.protobuf.Any.
-const (
- Any_TypeUrl_field_number protoreflect.FieldNumber = 1
- Any_Value_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/api_gen.go b/vendor/google.golang.org/protobuf/internal/genid/api_gen.go
deleted file mode 100644
index df8f918..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/api_gen.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_api_proto = "google/protobuf/api.proto"
-
-// Names for google.protobuf.Api.
-const (
- Api_message_name protoreflect.Name = "Api"
- Api_message_fullname protoreflect.FullName = "google.protobuf.Api"
-)
-
-// Field names for google.protobuf.Api.
-const (
- Api_Name_field_name protoreflect.Name = "name"
- Api_Methods_field_name protoreflect.Name = "methods"
- Api_Options_field_name protoreflect.Name = "options"
- Api_Version_field_name protoreflect.Name = "version"
- Api_SourceContext_field_name protoreflect.Name = "source_context"
- Api_Mixins_field_name protoreflect.Name = "mixins"
- Api_Syntax_field_name protoreflect.Name = "syntax"
-
- Api_Name_field_fullname protoreflect.FullName = "google.protobuf.Api.name"
- Api_Methods_field_fullname protoreflect.FullName = "google.protobuf.Api.methods"
- Api_Options_field_fullname protoreflect.FullName = "google.protobuf.Api.options"
- Api_Version_field_fullname protoreflect.FullName = "google.protobuf.Api.version"
- Api_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Api.source_context"
- Api_Mixins_field_fullname protoreflect.FullName = "google.protobuf.Api.mixins"
- Api_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Api.syntax"
-)
-
-// Field numbers for google.protobuf.Api.
-const (
- Api_Name_field_number protoreflect.FieldNumber = 1
- Api_Methods_field_number protoreflect.FieldNumber = 2
- Api_Options_field_number protoreflect.FieldNumber = 3
- Api_Version_field_number protoreflect.FieldNumber = 4
- Api_SourceContext_field_number protoreflect.FieldNumber = 5
- Api_Mixins_field_number protoreflect.FieldNumber = 6
- Api_Syntax_field_number protoreflect.FieldNumber = 7
-)
-
-// Names for google.protobuf.Method.
-const (
- Method_message_name protoreflect.Name = "Method"
- Method_message_fullname protoreflect.FullName = "google.protobuf.Method"
-)
-
-// Field names for google.protobuf.Method.
-const (
- Method_Name_field_name protoreflect.Name = "name"
- Method_RequestTypeUrl_field_name protoreflect.Name = "request_type_url"
- Method_RequestStreaming_field_name protoreflect.Name = "request_streaming"
- Method_ResponseTypeUrl_field_name protoreflect.Name = "response_type_url"
- Method_ResponseStreaming_field_name protoreflect.Name = "response_streaming"
- Method_Options_field_name protoreflect.Name = "options"
- Method_Syntax_field_name protoreflect.Name = "syntax"
-
- Method_Name_field_fullname protoreflect.FullName = "google.protobuf.Method.name"
- Method_RequestTypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Method.request_type_url"
- Method_RequestStreaming_field_fullname protoreflect.FullName = "google.protobuf.Method.request_streaming"
- Method_ResponseTypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Method.response_type_url"
- Method_ResponseStreaming_field_fullname protoreflect.FullName = "google.protobuf.Method.response_streaming"
- Method_Options_field_fullname protoreflect.FullName = "google.protobuf.Method.options"
- Method_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Method.syntax"
-)
-
-// Field numbers for google.protobuf.Method.
-const (
- Method_Name_field_number protoreflect.FieldNumber = 1
- Method_RequestTypeUrl_field_number protoreflect.FieldNumber = 2
- Method_RequestStreaming_field_number protoreflect.FieldNumber = 3
- Method_ResponseTypeUrl_field_number protoreflect.FieldNumber = 4
- Method_ResponseStreaming_field_number protoreflect.FieldNumber = 5
- Method_Options_field_number protoreflect.FieldNumber = 6
- Method_Syntax_field_number protoreflect.FieldNumber = 7
-)
-
-// Names for google.protobuf.Mixin.
-const (
- Mixin_message_name protoreflect.Name = "Mixin"
- Mixin_message_fullname protoreflect.FullName = "google.protobuf.Mixin"
-)
-
-// Field names for google.protobuf.Mixin.
-const (
- Mixin_Name_field_name protoreflect.Name = "name"
- Mixin_Root_field_name protoreflect.Name = "root"
-
- Mixin_Name_field_fullname protoreflect.FullName = "google.protobuf.Mixin.name"
- Mixin_Root_field_fullname protoreflect.FullName = "google.protobuf.Mixin.root"
-)
-
-// Field numbers for google.protobuf.Mixin.
-const (
- Mixin_Name_field_number protoreflect.FieldNumber = 1
- Mixin_Root_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
deleted file mode 100644
index 8f94230..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go
+++ /dev/null
@@ -1,1087 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_descriptor_proto = "google/protobuf/descriptor.proto"
-
-// Full and short names for google.protobuf.Edition.
-const (
- Edition_enum_fullname = "google.protobuf.Edition"
- Edition_enum_name = "Edition"
-)
-
-// Names for google.protobuf.FileDescriptorSet.
-const (
- FileDescriptorSet_message_name protoreflect.Name = "FileDescriptorSet"
- FileDescriptorSet_message_fullname protoreflect.FullName = "google.protobuf.FileDescriptorSet"
-)
-
-// Field names for google.protobuf.FileDescriptorSet.
-const (
- FileDescriptorSet_File_field_name protoreflect.Name = "file"
-
- FileDescriptorSet_File_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorSet.file"
-)
-
-// Field numbers for google.protobuf.FileDescriptorSet.
-const (
- FileDescriptorSet_File_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.FileDescriptorProto.
-const (
- FileDescriptorProto_message_name protoreflect.Name = "FileDescriptorProto"
- FileDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto"
-)
-
-// Field names for google.protobuf.FileDescriptorProto.
-const (
- FileDescriptorProto_Name_field_name protoreflect.Name = "name"
- FileDescriptorProto_Package_field_name protoreflect.Name = "package"
- FileDescriptorProto_Dependency_field_name protoreflect.Name = "dependency"
- FileDescriptorProto_PublicDependency_field_name protoreflect.Name = "public_dependency"
- FileDescriptorProto_WeakDependency_field_name protoreflect.Name = "weak_dependency"
- FileDescriptorProto_MessageType_field_name protoreflect.Name = "message_type"
- FileDescriptorProto_EnumType_field_name protoreflect.Name = "enum_type"
- FileDescriptorProto_Service_field_name protoreflect.Name = "service"
- FileDescriptorProto_Extension_field_name protoreflect.Name = "extension"
- FileDescriptorProto_Options_field_name protoreflect.Name = "options"
- FileDescriptorProto_SourceCodeInfo_field_name protoreflect.Name = "source_code_info"
- FileDescriptorProto_Syntax_field_name protoreflect.Name = "syntax"
- FileDescriptorProto_Edition_field_name protoreflect.Name = "edition"
-
- FileDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.name"
- FileDescriptorProto_Package_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.package"
- FileDescriptorProto_Dependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.dependency"
- FileDescriptorProto_PublicDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.public_dependency"
- FileDescriptorProto_WeakDependency_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.weak_dependency"
- FileDescriptorProto_MessageType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.message_type"
- FileDescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.enum_type"
- FileDescriptorProto_Service_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.service"
- FileDescriptorProto_Extension_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.extension"
- FileDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.options"
- FileDescriptorProto_SourceCodeInfo_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.source_code_info"
- FileDescriptorProto_Syntax_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.syntax"
- FileDescriptorProto_Edition_field_fullname protoreflect.FullName = "google.protobuf.FileDescriptorProto.edition"
-)
-
-// Field numbers for google.protobuf.FileDescriptorProto.
-const (
- FileDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- FileDescriptorProto_Package_field_number protoreflect.FieldNumber = 2
- FileDescriptorProto_Dependency_field_number protoreflect.FieldNumber = 3
- FileDescriptorProto_PublicDependency_field_number protoreflect.FieldNumber = 10
- FileDescriptorProto_WeakDependency_field_number protoreflect.FieldNumber = 11
- FileDescriptorProto_MessageType_field_number protoreflect.FieldNumber = 4
- FileDescriptorProto_EnumType_field_number protoreflect.FieldNumber = 5
- FileDescriptorProto_Service_field_number protoreflect.FieldNumber = 6
- FileDescriptorProto_Extension_field_number protoreflect.FieldNumber = 7
- FileDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
- FileDescriptorProto_SourceCodeInfo_field_number protoreflect.FieldNumber = 9
- FileDescriptorProto_Syntax_field_number protoreflect.FieldNumber = 12
- FileDescriptorProto_Edition_field_number protoreflect.FieldNumber = 14
-)
-
-// Names for google.protobuf.DescriptorProto.
-const (
- DescriptorProto_message_name protoreflect.Name = "DescriptorProto"
- DescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto"
-)
-
-// Field names for google.protobuf.DescriptorProto.
-const (
- DescriptorProto_Name_field_name protoreflect.Name = "name"
- DescriptorProto_Field_field_name protoreflect.Name = "field"
- DescriptorProto_Extension_field_name protoreflect.Name = "extension"
- DescriptorProto_NestedType_field_name protoreflect.Name = "nested_type"
- DescriptorProto_EnumType_field_name protoreflect.Name = "enum_type"
- DescriptorProto_ExtensionRange_field_name protoreflect.Name = "extension_range"
- DescriptorProto_OneofDecl_field_name protoreflect.Name = "oneof_decl"
- DescriptorProto_Options_field_name protoreflect.Name = "options"
- DescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
- DescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
-
- DescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.name"
- DescriptorProto_Field_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.field"
- DescriptorProto_Extension_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.extension"
- DescriptorProto_NestedType_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.nested_type"
- DescriptorProto_EnumType_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.enum_type"
- DescriptorProto_ExtensionRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.extension_range"
- DescriptorProto_OneofDecl_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.oneof_decl"
- DescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.options"
- DescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_range"
- DescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.reserved_name"
-)
-
-// Field numbers for google.protobuf.DescriptorProto.
-const (
- DescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- DescriptorProto_Field_field_number protoreflect.FieldNumber = 2
- DescriptorProto_Extension_field_number protoreflect.FieldNumber = 6
- DescriptorProto_NestedType_field_number protoreflect.FieldNumber = 3
- DescriptorProto_EnumType_field_number protoreflect.FieldNumber = 4
- DescriptorProto_ExtensionRange_field_number protoreflect.FieldNumber = 5
- DescriptorProto_OneofDecl_field_number protoreflect.FieldNumber = 8
- DescriptorProto_Options_field_number protoreflect.FieldNumber = 7
- DescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 9
- DescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 10
-)
-
-// Names for google.protobuf.DescriptorProto.ExtensionRange.
-const (
- DescriptorProto_ExtensionRange_message_name protoreflect.Name = "ExtensionRange"
- DescriptorProto_ExtensionRange_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange"
-)
-
-// Field names for google.protobuf.DescriptorProto.ExtensionRange.
-const (
- DescriptorProto_ExtensionRange_Start_field_name protoreflect.Name = "start"
- DescriptorProto_ExtensionRange_End_field_name protoreflect.Name = "end"
- DescriptorProto_ExtensionRange_Options_field_name protoreflect.Name = "options"
-
- DescriptorProto_ExtensionRange_Start_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.start"
- DescriptorProto_ExtensionRange_End_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.end"
- DescriptorProto_ExtensionRange_Options_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ExtensionRange.options"
-)
-
-// Field numbers for google.protobuf.DescriptorProto.ExtensionRange.
-const (
- DescriptorProto_ExtensionRange_Start_field_number protoreflect.FieldNumber = 1
- DescriptorProto_ExtensionRange_End_field_number protoreflect.FieldNumber = 2
- DescriptorProto_ExtensionRange_Options_field_number protoreflect.FieldNumber = 3
-)
-
-// Names for google.protobuf.DescriptorProto.ReservedRange.
-const (
- DescriptorProto_ReservedRange_message_name protoreflect.Name = "ReservedRange"
- DescriptorProto_ReservedRange_message_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange"
-)
-
-// Field names for google.protobuf.DescriptorProto.ReservedRange.
-const (
- DescriptorProto_ReservedRange_Start_field_name protoreflect.Name = "start"
- DescriptorProto_ReservedRange_End_field_name protoreflect.Name = "end"
-
- DescriptorProto_ReservedRange_Start_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange.start"
- DescriptorProto_ReservedRange_End_field_fullname protoreflect.FullName = "google.protobuf.DescriptorProto.ReservedRange.end"
-)
-
-// Field numbers for google.protobuf.DescriptorProto.ReservedRange.
-const (
- DescriptorProto_ReservedRange_Start_field_number protoreflect.FieldNumber = 1
- DescriptorProto_ReservedRange_End_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.ExtensionRangeOptions.
-const (
- ExtensionRangeOptions_message_name protoreflect.Name = "ExtensionRangeOptions"
- ExtensionRangeOptions_message_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions"
-)
-
-// Field names for google.protobuf.ExtensionRangeOptions.
-const (
- ExtensionRangeOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
- ExtensionRangeOptions_Declaration_field_name protoreflect.Name = "declaration"
- ExtensionRangeOptions_Features_field_name protoreflect.Name = "features"
- ExtensionRangeOptions_Verification_field_name protoreflect.Name = "verification"
-
- ExtensionRangeOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.uninterpreted_option"
- ExtensionRangeOptions_Declaration_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.declaration"
- ExtensionRangeOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.features"
- ExtensionRangeOptions_Verification_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.verification"
-)
-
-// Field numbers for google.protobuf.ExtensionRangeOptions.
-const (
- ExtensionRangeOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
- ExtensionRangeOptions_Declaration_field_number protoreflect.FieldNumber = 2
- ExtensionRangeOptions_Features_field_number protoreflect.FieldNumber = 50
- ExtensionRangeOptions_Verification_field_number protoreflect.FieldNumber = 3
-)
-
-// Full and short names for google.protobuf.ExtensionRangeOptions.VerificationState.
-const (
- ExtensionRangeOptions_VerificationState_enum_fullname = "google.protobuf.ExtensionRangeOptions.VerificationState"
- ExtensionRangeOptions_VerificationState_enum_name = "VerificationState"
-)
-
-// Names for google.protobuf.ExtensionRangeOptions.Declaration.
-const (
- ExtensionRangeOptions_Declaration_message_name protoreflect.Name = "Declaration"
- ExtensionRangeOptions_Declaration_message_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration"
-)
-
-// Field names for google.protobuf.ExtensionRangeOptions.Declaration.
-const (
- ExtensionRangeOptions_Declaration_Number_field_name protoreflect.Name = "number"
- ExtensionRangeOptions_Declaration_FullName_field_name protoreflect.Name = "full_name"
- ExtensionRangeOptions_Declaration_Type_field_name protoreflect.Name = "type"
- ExtensionRangeOptions_Declaration_Reserved_field_name protoreflect.Name = "reserved"
- ExtensionRangeOptions_Declaration_Repeated_field_name protoreflect.Name = "repeated"
-
- ExtensionRangeOptions_Declaration_Number_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.number"
- ExtensionRangeOptions_Declaration_FullName_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.full_name"
- ExtensionRangeOptions_Declaration_Type_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.type"
- ExtensionRangeOptions_Declaration_Reserved_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.reserved"
- ExtensionRangeOptions_Declaration_Repeated_field_fullname protoreflect.FullName = "google.protobuf.ExtensionRangeOptions.Declaration.repeated"
-)
-
-// Field numbers for google.protobuf.ExtensionRangeOptions.Declaration.
-const (
- ExtensionRangeOptions_Declaration_Number_field_number protoreflect.FieldNumber = 1
- ExtensionRangeOptions_Declaration_FullName_field_number protoreflect.FieldNumber = 2
- ExtensionRangeOptions_Declaration_Type_field_number protoreflect.FieldNumber = 3
- ExtensionRangeOptions_Declaration_Reserved_field_number protoreflect.FieldNumber = 5
- ExtensionRangeOptions_Declaration_Repeated_field_number protoreflect.FieldNumber = 6
-)
-
-// Names for google.protobuf.FieldDescriptorProto.
-const (
- FieldDescriptorProto_message_name protoreflect.Name = "FieldDescriptorProto"
- FieldDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto"
-)
-
-// Field names for google.protobuf.FieldDescriptorProto.
-const (
- FieldDescriptorProto_Name_field_name protoreflect.Name = "name"
- FieldDescriptorProto_Number_field_name protoreflect.Name = "number"
- FieldDescriptorProto_Label_field_name protoreflect.Name = "label"
- FieldDescriptorProto_Type_field_name protoreflect.Name = "type"
- FieldDescriptorProto_TypeName_field_name protoreflect.Name = "type_name"
- FieldDescriptorProto_Extendee_field_name protoreflect.Name = "extendee"
- FieldDescriptorProto_DefaultValue_field_name protoreflect.Name = "default_value"
- FieldDescriptorProto_OneofIndex_field_name protoreflect.Name = "oneof_index"
- FieldDescriptorProto_JsonName_field_name protoreflect.Name = "json_name"
- FieldDescriptorProto_Options_field_name protoreflect.Name = "options"
- FieldDescriptorProto_Proto3Optional_field_name protoreflect.Name = "proto3_optional"
-
- FieldDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.name"
- FieldDescriptorProto_Number_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.number"
- FieldDescriptorProto_Label_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.label"
- FieldDescriptorProto_Type_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.type"
- FieldDescriptorProto_TypeName_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.type_name"
- FieldDescriptorProto_Extendee_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.extendee"
- FieldDescriptorProto_DefaultValue_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.default_value"
- FieldDescriptorProto_OneofIndex_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.oneof_index"
- FieldDescriptorProto_JsonName_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.json_name"
- FieldDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.options"
- FieldDescriptorProto_Proto3Optional_field_fullname protoreflect.FullName = "google.protobuf.FieldDescriptorProto.proto3_optional"
-)
-
-// Field numbers for google.protobuf.FieldDescriptorProto.
-const (
- FieldDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- FieldDescriptorProto_Number_field_number protoreflect.FieldNumber = 3
- FieldDescriptorProto_Label_field_number protoreflect.FieldNumber = 4
- FieldDescriptorProto_Type_field_number protoreflect.FieldNumber = 5
- FieldDescriptorProto_TypeName_field_number protoreflect.FieldNumber = 6
- FieldDescriptorProto_Extendee_field_number protoreflect.FieldNumber = 2
- FieldDescriptorProto_DefaultValue_field_number protoreflect.FieldNumber = 7
- FieldDescriptorProto_OneofIndex_field_number protoreflect.FieldNumber = 9
- FieldDescriptorProto_JsonName_field_number protoreflect.FieldNumber = 10
- FieldDescriptorProto_Options_field_number protoreflect.FieldNumber = 8
- FieldDescriptorProto_Proto3Optional_field_number protoreflect.FieldNumber = 17
-)
-
-// Full and short names for google.protobuf.FieldDescriptorProto.Type.
-const (
- FieldDescriptorProto_Type_enum_fullname = "google.protobuf.FieldDescriptorProto.Type"
- FieldDescriptorProto_Type_enum_name = "Type"
-)
-
-// Full and short names for google.protobuf.FieldDescriptorProto.Label.
-const (
- FieldDescriptorProto_Label_enum_fullname = "google.protobuf.FieldDescriptorProto.Label"
- FieldDescriptorProto_Label_enum_name = "Label"
-)
-
-// Names for google.protobuf.OneofDescriptorProto.
-const (
- OneofDescriptorProto_message_name protoreflect.Name = "OneofDescriptorProto"
- OneofDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto"
-)
-
-// Field names for google.protobuf.OneofDescriptorProto.
-const (
- OneofDescriptorProto_Name_field_name protoreflect.Name = "name"
- OneofDescriptorProto_Options_field_name protoreflect.Name = "options"
-
- OneofDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto.name"
- OneofDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.OneofDescriptorProto.options"
-)
-
-// Field numbers for google.protobuf.OneofDescriptorProto.
-const (
- OneofDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- OneofDescriptorProto_Options_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.EnumDescriptorProto.
-const (
- EnumDescriptorProto_message_name protoreflect.Name = "EnumDescriptorProto"
- EnumDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto"
-)
-
-// Field names for google.protobuf.EnumDescriptorProto.
-const (
- EnumDescriptorProto_Name_field_name protoreflect.Name = "name"
- EnumDescriptorProto_Value_field_name protoreflect.Name = "value"
- EnumDescriptorProto_Options_field_name protoreflect.Name = "options"
- EnumDescriptorProto_ReservedRange_field_name protoreflect.Name = "reserved_range"
- EnumDescriptorProto_ReservedName_field_name protoreflect.Name = "reserved_name"
-
- EnumDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.name"
- EnumDescriptorProto_Value_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.value"
- EnumDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.options"
- EnumDescriptorProto_ReservedRange_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_range"
- EnumDescriptorProto_ReservedName_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.reserved_name"
-)
-
-// Field numbers for google.protobuf.EnumDescriptorProto.
-const (
- EnumDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- EnumDescriptorProto_Value_field_number protoreflect.FieldNumber = 2
- EnumDescriptorProto_Options_field_number protoreflect.FieldNumber = 3
- EnumDescriptorProto_ReservedRange_field_number protoreflect.FieldNumber = 4
- EnumDescriptorProto_ReservedName_field_number protoreflect.FieldNumber = 5
-)
-
-// Names for google.protobuf.EnumDescriptorProto.EnumReservedRange.
-const (
- EnumDescriptorProto_EnumReservedRange_message_name protoreflect.Name = "EnumReservedRange"
- EnumDescriptorProto_EnumReservedRange_message_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange"
-)
-
-// Field names for google.protobuf.EnumDescriptorProto.EnumReservedRange.
-const (
- EnumDescriptorProto_EnumReservedRange_Start_field_name protoreflect.Name = "start"
- EnumDescriptorProto_EnumReservedRange_End_field_name protoreflect.Name = "end"
-
- EnumDescriptorProto_EnumReservedRange_Start_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange.start"
- EnumDescriptorProto_EnumReservedRange_End_field_fullname protoreflect.FullName = "google.protobuf.EnumDescriptorProto.EnumReservedRange.end"
-)
-
-// Field numbers for google.protobuf.EnumDescriptorProto.EnumReservedRange.
-const (
- EnumDescriptorProto_EnumReservedRange_Start_field_number protoreflect.FieldNumber = 1
- EnumDescriptorProto_EnumReservedRange_End_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.EnumValueDescriptorProto.
-const (
- EnumValueDescriptorProto_message_name protoreflect.Name = "EnumValueDescriptorProto"
- EnumValueDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto"
-)
-
-// Field names for google.protobuf.EnumValueDescriptorProto.
-const (
- EnumValueDescriptorProto_Name_field_name protoreflect.Name = "name"
- EnumValueDescriptorProto_Number_field_name protoreflect.Name = "number"
- EnumValueDescriptorProto_Options_field_name protoreflect.Name = "options"
-
- EnumValueDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.name"
- EnumValueDescriptorProto_Number_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.number"
- EnumValueDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumValueDescriptorProto.options"
-)
-
-// Field numbers for google.protobuf.EnumValueDescriptorProto.
-const (
- EnumValueDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- EnumValueDescriptorProto_Number_field_number protoreflect.FieldNumber = 2
- EnumValueDescriptorProto_Options_field_number protoreflect.FieldNumber = 3
-)
-
-// Names for google.protobuf.ServiceDescriptorProto.
-const (
- ServiceDescriptorProto_message_name protoreflect.Name = "ServiceDescriptorProto"
- ServiceDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto"
-)
-
-// Field names for google.protobuf.ServiceDescriptorProto.
-const (
- ServiceDescriptorProto_Name_field_name protoreflect.Name = "name"
- ServiceDescriptorProto_Method_field_name protoreflect.Name = "method"
- ServiceDescriptorProto_Options_field_name protoreflect.Name = "options"
-
- ServiceDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.name"
- ServiceDescriptorProto_Method_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.method"
- ServiceDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.ServiceDescriptorProto.options"
-)
-
-// Field numbers for google.protobuf.ServiceDescriptorProto.
-const (
- ServiceDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- ServiceDescriptorProto_Method_field_number protoreflect.FieldNumber = 2
- ServiceDescriptorProto_Options_field_number protoreflect.FieldNumber = 3
-)
-
-// Names for google.protobuf.MethodDescriptorProto.
-const (
- MethodDescriptorProto_message_name protoreflect.Name = "MethodDescriptorProto"
- MethodDescriptorProto_message_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto"
-)
-
-// Field names for google.protobuf.MethodDescriptorProto.
-const (
- MethodDescriptorProto_Name_field_name protoreflect.Name = "name"
- MethodDescriptorProto_InputType_field_name protoreflect.Name = "input_type"
- MethodDescriptorProto_OutputType_field_name protoreflect.Name = "output_type"
- MethodDescriptorProto_Options_field_name protoreflect.Name = "options"
- MethodDescriptorProto_ClientStreaming_field_name protoreflect.Name = "client_streaming"
- MethodDescriptorProto_ServerStreaming_field_name protoreflect.Name = "server_streaming"
-
- MethodDescriptorProto_Name_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.name"
- MethodDescriptorProto_InputType_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.input_type"
- MethodDescriptorProto_OutputType_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.output_type"
- MethodDescriptorProto_Options_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.options"
- MethodDescriptorProto_ClientStreaming_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.client_streaming"
- MethodDescriptorProto_ServerStreaming_field_fullname protoreflect.FullName = "google.protobuf.MethodDescriptorProto.server_streaming"
-)
-
-// Field numbers for google.protobuf.MethodDescriptorProto.
-const (
- MethodDescriptorProto_Name_field_number protoreflect.FieldNumber = 1
- MethodDescriptorProto_InputType_field_number protoreflect.FieldNumber = 2
- MethodDescriptorProto_OutputType_field_number protoreflect.FieldNumber = 3
- MethodDescriptorProto_Options_field_number protoreflect.FieldNumber = 4
- MethodDescriptorProto_ClientStreaming_field_number protoreflect.FieldNumber = 5
- MethodDescriptorProto_ServerStreaming_field_number protoreflect.FieldNumber = 6
-)
-
-// Names for google.protobuf.FileOptions.
-const (
- FileOptions_message_name protoreflect.Name = "FileOptions"
- FileOptions_message_fullname protoreflect.FullName = "google.protobuf.FileOptions"
-)
-
-// Field names for google.protobuf.FileOptions.
-const (
- FileOptions_JavaPackage_field_name protoreflect.Name = "java_package"
- FileOptions_JavaOuterClassname_field_name protoreflect.Name = "java_outer_classname"
- FileOptions_JavaMultipleFiles_field_name protoreflect.Name = "java_multiple_files"
- FileOptions_JavaGenerateEqualsAndHash_field_name protoreflect.Name = "java_generate_equals_and_hash"
- FileOptions_JavaStringCheckUtf8_field_name protoreflect.Name = "java_string_check_utf8"
- FileOptions_OptimizeFor_field_name protoreflect.Name = "optimize_for"
- FileOptions_GoPackage_field_name protoreflect.Name = "go_package"
- FileOptions_CcGenericServices_field_name protoreflect.Name = "cc_generic_services"
- FileOptions_JavaGenericServices_field_name protoreflect.Name = "java_generic_services"
- FileOptions_PyGenericServices_field_name protoreflect.Name = "py_generic_services"
- FileOptions_PhpGenericServices_field_name protoreflect.Name = "php_generic_services"
- FileOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- FileOptions_CcEnableArenas_field_name protoreflect.Name = "cc_enable_arenas"
- FileOptions_ObjcClassPrefix_field_name protoreflect.Name = "objc_class_prefix"
- FileOptions_CsharpNamespace_field_name protoreflect.Name = "csharp_namespace"
- FileOptions_SwiftPrefix_field_name protoreflect.Name = "swift_prefix"
- FileOptions_PhpClassPrefix_field_name protoreflect.Name = "php_class_prefix"
- FileOptions_PhpNamespace_field_name protoreflect.Name = "php_namespace"
- FileOptions_PhpMetadataNamespace_field_name protoreflect.Name = "php_metadata_namespace"
- FileOptions_RubyPackage_field_name protoreflect.Name = "ruby_package"
- FileOptions_Features_field_name protoreflect.Name = "features"
- FileOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- FileOptions_JavaPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_package"
- FileOptions_JavaOuterClassname_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_outer_classname"
- FileOptions_JavaMultipleFiles_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_multiple_files"
- FileOptions_JavaGenerateEqualsAndHash_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generate_equals_and_hash"
- FileOptions_JavaStringCheckUtf8_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_string_check_utf8"
- FileOptions_OptimizeFor_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.optimize_for"
- FileOptions_GoPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.go_package"
- FileOptions_CcGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_generic_services"
- FileOptions_JavaGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.java_generic_services"
- FileOptions_PyGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.py_generic_services"
- FileOptions_PhpGenericServices_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_generic_services"
- FileOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.deprecated"
- FileOptions_CcEnableArenas_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.cc_enable_arenas"
- FileOptions_ObjcClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.objc_class_prefix"
- FileOptions_CsharpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.csharp_namespace"
- FileOptions_SwiftPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.swift_prefix"
- FileOptions_PhpClassPrefix_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_class_prefix"
- FileOptions_PhpNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_namespace"
- FileOptions_PhpMetadataNamespace_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.php_metadata_namespace"
- FileOptions_RubyPackage_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.ruby_package"
- FileOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.features"
- FileOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FileOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.FileOptions.
-const (
- FileOptions_JavaPackage_field_number protoreflect.FieldNumber = 1
- FileOptions_JavaOuterClassname_field_number protoreflect.FieldNumber = 8
- FileOptions_JavaMultipleFiles_field_number protoreflect.FieldNumber = 10
- FileOptions_JavaGenerateEqualsAndHash_field_number protoreflect.FieldNumber = 20
- FileOptions_JavaStringCheckUtf8_field_number protoreflect.FieldNumber = 27
- FileOptions_OptimizeFor_field_number protoreflect.FieldNumber = 9
- FileOptions_GoPackage_field_number protoreflect.FieldNumber = 11
- FileOptions_CcGenericServices_field_number protoreflect.FieldNumber = 16
- FileOptions_JavaGenericServices_field_number protoreflect.FieldNumber = 17
- FileOptions_PyGenericServices_field_number protoreflect.FieldNumber = 18
- FileOptions_PhpGenericServices_field_number protoreflect.FieldNumber = 42
- FileOptions_Deprecated_field_number protoreflect.FieldNumber = 23
- FileOptions_CcEnableArenas_field_number protoreflect.FieldNumber = 31
- FileOptions_ObjcClassPrefix_field_number protoreflect.FieldNumber = 36
- FileOptions_CsharpNamespace_field_number protoreflect.FieldNumber = 37
- FileOptions_SwiftPrefix_field_number protoreflect.FieldNumber = 39
- FileOptions_PhpClassPrefix_field_number protoreflect.FieldNumber = 40
- FileOptions_PhpNamespace_field_number protoreflect.FieldNumber = 41
- FileOptions_PhpMetadataNamespace_field_number protoreflect.FieldNumber = 44
- FileOptions_RubyPackage_field_number protoreflect.FieldNumber = 45
- FileOptions_Features_field_number protoreflect.FieldNumber = 50
- FileOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Full and short names for google.protobuf.FileOptions.OptimizeMode.
-const (
- FileOptions_OptimizeMode_enum_fullname = "google.protobuf.FileOptions.OptimizeMode"
- FileOptions_OptimizeMode_enum_name = "OptimizeMode"
-)
-
-// Names for google.protobuf.MessageOptions.
-const (
- MessageOptions_message_name protoreflect.Name = "MessageOptions"
- MessageOptions_message_fullname protoreflect.FullName = "google.protobuf.MessageOptions"
-)
-
-// Field names for google.protobuf.MessageOptions.
-const (
- MessageOptions_MessageSetWireFormat_field_name protoreflect.Name = "message_set_wire_format"
- MessageOptions_NoStandardDescriptorAccessor_field_name protoreflect.Name = "no_standard_descriptor_accessor"
- MessageOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- MessageOptions_MapEntry_field_name protoreflect.Name = "map_entry"
- MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
- MessageOptions_Features_field_name protoreflect.Name = "features"
- MessageOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- MessageOptions_MessageSetWireFormat_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.message_set_wire_format"
- MessageOptions_NoStandardDescriptorAccessor_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.no_standard_descriptor_accessor"
- MessageOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated"
- MessageOptions_MapEntry_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.map_entry"
- MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.deprecated_legacy_json_field_conflicts"
- MessageOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.features"
- MessageOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MessageOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.MessageOptions.
-const (
- MessageOptions_MessageSetWireFormat_field_number protoreflect.FieldNumber = 1
- MessageOptions_NoStandardDescriptorAccessor_field_number protoreflect.FieldNumber = 2
- MessageOptions_Deprecated_field_number protoreflect.FieldNumber = 3
- MessageOptions_MapEntry_field_number protoreflect.FieldNumber = 7
- MessageOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 11
- MessageOptions_Features_field_number protoreflect.FieldNumber = 12
- MessageOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Names for google.protobuf.FieldOptions.
-const (
- FieldOptions_message_name protoreflect.Name = "FieldOptions"
- FieldOptions_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions"
-)
-
-// Field names for google.protobuf.FieldOptions.
-const (
- FieldOptions_Ctype_field_name protoreflect.Name = "ctype"
- FieldOptions_Packed_field_name protoreflect.Name = "packed"
- FieldOptions_Jstype_field_name protoreflect.Name = "jstype"
- FieldOptions_Lazy_field_name protoreflect.Name = "lazy"
- FieldOptions_UnverifiedLazy_field_name protoreflect.Name = "unverified_lazy"
- FieldOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- FieldOptions_Weak_field_name protoreflect.Name = "weak"
- FieldOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
- FieldOptions_Retention_field_name protoreflect.Name = "retention"
- FieldOptions_Targets_field_name protoreflect.Name = "targets"
- FieldOptions_EditionDefaults_field_name protoreflect.Name = "edition_defaults"
- FieldOptions_Features_field_name protoreflect.Name = "features"
- FieldOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- FieldOptions_Ctype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.ctype"
- FieldOptions_Packed_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.packed"
- FieldOptions_Jstype_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.jstype"
- FieldOptions_Lazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.lazy"
- FieldOptions_UnverifiedLazy_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.unverified_lazy"
- FieldOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.deprecated"
- FieldOptions_Weak_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.weak"
- FieldOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.debug_redact"
- FieldOptions_Retention_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.retention"
- FieldOptions_Targets_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.targets"
- FieldOptions_EditionDefaults_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.edition_defaults"
- FieldOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.features"
- FieldOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.FieldOptions.
-const (
- FieldOptions_Ctype_field_number protoreflect.FieldNumber = 1
- FieldOptions_Packed_field_number protoreflect.FieldNumber = 2
- FieldOptions_Jstype_field_number protoreflect.FieldNumber = 6
- FieldOptions_Lazy_field_number protoreflect.FieldNumber = 5
- FieldOptions_UnverifiedLazy_field_number protoreflect.FieldNumber = 15
- FieldOptions_Deprecated_field_number protoreflect.FieldNumber = 3
- FieldOptions_Weak_field_number protoreflect.FieldNumber = 10
- FieldOptions_DebugRedact_field_number protoreflect.FieldNumber = 16
- FieldOptions_Retention_field_number protoreflect.FieldNumber = 17
- FieldOptions_Targets_field_number protoreflect.FieldNumber = 19
- FieldOptions_EditionDefaults_field_number protoreflect.FieldNumber = 20
- FieldOptions_Features_field_number protoreflect.FieldNumber = 21
- FieldOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Full and short names for google.protobuf.FieldOptions.CType.
-const (
- FieldOptions_CType_enum_fullname = "google.protobuf.FieldOptions.CType"
- FieldOptions_CType_enum_name = "CType"
-)
-
-// Full and short names for google.protobuf.FieldOptions.JSType.
-const (
- FieldOptions_JSType_enum_fullname = "google.protobuf.FieldOptions.JSType"
- FieldOptions_JSType_enum_name = "JSType"
-)
-
-// Full and short names for google.protobuf.FieldOptions.OptionRetention.
-const (
- FieldOptions_OptionRetention_enum_fullname = "google.protobuf.FieldOptions.OptionRetention"
- FieldOptions_OptionRetention_enum_name = "OptionRetention"
-)
-
-// Full and short names for google.protobuf.FieldOptions.OptionTargetType.
-const (
- FieldOptions_OptionTargetType_enum_fullname = "google.protobuf.FieldOptions.OptionTargetType"
- FieldOptions_OptionTargetType_enum_name = "OptionTargetType"
-)
-
-// Names for google.protobuf.FieldOptions.EditionDefault.
-const (
- FieldOptions_EditionDefault_message_name protoreflect.Name = "EditionDefault"
- FieldOptions_EditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault"
-)
-
-// Field names for google.protobuf.FieldOptions.EditionDefault.
-const (
- FieldOptions_EditionDefault_Edition_field_name protoreflect.Name = "edition"
- FieldOptions_EditionDefault_Value_field_name protoreflect.Name = "value"
-
- FieldOptions_EditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.edition"
- FieldOptions_EditionDefault_Value_field_fullname protoreflect.FullName = "google.protobuf.FieldOptions.EditionDefault.value"
-)
-
-// Field numbers for google.protobuf.FieldOptions.EditionDefault.
-const (
- FieldOptions_EditionDefault_Edition_field_number protoreflect.FieldNumber = 3
- FieldOptions_EditionDefault_Value_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.OneofOptions.
-const (
- OneofOptions_message_name protoreflect.Name = "OneofOptions"
- OneofOptions_message_fullname protoreflect.FullName = "google.protobuf.OneofOptions"
-)
-
-// Field names for google.protobuf.OneofOptions.
-const (
- OneofOptions_Features_field_name protoreflect.Name = "features"
- OneofOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- OneofOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.features"
- OneofOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.OneofOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.OneofOptions.
-const (
- OneofOptions_Features_field_number protoreflect.FieldNumber = 1
- OneofOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Names for google.protobuf.EnumOptions.
-const (
- EnumOptions_message_name protoreflect.Name = "EnumOptions"
- EnumOptions_message_fullname protoreflect.FullName = "google.protobuf.EnumOptions"
-)
-
-// Field names for google.protobuf.EnumOptions.
-const (
- EnumOptions_AllowAlias_field_name protoreflect.Name = "allow_alias"
- EnumOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_name protoreflect.Name = "deprecated_legacy_json_field_conflicts"
- EnumOptions_Features_field_name protoreflect.Name = "features"
- EnumOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- EnumOptions_AllowAlias_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.allow_alias"
- EnumOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated"
- EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.deprecated_legacy_json_field_conflicts"
- EnumOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.features"
- EnumOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.EnumOptions.
-const (
- EnumOptions_AllowAlias_field_number protoreflect.FieldNumber = 2
- EnumOptions_Deprecated_field_number protoreflect.FieldNumber = 3
- EnumOptions_DeprecatedLegacyJsonFieldConflicts_field_number protoreflect.FieldNumber = 6
- EnumOptions_Features_field_number protoreflect.FieldNumber = 7
- EnumOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Names for google.protobuf.EnumValueOptions.
-const (
- EnumValueOptions_message_name protoreflect.Name = "EnumValueOptions"
- EnumValueOptions_message_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions"
-)
-
-// Field names for google.protobuf.EnumValueOptions.
-const (
- EnumValueOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- EnumValueOptions_Features_field_name protoreflect.Name = "features"
- EnumValueOptions_DebugRedact_field_name protoreflect.Name = "debug_redact"
- EnumValueOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- EnumValueOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.deprecated"
- EnumValueOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.features"
- EnumValueOptions_DebugRedact_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.debug_redact"
- EnumValueOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.EnumValueOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.EnumValueOptions.
-const (
- EnumValueOptions_Deprecated_field_number protoreflect.FieldNumber = 1
- EnumValueOptions_Features_field_number protoreflect.FieldNumber = 2
- EnumValueOptions_DebugRedact_field_number protoreflect.FieldNumber = 3
- EnumValueOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Names for google.protobuf.ServiceOptions.
-const (
- ServiceOptions_message_name protoreflect.Name = "ServiceOptions"
- ServiceOptions_message_fullname protoreflect.FullName = "google.protobuf.ServiceOptions"
-)
-
-// Field names for google.protobuf.ServiceOptions.
-const (
- ServiceOptions_Features_field_name protoreflect.Name = "features"
- ServiceOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- ServiceOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- ServiceOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.features"
- ServiceOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.deprecated"
- ServiceOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.ServiceOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.ServiceOptions.
-const (
- ServiceOptions_Features_field_number protoreflect.FieldNumber = 34
- ServiceOptions_Deprecated_field_number protoreflect.FieldNumber = 33
- ServiceOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Names for google.protobuf.MethodOptions.
-const (
- MethodOptions_message_name protoreflect.Name = "MethodOptions"
- MethodOptions_message_fullname protoreflect.FullName = "google.protobuf.MethodOptions"
-)
-
-// Field names for google.protobuf.MethodOptions.
-const (
- MethodOptions_Deprecated_field_name protoreflect.Name = "deprecated"
- MethodOptions_IdempotencyLevel_field_name protoreflect.Name = "idempotency_level"
- MethodOptions_Features_field_name protoreflect.Name = "features"
- MethodOptions_UninterpretedOption_field_name protoreflect.Name = "uninterpreted_option"
-
- MethodOptions_Deprecated_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.deprecated"
- MethodOptions_IdempotencyLevel_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.idempotency_level"
- MethodOptions_Features_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.features"
- MethodOptions_UninterpretedOption_field_fullname protoreflect.FullName = "google.protobuf.MethodOptions.uninterpreted_option"
-)
-
-// Field numbers for google.protobuf.MethodOptions.
-const (
- MethodOptions_Deprecated_field_number protoreflect.FieldNumber = 33
- MethodOptions_IdempotencyLevel_field_number protoreflect.FieldNumber = 34
- MethodOptions_Features_field_number protoreflect.FieldNumber = 35
- MethodOptions_UninterpretedOption_field_number protoreflect.FieldNumber = 999
-)
-
-// Full and short names for google.protobuf.MethodOptions.IdempotencyLevel.
-const (
- MethodOptions_IdempotencyLevel_enum_fullname = "google.protobuf.MethodOptions.IdempotencyLevel"
- MethodOptions_IdempotencyLevel_enum_name = "IdempotencyLevel"
-)
-
-// Names for google.protobuf.UninterpretedOption.
-const (
- UninterpretedOption_message_name protoreflect.Name = "UninterpretedOption"
- UninterpretedOption_message_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption"
-)
-
-// Field names for google.protobuf.UninterpretedOption.
-const (
- UninterpretedOption_Name_field_name protoreflect.Name = "name"
- UninterpretedOption_IdentifierValue_field_name protoreflect.Name = "identifier_value"
- UninterpretedOption_PositiveIntValue_field_name protoreflect.Name = "positive_int_value"
- UninterpretedOption_NegativeIntValue_field_name protoreflect.Name = "negative_int_value"
- UninterpretedOption_DoubleValue_field_name protoreflect.Name = "double_value"
- UninterpretedOption_StringValue_field_name protoreflect.Name = "string_value"
- UninterpretedOption_AggregateValue_field_name protoreflect.Name = "aggregate_value"
-
- UninterpretedOption_Name_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.name"
- UninterpretedOption_IdentifierValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.identifier_value"
- UninterpretedOption_PositiveIntValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.positive_int_value"
- UninterpretedOption_NegativeIntValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.negative_int_value"
- UninterpretedOption_DoubleValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.double_value"
- UninterpretedOption_StringValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.string_value"
- UninterpretedOption_AggregateValue_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.aggregate_value"
-)
-
-// Field numbers for google.protobuf.UninterpretedOption.
-const (
- UninterpretedOption_Name_field_number protoreflect.FieldNumber = 2
- UninterpretedOption_IdentifierValue_field_number protoreflect.FieldNumber = 3
- UninterpretedOption_PositiveIntValue_field_number protoreflect.FieldNumber = 4
- UninterpretedOption_NegativeIntValue_field_number protoreflect.FieldNumber = 5
- UninterpretedOption_DoubleValue_field_number protoreflect.FieldNumber = 6
- UninterpretedOption_StringValue_field_number protoreflect.FieldNumber = 7
- UninterpretedOption_AggregateValue_field_number protoreflect.FieldNumber = 8
-)
-
-// Names for google.protobuf.UninterpretedOption.NamePart.
-const (
- UninterpretedOption_NamePart_message_name protoreflect.Name = "NamePart"
- UninterpretedOption_NamePart_message_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart"
-)
-
-// Field names for google.protobuf.UninterpretedOption.NamePart.
-const (
- UninterpretedOption_NamePart_NamePart_field_name protoreflect.Name = "name_part"
- UninterpretedOption_NamePart_IsExtension_field_name protoreflect.Name = "is_extension"
-
- UninterpretedOption_NamePart_NamePart_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart.name_part"
- UninterpretedOption_NamePart_IsExtension_field_fullname protoreflect.FullName = "google.protobuf.UninterpretedOption.NamePart.is_extension"
-)
-
-// Field numbers for google.protobuf.UninterpretedOption.NamePart.
-const (
- UninterpretedOption_NamePart_NamePart_field_number protoreflect.FieldNumber = 1
- UninterpretedOption_NamePart_IsExtension_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.FeatureSet.
-const (
- FeatureSet_message_name protoreflect.Name = "FeatureSet"
- FeatureSet_message_fullname protoreflect.FullName = "google.protobuf.FeatureSet"
-)
-
-// Field names for google.protobuf.FeatureSet.
-const (
- FeatureSet_FieldPresence_field_name protoreflect.Name = "field_presence"
- FeatureSet_EnumType_field_name protoreflect.Name = "enum_type"
- FeatureSet_RepeatedFieldEncoding_field_name protoreflect.Name = "repeated_field_encoding"
- FeatureSet_Utf8Validation_field_name protoreflect.Name = "utf8_validation"
- FeatureSet_MessageEncoding_field_name protoreflect.Name = "message_encoding"
- FeatureSet_JsonFormat_field_name protoreflect.Name = "json_format"
-
- FeatureSet_FieldPresence_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.field_presence"
- FeatureSet_EnumType_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.enum_type"
- FeatureSet_RepeatedFieldEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.repeated_field_encoding"
- FeatureSet_Utf8Validation_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.utf8_validation"
- FeatureSet_MessageEncoding_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.message_encoding"
- FeatureSet_JsonFormat_field_fullname protoreflect.FullName = "google.protobuf.FeatureSet.json_format"
-)
-
-// Field numbers for google.protobuf.FeatureSet.
-const (
- FeatureSet_FieldPresence_field_number protoreflect.FieldNumber = 1
- FeatureSet_EnumType_field_number protoreflect.FieldNumber = 2
- FeatureSet_RepeatedFieldEncoding_field_number protoreflect.FieldNumber = 3
- FeatureSet_Utf8Validation_field_number protoreflect.FieldNumber = 4
- FeatureSet_MessageEncoding_field_number protoreflect.FieldNumber = 5
- FeatureSet_JsonFormat_field_number protoreflect.FieldNumber = 6
-)
-
-// Full and short names for google.protobuf.FeatureSet.FieldPresence.
-const (
- FeatureSet_FieldPresence_enum_fullname = "google.protobuf.FeatureSet.FieldPresence"
- FeatureSet_FieldPresence_enum_name = "FieldPresence"
-)
-
-// Full and short names for google.protobuf.FeatureSet.EnumType.
-const (
- FeatureSet_EnumType_enum_fullname = "google.protobuf.FeatureSet.EnumType"
- FeatureSet_EnumType_enum_name = "EnumType"
-)
-
-// Full and short names for google.protobuf.FeatureSet.RepeatedFieldEncoding.
-const (
- FeatureSet_RepeatedFieldEncoding_enum_fullname = "google.protobuf.FeatureSet.RepeatedFieldEncoding"
- FeatureSet_RepeatedFieldEncoding_enum_name = "RepeatedFieldEncoding"
-)
-
-// Full and short names for google.protobuf.FeatureSet.Utf8Validation.
-const (
- FeatureSet_Utf8Validation_enum_fullname = "google.protobuf.FeatureSet.Utf8Validation"
- FeatureSet_Utf8Validation_enum_name = "Utf8Validation"
-)
-
-// Full and short names for google.protobuf.FeatureSet.MessageEncoding.
-const (
- FeatureSet_MessageEncoding_enum_fullname = "google.protobuf.FeatureSet.MessageEncoding"
- FeatureSet_MessageEncoding_enum_name = "MessageEncoding"
-)
-
-// Full and short names for google.protobuf.FeatureSet.JsonFormat.
-const (
- FeatureSet_JsonFormat_enum_fullname = "google.protobuf.FeatureSet.JsonFormat"
- FeatureSet_JsonFormat_enum_name = "JsonFormat"
-)
-
-// Names for google.protobuf.FeatureSetDefaults.
-const (
- FeatureSetDefaults_message_name protoreflect.Name = "FeatureSetDefaults"
- FeatureSetDefaults_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults"
-)
-
-// Field names for google.protobuf.FeatureSetDefaults.
-const (
- FeatureSetDefaults_Defaults_field_name protoreflect.Name = "defaults"
- FeatureSetDefaults_MinimumEdition_field_name protoreflect.Name = "minimum_edition"
- FeatureSetDefaults_MaximumEdition_field_name protoreflect.Name = "maximum_edition"
-
- FeatureSetDefaults_Defaults_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.defaults"
- FeatureSetDefaults_MinimumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.minimum_edition"
- FeatureSetDefaults_MaximumEdition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.maximum_edition"
-)
-
-// Field numbers for google.protobuf.FeatureSetDefaults.
-const (
- FeatureSetDefaults_Defaults_field_number protoreflect.FieldNumber = 1
- FeatureSetDefaults_MinimumEdition_field_number protoreflect.FieldNumber = 4
- FeatureSetDefaults_MaximumEdition_field_number protoreflect.FieldNumber = 5
-)
-
-// Names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
-const (
- FeatureSetDefaults_FeatureSetEditionDefault_message_name protoreflect.Name = "FeatureSetEditionDefault"
- FeatureSetDefaults_FeatureSetEditionDefault_message_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"
-)
-
-// Field names for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
-const (
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_name protoreflect.Name = "edition"
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_name protoreflect.Name = "features"
-
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.edition"
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_fullname protoreflect.FullName = "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features"
-)
-
-// Field numbers for google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.
-const (
- FeatureSetDefaults_FeatureSetEditionDefault_Edition_field_number protoreflect.FieldNumber = 3
- FeatureSetDefaults_FeatureSetEditionDefault_Features_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.SourceCodeInfo.
-const (
- SourceCodeInfo_message_name protoreflect.Name = "SourceCodeInfo"
- SourceCodeInfo_message_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo"
-)
-
-// Field names for google.protobuf.SourceCodeInfo.
-const (
- SourceCodeInfo_Location_field_name protoreflect.Name = "location"
-
- SourceCodeInfo_Location_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.location"
-)
-
-// Field numbers for google.protobuf.SourceCodeInfo.
-const (
- SourceCodeInfo_Location_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.SourceCodeInfo.Location.
-const (
- SourceCodeInfo_Location_message_name protoreflect.Name = "Location"
- SourceCodeInfo_Location_message_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location"
-)
-
-// Field names for google.protobuf.SourceCodeInfo.Location.
-const (
- SourceCodeInfo_Location_Path_field_name protoreflect.Name = "path"
- SourceCodeInfo_Location_Span_field_name protoreflect.Name = "span"
- SourceCodeInfo_Location_LeadingComments_field_name protoreflect.Name = "leading_comments"
- SourceCodeInfo_Location_TrailingComments_field_name protoreflect.Name = "trailing_comments"
- SourceCodeInfo_Location_LeadingDetachedComments_field_name protoreflect.Name = "leading_detached_comments"
-
- SourceCodeInfo_Location_Path_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.path"
- SourceCodeInfo_Location_Span_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.span"
- SourceCodeInfo_Location_LeadingComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.leading_comments"
- SourceCodeInfo_Location_TrailingComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.trailing_comments"
- SourceCodeInfo_Location_LeadingDetachedComments_field_fullname protoreflect.FullName = "google.protobuf.SourceCodeInfo.Location.leading_detached_comments"
-)
-
-// Field numbers for google.protobuf.SourceCodeInfo.Location.
-const (
- SourceCodeInfo_Location_Path_field_number protoreflect.FieldNumber = 1
- SourceCodeInfo_Location_Span_field_number protoreflect.FieldNumber = 2
- SourceCodeInfo_Location_LeadingComments_field_number protoreflect.FieldNumber = 3
- SourceCodeInfo_Location_TrailingComments_field_number protoreflect.FieldNumber = 4
- SourceCodeInfo_Location_LeadingDetachedComments_field_number protoreflect.FieldNumber = 6
-)
-
-// Names for google.protobuf.GeneratedCodeInfo.
-const (
- GeneratedCodeInfo_message_name protoreflect.Name = "GeneratedCodeInfo"
- GeneratedCodeInfo_message_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo"
-)
-
-// Field names for google.protobuf.GeneratedCodeInfo.
-const (
- GeneratedCodeInfo_Annotation_field_name protoreflect.Name = "annotation"
-
- GeneratedCodeInfo_Annotation_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.annotation"
-)
-
-// Field numbers for google.protobuf.GeneratedCodeInfo.
-const (
- GeneratedCodeInfo_Annotation_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.GeneratedCodeInfo.Annotation.
-const (
- GeneratedCodeInfo_Annotation_message_name protoreflect.Name = "Annotation"
- GeneratedCodeInfo_Annotation_message_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation"
-)
-
-// Field names for google.protobuf.GeneratedCodeInfo.Annotation.
-const (
- GeneratedCodeInfo_Annotation_Path_field_name protoreflect.Name = "path"
- GeneratedCodeInfo_Annotation_SourceFile_field_name protoreflect.Name = "source_file"
- GeneratedCodeInfo_Annotation_Begin_field_name protoreflect.Name = "begin"
- GeneratedCodeInfo_Annotation_End_field_name protoreflect.Name = "end"
- GeneratedCodeInfo_Annotation_Semantic_field_name protoreflect.Name = "semantic"
-
- GeneratedCodeInfo_Annotation_Path_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.path"
- GeneratedCodeInfo_Annotation_SourceFile_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.source_file"
- GeneratedCodeInfo_Annotation_Begin_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.begin"
- GeneratedCodeInfo_Annotation_End_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.end"
- GeneratedCodeInfo_Annotation_Semantic_field_fullname protoreflect.FullName = "google.protobuf.GeneratedCodeInfo.Annotation.semantic"
-)
-
-// Field numbers for google.protobuf.GeneratedCodeInfo.Annotation.
-const (
- GeneratedCodeInfo_Annotation_Path_field_number protoreflect.FieldNumber = 1
- GeneratedCodeInfo_Annotation_SourceFile_field_number protoreflect.FieldNumber = 2
- GeneratedCodeInfo_Annotation_Begin_field_number protoreflect.FieldNumber = 3
- GeneratedCodeInfo_Annotation_End_field_number protoreflect.FieldNumber = 4
- GeneratedCodeInfo_Annotation_Semantic_field_number protoreflect.FieldNumber = 5
-)
-
-// Full and short names for google.protobuf.GeneratedCodeInfo.Annotation.Semantic.
-const (
- GeneratedCodeInfo_Annotation_Semantic_enum_fullname = "google.protobuf.GeneratedCodeInfo.Annotation.Semantic"
- GeneratedCodeInfo_Annotation_Semantic_enum_name = "Semantic"
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/doc.go b/vendor/google.golang.org/protobuf/internal/genid/doc.go
deleted file mode 100644
index 45ccd01..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/doc.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// 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.
-
-// Package genid contains constants for declarations in descriptor.proto
-// and the well-known types.
-package genid
-
-import protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
-const GoogleProtobuf_package protoreflect.FullName = "google.protobuf"
diff --git a/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go b/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go
deleted file mode 100644
index b070ef4..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_duration_proto = "google/protobuf/duration.proto"
-
-// Names for google.protobuf.Duration.
-const (
- Duration_message_name protoreflect.Name = "Duration"
- Duration_message_fullname protoreflect.FullName = "google.protobuf.Duration"
-)
-
-// Field names for google.protobuf.Duration.
-const (
- Duration_Seconds_field_name protoreflect.Name = "seconds"
- Duration_Nanos_field_name protoreflect.Name = "nanos"
-
- Duration_Seconds_field_fullname protoreflect.FullName = "google.protobuf.Duration.seconds"
- Duration_Nanos_field_fullname protoreflect.FullName = "google.protobuf.Duration.nanos"
-)
-
-// Field numbers for google.protobuf.Duration.
-const (
- Duration_Seconds_field_number protoreflect.FieldNumber = 1
- Duration_Nanos_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go b/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go
deleted file mode 100644
index 762abb3..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_empty_proto = "google/protobuf/empty.proto"
-
-// Names for google.protobuf.Empty.
-const (
- Empty_message_name protoreflect.Name = "Empty"
- Empty_message_fullname protoreflect.FullName = "google.protobuf.Empty"
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go b/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go
deleted file mode 100644
index 70bed45..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_field_mask_proto = "google/protobuf/field_mask.proto"
-
-// Names for google.protobuf.FieldMask.
-const (
- FieldMask_message_name protoreflect.Name = "FieldMask"
- FieldMask_message_fullname protoreflect.FullName = "google.protobuf.FieldMask"
-)
-
-// Field names for google.protobuf.FieldMask.
-const (
- FieldMask_Paths_field_name protoreflect.Name = "paths"
-
- FieldMask_Paths_field_fullname protoreflect.FullName = "google.protobuf.FieldMask.paths"
-)
-
-// Field numbers for google.protobuf.FieldMask.
-const (
- FieldMask_Paths_field_number protoreflect.FieldNumber = 1
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/goname.go b/vendor/google.golang.org/protobuf/internal/genid/goname.go
deleted file mode 100644
index 693d2e9..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/goname.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-package genid
-
-// Go names of implementation-specific struct fields in generated messages.
-const (
- State_goname = "state"
-
- SizeCache_goname = "sizeCache"
- SizeCacheA_goname = "XXX_sizecache"
-
- WeakFields_goname = "weakFields"
- WeakFieldsA_goname = "XXX_weak"
-
- UnknownFields_goname = "unknownFields"
- UnknownFieldsA_goname = "XXX_unrecognized"
-
- ExtensionFields_goname = "extensionFields"
- ExtensionFieldsA_goname = "XXX_InternalExtensions"
- ExtensionFieldsB_goname = "XXX_extensions"
-
- WeakFieldPrefix_goname = "XXX_weak_"
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go b/vendor/google.golang.org/protobuf/internal/genid/map_entry.go
deleted file mode 100644
index 8f9ea02..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/map_entry.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-package genid
-
-import protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
-// Generic field names and numbers for synthetic map entry messages.
-const (
- MapEntry_Key_field_name protoreflect.Name = "key"
- MapEntry_Value_field_name protoreflect.Name = "value"
-
- MapEntry_Key_field_number protoreflect.FieldNumber = 1
- MapEntry_Value_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go b/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go
deleted file mode 100644
index 3e99ae1..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_source_context_proto = "google/protobuf/source_context.proto"
-
-// Names for google.protobuf.SourceContext.
-const (
- SourceContext_message_name protoreflect.Name = "SourceContext"
- SourceContext_message_fullname protoreflect.FullName = "google.protobuf.SourceContext"
-)
-
-// Field names for google.protobuf.SourceContext.
-const (
- SourceContext_FileName_field_name protoreflect.Name = "file_name"
-
- SourceContext_FileName_field_fullname protoreflect.FullName = "google.protobuf.SourceContext.file_name"
-)
-
-// Field numbers for google.protobuf.SourceContext.
-const (
- SourceContext_FileName_field_number protoreflect.FieldNumber = 1
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go b/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go
deleted file mode 100644
index 1a38944..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_struct_proto = "google/protobuf/struct.proto"
-
-// Full and short names for google.protobuf.NullValue.
-const (
- NullValue_enum_fullname = "google.protobuf.NullValue"
- NullValue_enum_name = "NullValue"
-)
-
-// Names for google.protobuf.Struct.
-const (
- Struct_message_name protoreflect.Name = "Struct"
- Struct_message_fullname protoreflect.FullName = "google.protobuf.Struct"
-)
-
-// Field names for google.protobuf.Struct.
-const (
- Struct_Fields_field_name protoreflect.Name = "fields"
-
- Struct_Fields_field_fullname protoreflect.FullName = "google.protobuf.Struct.fields"
-)
-
-// Field numbers for google.protobuf.Struct.
-const (
- Struct_Fields_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.Struct.FieldsEntry.
-const (
- Struct_FieldsEntry_message_name protoreflect.Name = "FieldsEntry"
- Struct_FieldsEntry_message_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry"
-)
-
-// Field names for google.protobuf.Struct.FieldsEntry.
-const (
- Struct_FieldsEntry_Key_field_name protoreflect.Name = "key"
- Struct_FieldsEntry_Value_field_name protoreflect.Name = "value"
-
- Struct_FieldsEntry_Key_field_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry.key"
- Struct_FieldsEntry_Value_field_fullname protoreflect.FullName = "google.protobuf.Struct.FieldsEntry.value"
-)
-
-// Field numbers for google.protobuf.Struct.FieldsEntry.
-const (
- Struct_FieldsEntry_Key_field_number protoreflect.FieldNumber = 1
- Struct_FieldsEntry_Value_field_number protoreflect.FieldNumber = 2
-)
-
-// Names for google.protobuf.Value.
-const (
- Value_message_name protoreflect.Name = "Value"
- Value_message_fullname protoreflect.FullName = "google.protobuf.Value"
-)
-
-// Field names for google.protobuf.Value.
-const (
- Value_NullValue_field_name protoreflect.Name = "null_value"
- Value_NumberValue_field_name protoreflect.Name = "number_value"
- Value_StringValue_field_name protoreflect.Name = "string_value"
- Value_BoolValue_field_name protoreflect.Name = "bool_value"
- Value_StructValue_field_name protoreflect.Name = "struct_value"
- Value_ListValue_field_name protoreflect.Name = "list_value"
-
- Value_NullValue_field_fullname protoreflect.FullName = "google.protobuf.Value.null_value"
- Value_NumberValue_field_fullname protoreflect.FullName = "google.protobuf.Value.number_value"
- Value_StringValue_field_fullname protoreflect.FullName = "google.protobuf.Value.string_value"
- Value_BoolValue_field_fullname protoreflect.FullName = "google.protobuf.Value.bool_value"
- Value_StructValue_field_fullname protoreflect.FullName = "google.protobuf.Value.struct_value"
- Value_ListValue_field_fullname protoreflect.FullName = "google.protobuf.Value.list_value"
-)
-
-// Field numbers for google.protobuf.Value.
-const (
- Value_NullValue_field_number protoreflect.FieldNumber = 1
- Value_NumberValue_field_number protoreflect.FieldNumber = 2
- Value_StringValue_field_number protoreflect.FieldNumber = 3
- Value_BoolValue_field_number protoreflect.FieldNumber = 4
- Value_StructValue_field_number protoreflect.FieldNumber = 5
- Value_ListValue_field_number protoreflect.FieldNumber = 6
-)
-
-// Oneof names for google.protobuf.Value.
-const (
- Value_Kind_oneof_name protoreflect.Name = "kind"
-
- Value_Kind_oneof_fullname protoreflect.FullName = "google.protobuf.Value.kind"
-)
-
-// Names for google.protobuf.ListValue.
-const (
- ListValue_message_name protoreflect.Name = "ListValue"
- ListValue_message_fullname protoreflect.FullName = "google.protobuf.ListValue"
-)
-
-// Field names for google.protobuf.ListValue.
-const (
- ListValue_Values_field_name protoreflect.Name = "values"
-
- ListValue_Values_field_fullname protoreflect.FullName = "google.protobuf.ListValue.values"
-)
-
-// Field numbers for google.protobuf.ListValue.
-const (
- ListValue_Values_field_number protoreflect.FieldNumber = 1
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go b/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go
deleted file mode 100644
index f5cd563..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_timestamp_proto = "google/protobuf/timestamp.proto"
-
-// Names for google.protobuf.Timestamp.
-const (
- Timestamp_message_name protoreflect.Name = "Timestamp"
- Timestamp_message_fullname protoreflect.FullName = "google.protobuf.Timestamp"
-)
-
-// Field names for google.protobuf.Timestamp.
-const (
- Timestamp_Seconds_field_name protoreflect.Name = "seconds"
- Timestamp_Nanos_field_name protoreflect.Name = "nanos"
-
- Timestamp_Seconds_field_fullname protoreflect.FullName = "google.protobuf.Timestamp.seconds"
- Timestamp_Nanos_field_fullname protoreflect.FullName = "google.protobuf.Timestamp.nanos"
-)
-
-// Field numbers for google.protobuf.Timestamp.
-const (
- Timestamp_Seconds_field_number protoreflect.FieldNumber = 1
- Timestamp_Nanos_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go b/vendor/google.golang.org/protobuf/internal/genid/type_gen.go
deleted file mode 100644
index e0f75fe..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/type_gen.go
+++ /dev/null
@@ -1,190 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_type_proto = "google/protobuf/type.proto"
-
-// Full and short names for google.protobuf.Syntax.
-const (
- Syntax_enum_fullname = "google.protobuf.Syntax"
- Syntax_enum_name = "Syntax"
-)
-
-// Names for google.protobuf.Type.
-const (
- Type_message_name protoreflect.Name = "Type"
- Type_message_fullname protoreflect.FullName = "google.protobuf.Type"
-)
-
-// Field names for google.protobuf.Type.
-const (
- Type_Name_field_name protoreflect.Name = "name"
- Type_Fields_field_name protoreflect.Name = "fields"
- Type_Oneofs_field_name protoreflect.Name = "oneofs"
- Type_Options_field_name protoreflect.Name = "options"
- Type_SourceContext_field_name protoreflect.Name = "source_context"
- Type_Syntax_field_name protoreflect.Name = "syntax"
- Type_Edition_field_name protoreflect.Name = "edition"
-
- Type_Name_field_fullname protoreflect.FullName = "google.protobuf.Type.name"
- Type_Fields_field_fullname protoreflect.FullName = "google.protobuf.Type.fields"
- Type_Oneofs_field_fullname protoreflect.FullName = "google.protobuf.Type.oneofs"
- Type_Options_field_fullname protoreflect.FullName = "google.protobuf.Type.options"
- Type_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Type.source_context"
- Type_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Type.syntax"
- Type_Edition_field_fullname protoreflect.FullName = "google.protobuf.Type.edition"
-)
-
-// Field numbers for google.protobuf.Type.
-const (
- Type_Name_field_number protoreflect.FieldNumber = 1
- Type_Fields_field_number protoreflect.FieldNumber = 2
- Type_Oneofs_field_number protoreflect.FieldNumber = 3
- Type_Options_field_number protoreflect.FieldNumber = 4
- Type_SourceContext_field_number protoreflect.FieldNumber = 5
- Type_Syntax_field_number protoreflect.FieldNumber = 6
- Type_Edition_field_number protoreflect.FieldNumber = 7
-)
-
-// Names for google.protobuf.Field.
-const (
- Field_message_name protoreflect.Name = "Field"
- Field_message_fullname protoreflect.FullName = "google.protobuf.Field"
-)
-
-// Field names for google.protobuf.Field.
-const (
- Field_Kind_field_name protoreflect.Name = "kind"
- Field_Cardinality_field_name protoreflect.Name = "cardinality"
- Field_Number_field_name protoreflect.Name = "number"
- Field_Name_field_name protoreflect.Name = "name"
- Field_TypeUrl_field_name protoreflect.Name = "type_url"
- Field_OneofIndex_field_name protoreflect.Name = "oneof_index"
- Field_Packed_field_name protoreflect.Name = "packed"
- Field_Options_field_name protoreflect.Name = "options"
- Field_JsonName_field_name protoreflect.Name = "json_name"
- Field_DefaultValue_field_name protoreflect.Name = "default_value"
-
- Field_Kind_field_fullname protoreflect.FullName = "google.protobuf.Field.kind"
- Field_Cardinality_field_fullname protoreflect.FullName = "google.protobuf.Field.cardinality"
- Field_Number_field_fullname protoreflect.FullName = "google.protobuf.Field.number"
- Field_Name_field_fullname protoreflect.FullName = "google.protobuf.Field.name"
- Field_TypeUrl_field_fullname protoreflect.FullName = "google.protobuf.Field.type_url"
- Field_OneofIndex_field_fullname protoreflect.FullName = "google.protobuf.Field.oneof_index"
- Field_Packed_field_fullname protoreflect.FullName = "google.protobuf.Field.packed"
- Field_Options_field_fullname protoreflect.FullName = "google.protobuf.Field.options"
- Field_JsonName_field_fullname protoreflect.FullName = "google.protobuf.Field.json_name"
- Field_DefaultValue_field_fullname protoreflect.FullName = "google.protobuf.Field.default_value"
-)
-
-// Field numbers for google.protobuf.Field.
-const (
- Field_Kind_field_number protoreflect.FieldNumber = 1
- Field_Cardinality_field_number protoreflect.FieldNumber = 2
- Field_Number_field_number protoreflect.FieldNumber = 3
- Field_Name_field_number protoreflect.FieldNumber = 4
- Field_TypeUrl_field_number protoreflect.FieldNumber = 6
- Field_OneofIndex_field_number protoreflect.FieldNumber = 7
- Field_Packed_field_number protoreflect.FieldNumber = 8
- Field_Options_field_number protoreflect.FieldNumber = 9
- Field_JsonName_field_number protoreflect.FieldNumber = 10
- Field_DefaultValue_field_number protoreflect.FieldNumber = 11
-)
-
-// Full and short names for google.protobuf.Field.Kind.
-const (
- Field_Kind_enum_fullname = "google.protobuf.Field.Kind"
- Field_Kind_enum_name = "Kind"
-)
-
-// Full and short names for google.protobuf.Field.Cardinality.
-const (
- Field_Cardinality_enum_fullname = "google.protobuf.Field.Cardinality"
- Field_Cardinality_enum_name = "Cardinality"
-)
-
-// Names for google.protobuf.Enum.
-const (
- Enum_message_name protoreflect.Name = "Enum"
- Enum_message_fullname protoreflect.FullName = "google.protobuf.Enum"
-)
-
-// Field names for google.protobuf.Enum.
-const (
- Enum_Name_field_name protoreflect.Name = "name"
- Enum_Enumvalue_field_name protoreflect.Name = "enumvalue"
- Enum_Options_field_name protoreflect.Name = "options"
- Enum_SourceContext_field_name protoreflect.Name = "source_context"
- Enum_Syntax_field_name protoreflect.Name = "syntax"
- Enum_Edition_field_name protoreflect.Name = "edition"
-
- Enum_Name_field_fullname protoreflect.FullName = "google.protobuf.Enum.name"
- Enum_Enumvalue_field_fullname protoreflect.FullName = "google.protobuf.Enum.enumvalue"
- Enum_Options_field_fullname protoreflect.FullName = "google.protobuf.Enum.options"
- Enum_SourceContext_field_fullname protoreflect.FullName = "google.protobuf.Enum.source_context"
- Enum_Syntax_field_fullname protoreflect.FullName = "google.protobuf.Enum.syntax"
- Enum_Edition_field_fullname protoreflect.FullName = "google.protobuf.Enum.edition"
-)
-
-// Field numbers for google.protobuf.Enum.
-const (
- Enum_Name_field_number protoreflect.FieldNumber = 1
- Enum_Enumvalue_field_number protoreflect.FieldNumber = 2
- Enum_Options_field_number protoreflect.FieldNumber = 3
- Enum_SourceContext_field_number protoreflect.FieldNumber = 4
- Enum_Syntax_field_number protoreflect.FieldNumber = 5
- Enum_Edition_field_number protoreflect.FieldNumber = 6
-)
-
-// Names for google.protobuf.EnumValue.
-const (
- EnumValue_message_name protoreflect.Name = "EnumValue"
- EnumValue_message_fullname protoreflect.FullName = "google.protobuf.EnumValue"
-)
-
-// Field names for google.protobuf.EnumValue.
-const (
- EnumValue_Name_field_name protoreflect.Name = "name"
- EnumValue_Number_field_name protoreflect.Name = "number"
- EnumValue_Options_field_name protoreflect.Name = "options"
-
- EnumValue_Name_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.name"
- EnumValue_Number_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.number"
- EnumValue_Options_field_fullname protoreflect.FullName = "google.protobuf.EnumValue.options"
-)
-
-// Field numbers for google.protobuf.EnumValue.
-const (
- EnumValue_Name_field_number protoreflect.FieldNumber = 1
- EnumValue_Number_field_number protoreflect.FieldNumber = 2
- EnumValue_Options_field_number protoreflect.FieldNumber = 3
-)
-
-// Names for google.protobuf.Option.
-const (
- Option_message_name protoreflect.Name = "Option"
- Option_message_fullname protoreflect.FullName = "google.protobuf.Option"
-)
-
-// Field names for google.protobuf.Option.
-const (
- Option_Name_field_name protoreflect.Name = "name"
- Option_Value_field_name protoreflect.Name = "value"
-
- Option_Name_field_fullname protoreflect.FullName = "google.protobuf.Option.name"
- Option_Value_field_fullname protoreflect.FullName = "google.protobuf.Option.value"
-)
-
-// Field numbers for google.protobuf.Option.
-const (
- Option_Name_field_number protoreflect.FieldNumber = 1
- Option_Value_field_number protoreflect.FieldNumber = 2
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers.go
deleted file mode 100644
index 429384b..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/wrappers.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-package genid
-
-import protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-
-// Generic field name and number for messages in wrappers.proto.
-const (
- WrapperValue_Value_field_name protoreflect.Name = "value"
- WrapperValue_Value_field_number protoreflect.FieldNumber = 1
-)
diff --git a/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go b/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go
deleted file mode 100644
index 72527d2..0000000
--- a/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// 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 genid
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-const File_google_protobuf_wrappers_proto = "google/protobuf/wrappers.proto"
-
-// Names for google.protobuf.DoubleValue.
-const (
- DoubleValue_message_name protoreflect.Name = "DoubleValue"
- DoubleValue_message_fullname protoreflect.FullName = "google.protobuf.DoubleValue"
-)
-
-// Field names for google.protobuf.DoubleValue.
-const (
- DoubleValue_Value_field_name protoreflect.Name = "value"
-
- DoubleValue_Value_field_fullname protoreflect.FullName = "google.protobuf.DoubleValue.value"
-)
-
-// Field numbers for google.protobuf.DoubleValue.
-const (
- DoubleValue_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.FloatValue.
-const (
- FloatValue_message_name protoreflect.Name = "FloatValue"
- FloatValue_message_fullname protoreflect.FullName = "google.protobuf.FloatValue"
-)
-
-// Field names for google.protobuf.FloatValue.
-const (
- FloatValue_Value_field_name protoreflect.Name = "value"
-
- FloatValue_Value_field_fullname protoreflect.FullName = "google.protobuf.FloatValue.value"
-)
-
-// Field numbers for google.protobuf.FloatValue.
-const (
- FloatValue_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.Int64Value.
-const (
- Int64Value_message_name protoreflect.Name = "Int64Value"
- Int64Value_message_fullname protoreflect.FullName = "google.protobuf.Int64Value"
-)
-
-// Field names for google.protobuf.Int64Value.
-const (
- Int64Value_Value_field_name protoreflect.Name = "value"
-
- Int64Value_Value_field_fullname protoreflect.FullName = "google.protobuf.Int64Value.value"
-)
-
-// Field numbers for google.protobuf.Int64Value.
-const (
- Int64Value_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.UInt64Value.
-const (
- UInt64Value_message_name protoreflect.Name = "UInt64Value"
- UInt64Value_message_fullname protoreflect.FullName = "google.protobuf.UInt64Value"
-)
-
-// Field names for google.protobuf.UInt64Value.
-const (
- UInt64Value_Value_field_name protoreflect.Name = "value"
-
- UInt64Value_Value_field_fullname protoreflect.FullName = "google.protobuf.UInt64Value.value"
-)
-
-// Field numbers for google.protobuf.UInt64Value.
-const (
- UInt64Value_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.Int32Value.
-const (
- Int32Value_message_name protoreflect.Name = "Int32Value"
- Int32Value_message_fullname protoreflect.FullName = "google.protobuf.Int32Value"
-)
-
-// Field names for google.protobuf.Int32Value.
-const (
- Int32Value_Value_field_name protoreflect.Name = "value"
-
- Int32Value_Value_field_fullname protoreflect.FullName = "google.protobuf.Int32Value.value"
-)
-
-// Field numbers for google.protobuf.Int32Value.
-const (
- Int32Value_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.UInt32Value.
-const (
- UInt32Value_message_name protoreflect.Name = "UInt32Value"
- UInt32Value_message_fullname protoreflect.FullName = "google.protobuf.UInt32Value"
-)
-
-// Field names for google.protobuf.UInt32Value.
-const (
- UInt32Value_Value_field_name protoreflect.Name = "value"
-
- UInt32Value_Value_field_fullname protoreflect.FullName = "google.protobuf.UInt32Value.value"
-)
-
-// Field numbers for google.protobuf.UInt32Value.
-const (
- UInt32Value_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.BoolValue.
-const (
- BoolValue_message_name protoreflect.Name = "BoolValue"
- BoolValue_message_fullname protoreflect.FullName = "google.protobuf.BoolValue"
-)
-
-// Field names for google.protobuf.BoolValue.
-const (
- BoolValue_Value_field_name protoreflect.Name = "value"
-
- BoolValue_Value_field_fullname protoreflect.FullName = "google.protobuf.BoolValue.value"
-)
-
-// Field numbers for google.protobuf.BoolValue.
-const (
- BoolValue_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.StringValue.
-const (
- StringValue_message_name protoreflect.Name = "StringValue"
- StringValue_message_fullname protoreflect.FullName = "google.protobuf.StringValue"
-)
-
-// Field names for google.protobuf.StringValue.
-const (
- StringValue_Value_field_name protoreflect.Name = "value"
-
- StringValue_Value_field_fullname protoreflect.FullName = "google.protobuf.StringValue.value"
-)
-
-// Field numbers for google.protobuf.StringValue.
-const (
- StringValue_Value_field_number protoreflect.FieldNumber = 1
-)
-
-// Names for google.protobuf.BytesValue.
-const (
- BytesValue_message_name protoreflect.Name = "BytesValue"
- BytesValue_message_fullname protoreflect.FullName = "google.protobuf.BytesValue"
-)
-
-// Field names for google.protobuf.BytesValue.
-const (
- BytesValue_Value_field_name protoreflect.Name = "value"
-
- BytesValue_Value_field_fullname protoreflect.FullName = "google.protobuf.BytesValue.value"
-)
-
-// Field numbers for google.protobuf.BytesValue.
-const (
- BytesValue_Value_field_number protoreflect.FieldNumber = 1
-)
diff --git a/vendor/google.golang.org/protobuf/internal/impl/api_export.go b/vendor/google.golang.org/protobuf/internal/impl/api_export.go
deleted file mode 100644
index a371f98..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/api_export.go
+++ /dev/null
@@ -1,177 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "strconv"
-
- "google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// Export is a zero-length named type that exists only to export a set of
-// functions that we do not want to appear in godoc.
-type Export struct{}
-
-// NewError formats a string according to the format specifier and arguments and
-// returns an error that has a "proto" prefix.
-func (Export) NewError(f string, x ...interface{}) error {
- return errors.New(f, x...)
-}
-
-// enum is any enum type generated by protoc-gen-go
-// and must be a named int32 type.
-type enum = interface{}
-
-// EnumOf returns the protoreflect.Enum interface over e.
-// It returns nil if e is nil.
-func (Export) EnumOf(e enum) protoreflect.Enum {
- switch e := e.(type) {
- case nil:
- return nil
- case protoreflect.Enum:
- return e
- default:
- return legacyWrapEnum(reflect.ValueOf(e))
- }
-}
-
-// EnumDescriptorOf returns the protoreflect.EnumDescriptor for e.
-// It returns nil if e is nil.
-func (Export) EnumDescriptorOf(e enum) protoreflect.EnumDescriptor {
- switch e := e.(type) {
- case nil:
- return nil
- case protoreflect.Enum:
- return e.Descriptor()
- default:
- return LegacyLoadEnumDesc(reflect.TypeOf(e))
- }
-}
-
-// EnumTypeOf returns the protoreflect.EnumType for e.
-// It returns nil if e is nil.
-func (Export) EnumTypeOf(e enum) protoreflect.EnumType {
- switch e := e.(type) {
- case nil:
- return nil
- case protoreflect.Enum:
- return e.Type()
- default:
- return legacyLoadEnumType(reflect.TypeOf(e))
- }
-}
-
-// EnumStringOf returns the enum value as a string, either as the name if
-// the number is resolvable, or the number formatted as a string.
-func (Export) EnumStringOf(ed protoreflect.EnumDescriptor, n protoreflect.EnumNumber) string {
- ev := ed.Values().ByNumber(n)
- if ev != nil {
- return string(ev.Name())
- }
- return strconv.Itoa(int(n))
-}
-
-// message is any message type generated by protoc-gen-go
-// and must be a pointer to a named struct type.
-type message = interface{}
-
-// legacyMessageWrapper wraps a v2 message as a v1 message.
-type legacyMessageWrapper struct{ m protoreflect.ProtoMessage }
-
-func (m legacyMessageWrapper) Reset() { proto.Reset(m.m) }
-func (m legacyMessageWrapper) String() string { return Export{}.MessageStringOf(m.m) }
-func (m legacyMessageWrapper) ProtoMessage() {}
-
-// ProtoMessageV1Of converts either a v1 or v2 message to a v1 message.
-// It returns nil if m is nil.
-func (Export) ProtoMessageV1Of(m message) protoiface.MessageV1 {
- switch mv := m.(type) {
- case nil:
- return nil
- case protoiface.MessageV1:
- return mv
- case unwrapper:
- return Export{}.ProtoMessageV1Of(mv.protoUnwrap())
- case protoreflect.ProtoMessage:
- return legacyMessageWrapper{mv}
- default:
- panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
- }
-}
-
-func (Export) protoMessageV2Of(m message) protoreflect.ProtoMessage {
- switch mv := m.(type) {
- case nil:
- return nil
- case protoreflect.ProtoMessage:
- return mv
- case legacyMessageWrapper:
- return mv.m
- case protoiface.MessageV1:
- return nil
- default:
- panic(fmt.Sprintf("message %T is neither a v1 or v2 Message", m))
- }
-}
-
-// ProtoMessageV2Of converts either a v1 or v2 message to a v2 message.
-// It returns nil if m is nil.
-func (Export) ProtoMessageV2Of(m message) protoreflect.ProtoMessage {
- if m == nil {
- return nil
- }
- if mv := (Export{}).protoMessageV2Of(m); mv != nil {
- return mv
- }
- return legacyWrapMessage(reflect.ValueOf(m)).Interface()
-}
-
-// MessageOf returns the protoreflect.Message interface over m.
-// It returns nil if m is nil.
-func (Export) MessageOf(m message) protoreflect.Message {
- if m == nil {
- return nil
- }
- if mv := (Export{}).protoMessageV2Of(m); mv != nil {
- return mv.ProtoReflect()
- }
- return legacyWrapMessage(reflect.ValueOf(m))
-}
-
-// MessageDescriptorOf returns the protoreflect.MessageDescriptor for m.
-// It returns nil if m is nil.
-func (Export) MessageDescriptorOf(m message) protoreflect.MessageDescriptor {
- if m == nil {
- return nil
- }
- if mv := (Export{}).protoMessageV2Of(m); mv != nil {
- return mv.ProtoReflect().Descriptor()
- }
- return LegacyLoadMessageDesc(reflect.TypeOf(m))
-}
-
-// MessageTypeOf returns the protoreflect.MessageType for m.
-// It returns nil if m is nil.
-func (Export) MessageTypeOf(m message) protoreflect.MessageType {
- if m == nil {
- return nil
- }
- if mv := (Export{}).protoMessageV2Of(m); mv != nil {
- return mv.ProtoReflect().Type()
- }
- return legacyLoadMessageType(reflect.TypeOf(m), "")
-}
-
-// MessageStringOf returns the message value as a string,
-// which is the message serialized in the protobuf text format.
-func (Export) MessageStringOf(m protoreflect.ProtoMessage) string {
- return prototext.MarshalOptions{Multiline: false}.Format(m)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go b/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
deleted file mode 100644
index bff041e..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/checkinit.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "sync"
-
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-func (mi *MessageInfo) checkInitialized(in protoiface.CheckInitializedInput) (protoiface.CheckInitializedOutput, error) {
- var p pointer
- if ms, ok := in.Message.(*messageState); ok {
- p = ms.pointer()
- } else {
- p = in.Message.(*messageReflectWrapper).pointer()
- }
- return protoiface.CheckInitializedOutput{}, mi.checkInitializedPointer(p)
-}
-
-func (mi *MessageInfo) checkInitializedPointer(p pointer) error {
- mi.init()
- if !mi.needsInitCheck {
- return nil
- }
- if p.IsNil() {
- for _, f := range mi.orderedCoderFields {
- if f.isRequired {
- return errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))
- }
- }
- return nil
- }
- if mi.extensionOffset.IsValid() {
- e := p.Apply(mi.extensionOffset).Extensions()
- if err := mi.isInitExtensions(e); err != nil {
- return err
- }
- }
- for _, f := range mi.orderedCoderFields {
- if !f.isRequired && f.funcs.isInit == nil {
- continue
- }
- fptr := p.Apply(f.offset)
- if f.isPointer && fptr.Elem().IsNil() {
- if f.isRequired {
- return errors.RequiredNotSet(string(mi.Desc.Fields().ByNumber(f.num).FullName()))
- }
- continue
- }
- if f.funcs.isInit == nil {
- continue
- }
- if err := f.funcs.isInit(fptr, f); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (mi *MessageInfo) isInitExtensions(ext *map[int32]ExtensionField) error {
- if ext == nil {
- return nil
- }
- for _, x := range *ext {
- ei := getExtensionFieldInfo(x.Type())
- if ei.funcs.isInit == nil {
- continue
- }
- v := x.Value()
- if !v.IsValid() {
- continue
- }
- if err := ei.funcs.isInit(v); err != nil {
- return err
- }
- }
- return nil
-}
-
-var (
- needsInitCheckMu sync.Mutex
- needsInitCheckMap sync.Map
-)
-
-// needsInitCheck reports whether a message needs to be checked for partial initialization.
-//
-// It returns true if the message transitively includes any required or extension fields.
-func needsInitCheck(md protoreflect.MessageDescriptor) bool {
- if v, ok := needsInitCheckMap.Load(md); ok {
- if has, ok := v.(bool); ok {
- return has
- }
- }
- needsInitCheckMu.Lock()
- defer needsInitCheckMu.Unlock()
- return needsInitCheckLocked(md)
-}
-
-func needsInitCheckLocked(md protoreflect.MessageDescriptor) (has bool) {
- if v, ok := needsInitCheckMap.Load(md); ok {
- // If has is true, we've previously determined that this message
- // needs init checks.
- //
- // If has is false, we've previously determined that it can never
- // be uninitialized.
- //
- // If has is not a bool, we've just encountered a cycle in the
- // message graph. In this case, it is safe to return false: If
- // the message does have required fields, we'll detect them later
- // in the graph traversal.
- has, ok := v.(bool)
- return ok && has
- }
- needsInitCheckMap.Store(md, struct{}{}) // avoid cycles while descending into this message
- defer func() {
- needsInitCheckMap.Store(md, has)
- }()
- if md.RequiredNumbers().Len() > 0 {
- return true
- }
- if md.ExtensionRanges().Len() > 0 {
- return true
- }
- for i := 0; i < md.Fields().Len(); i++ {
- fd := md.Fields().Get(i)
- // Map keys are never messages, so just consider the map value.
- if fd.IsMap() {
- fd = fd.MapValue()
- }
- fmd := fd.Message()
- if fmd != nil && needsInitCheckLocked(fmd) {
- return true
- }
- }
- return false
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go b/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
deleted file mode 100644
index e74cefd..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go
+++ /dev/null
@@ -1,223 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "sync"
- "sync/atomic"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type extensionFieldInfo struct {
- wiretag uint64
- tagsize int
- unmarshalNeedsValue bool
- funcs valueCoderFuncs
- validation validationInfo
-}
-
-var legacyExtensionFieldInfoCache sync.Map // map[protoreflect.ExtensionType]*extensionFieldInfo
-
-func getExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
- if xi, ok := xt.(*ExtensionInfo); ok {
- xi.lazyInit()
- return xi.info
- }
- return legacyLoadExtensionFieldInfo(xt)
-}
-
-// legacyLoadExtensionFieldInfo dynamically loads a *ExtensionInfo for xt.
-func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {
- if xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {
- return xi.(*extensionFieldInfo)
- }
- e := makeExtensionFieldInfo(xt.TypeDescriptor())
- if e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {
- return e.(*extensionFieldInfo)
- }
- return e
-}
-
-func makeExtensionFieldInfo(xd protoreflect.ExtensionDescriptor) *extensionFieldInfo {
- var wiretag uint64
- if !xd.IsPacked() {
- wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
- } else {
- wiretag = protowire.EncodeTag(xd.Number(), protowire.BytesType)
- }
- e := &extensionFieldInfo{
- wiretag: wiretag,
- tagsize: protowire.SizeVarint(wiretag),
- funcs: encoderFuncsForValue(xd),
- }
- // Does the unmarshal function need a value passed to it?
- // This is true for composite types, where we pass in a message, list, or map to fill in,
- // and for enums, where we pass in a prototype value to specify the concrete enum type.
- switch xd.Kind() {
- case protoreflect.MessageKind, protoreflect.GroupKind, protoreflect.EnumKind:
- e.unmarshalNeedsValue = true
- default:
- if xd.Cardinality() == protoreflect.Repeated {
- e.unmarshalNeedsValue = true
- }
- }
- return e
-}
-
-type lazyExtensionValue struct {
- atomicOnce uint32 // atomically set if value is valid
- mu sync.Mutex
- xi *extensionFieldInfo
- value protoreflect.Value
- b []byte
- fn func() protoreflect.Value
-}
-
-type ExtensionField struct {
- typ protoreflect.ExtensionType
-
- // value is either the value of GetValue,
- // or a *lazyExtensionValue that then returns the value of GetValue.
- value protoreflect.Value
- lazy *lazyExtensionValue
-}
-
-func (f *ExtensionField) appendLazyBytes(xt protoreflect.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
- if f.lazy == nil {
- f.lazy = &lazyExtensionValue{xi: xi}
- }
- f.typ = xt
- f.lazy.xi = xi
- f.lazy.b = protowire.AppendTag(f.lazy.b, num, wtyp)
- f.lazy.b = append(f.lazy.b, b...)
-}
-
-func (f *ExtensionField) canLazy(xt protoreflect.ExtensionType) bool {
- if f.typ == nil {
- return true
- }
- if f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
- return true
- }
- return false
-}
-
-func (f *ExtensionField) lazyInit() {
- f.lazy.mu.Lock()
- defer f.lazy.mu.Unlock()
- if atomic.LoadUint32(&f.lazy.atomicOnce) == 1 {
- return
- }
- if f.lazy.xi != nil {
- b := f.lazy.b
- val := f.typ.New()
- for len(b) > 0 {
- var tag uint64
- if b[0] < 0x80 {
- tag = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- tag = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- tag, n = protowire.ConsumeVarint(b)
- if n < 0 {
- panic(errors.New("bad tag in lazy extension decoding"))
- }
- b = b[n:]
- }
- num := protowire.Number(tag >> 3)
- wtyp := protowire.Type(tag & 7)
- var out unmarshalOutput
- var err error
- val, out, err = f.lazy.xi.funcs.unmarshal(b, val, num, wtyp, lazyUnmarshalOptions)
- if err != nil {
- panic(errors.New("decode failure in lazy extension decoding: %v", err))
- }
- b = b[out.n:]
- }
- f.lazy.value = val
- } else {
- f.lazy.value = f.lazy.fn()
- }
- f.lazy.xi = nil
- f.lazy.fn = nil
- f.lazy.b = nil
- atomic.StoreUint32(&f.lazy.atomicOnce, 1)
-}
-
-// Set sets the type and value of the extension field.
-// This must not be called concurrently.
-func (f *ExtensionField) Set(t protoreflect.ExtensionType, v protoreflect.Value) {
- f.typ = t
- f.value = v
- f.lazy = nil
-}
-
-// SetLazy sets the type and a value that is to be lazily evaluated upon first use.
-// This must not be called concurrently.
-func (f *ExtensionField) SetLazy(t protoreflect.ExtensionType, fn func() protoreflect.Value) {
- f.typ = t
- f.lazy = &lazyExtensionValue{fn: fn}
-}
-
-// Value returns the value of the extension field.
-// This may be called concurrently.
-func (f *ExtensionField) Value() protoreflect.Value {
- if f.lazy != nil {
- if atomic.LoadUint32(&f.lazy.atomicOnce) == 0 {
- f.lazyInit()
- }
- return f.lazy.value
- }
- return f.value
-}
-
-// Type returns the type of the extension field.
-// This may be called concurrently.
-func (f ExtensionField) Type() protoreflect.ExtensionType {
- return f.typ
-}
-
-// IsSet returns whether the extension field is set.
-// This may be called concurrently.
-func (f ExtensionField) IsSet() bool {
- return f.typ != nil
-}
-
-// IsLazy reports whether a field is lazily encoded.
-// It is exported for testing.
-func IsLazy(m protoreflect.Message, fd protoreflect.FieldDescriptor) bool {
- var mi *MessageInfo
- var p pointer
- switch m := m.(type) {
- case *messageState:
- mi = m.messageInfo()
- p = m.pointer()
- case *messageReflectWrapper:
- mi = m.messageInfo()
- p = m.pointer()
- default:
- return false
- }
- xd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
- if !ok {
- return false
- }
- xt := xd.Type()
- ext := mi.extensionMap(p)
- if ext == nil {
- return false
- }
- f, ok := (*ext)[int32(fd.Number())]
- if !ok {
- return false
- }
- return f.typ == xt && f.lazy != nil && atomic.LoadUint32(&f.lazy.atomicOnce) == 0
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go b/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
deleted file mode 100644
index 3fadd24..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_field.go
+++ /dev/null
@@ -1,830 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "sync"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-type errInvalidUTF8 struct{}
-
-func (errInvalidUTF8) Error() string { return "string field contains invalid UTF-8" }
-func (errInvalidUTF8) InvalidUTF8() bool { return true }
-func (errInvalidUTF8) Unwrap() error { return errors.Error }
-
-// initOneofFieldCoders initializes the fast-path functions for the fields in a oneof.
-//
-// For size, marshal, and isInit operations, functions are set only on the first field
-// in the oneof. The functions are called when the oneof is non-nil, and will dispatch
-// to the appropriate field-specific function as necessary.
-//
-// The unmarshal function is set on each field individually as usual.
-func (mi *MessageInfo) initOneofFieldCoders(od protoreflect.OneofDescriptor, si structInfo) {
- fs := si.oneofsByName[od.Name()]
- ft := fs.Type
- oneofFields := make(map[reflect.Type]*coderFieldInfo)
- needIsInit := false
- fields := od.Fields()
- for i, lim := 0, fields.Len(); i < lim; i++ {
- fd := od.Fields().Get(i)
- num := fd.Number()
- // Make a copy of the original coderFieldInfo for use in unmarshaling.
- //
- // oneofFields[oneofType].funcs.marshal is the field-specific marshal function.
- //
- // mi.coderFields[num].marshal is set on only the first field in the oneof,
- // and dispatches to the field-specific marshaler in oneofFields.
- cf := *mi.coderFields[num]
- ot := si.oneofWrappersByNumber[num]
- cf.ft = ot.Field(0).Type
- cf.mi, cf.funcs = fieldCoder(fd, cf.ft)
- oneofFields[ot] = &cf
- if cf.funcs.isInit != nil {
- needIsInit = true
- }
- mi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- var vw reflect.Value // pointer to wrapper type
- vi := p.AsValueOf(ft).Elem() // oneof field value of interface kind
- if !vi.IsNil() && !vi.Elem().IsNil() && vi.Elem().Elem().Type() == ot {
- vw = vi.Elem()
- } else {
- vw = reflect.New(ot)
- }
- out, err := cf.funcs.unmarshal(b, pointerOfValue(vw).Apply(zeroOffset), wtyp, &cf, opts)
- if err != nil {
- return out, err
- }
- vi.Set(vw)
- return out, nil
- }
- }
- getInfo := func(p pointer) (pointer, *coderFieldInfo) {
- v := p.AsValueOf(ft).Elem()
- if v.IsNil() {
- return pointer{}, nil
- }
- v = v.Elem() // interface -> *struct
- if v.IsNil() {
- return pointer{}, nil
- }
- return pointerOfValue(v).Apply(zeroOffset), oneofFields[v.Elem().Type()]
- }
- first := mi.coderFields[od.Fields().Get(0).Number()]
- first.funcs.size = func(p pointer, _ *coderFieldInfo, opts marshalOptions) int {
- p, info := getInfo(p)
- if info == nil || info.funcs.size == nil {
- return 0
- }
- return info.funcs.size(p, info, opts)
- }
- first.funcs.marshal = func(b []byte, p pointer, _ *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- p, info := getInfo(p)
- if info == nil || info.funcs.marshal == nil {
- return b, nil
- }
- return info.funcs.marshal(b, p, info, opts)
- }
- first.funcs.merge = func(dst, src pointer, _ *coderFieldInfo, opts mergeOptions) {
- srcp, srcinfo := getInfo(src)
- if srcinfo == nil || srcinfo.funcs.merge == nil {
- return
- }
- dstp, dstinfo := getInfo(dst)
- if dstinfo != srcinfo {
- dst.AsValueOf(ft).Elem().Set(reflect.New(src.AsValueOf(ft).Elem().Elem().Elem().Type()))
- dstp = pointerOfValue(dst.AsValueOf(ft).Elem().Elem()).Apply(zeroOffset)
- }
- srcinfo.funcs.merge(dstp, srcp, srcinfo, opts)
- }
- if needIsInit {
- first.funcs.isInit = func(p pointer, _ *coderFieldInfo) error {
- p, info := getInfo(p)
- if info == nil || info.funcs.isInit == nil {
- return nil
- }
- return info.funcs.isInit(p, info)
- }
- }
-}
-
-func makeWeakMessageFieldCoder(fd protoreflect.FieldDescriptor) pointerCoderFuncs {
- var once sync.Once
- var messageType protoreflect.MessageType
- lazyInit := func() {
- once.Do(func() {
- messageName := fd.Message().FullName()
- messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
- })
- }
-
- return pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- m, ok := p.WeakFields().get(f.num)
- if !ok {
- return 0
- }
- lazyInit()
- if messageType == nil {
- panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName()))
- }
- return sizeMessage(m, f.tagsize, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- m, ok := p.WeakFields().get(f.num)
- if !ok {
- return b, nil
- }
- lazyInit()
- if messageType == nil {
- panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName()))
- }
- return appendMessage(b, m, f.wiretag, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- fs := p.WeakFields()
- m, ok := fs.get(f.num)
- if !ok {
- lazyInit()
- if messageType == nil {
- return unmarshalOutput{}, errUnknown
- }
- m = messageType.New().Interface()
- fs.set(f.num, m)
- }
- return consumeMessage(b, m, wtyp, opts)
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- m, ok := p.WeakFields().get(f.num)
- if !ok {
- return nil
- }
- return proto.CheckInitialized(m)
- },
- merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- sm, ok := src.WeakFields().get(f.num)
- if !ok {
- return
- }
- dm, ok := dst.WeakFields().get(f.num)
- if !ok {
- lazyInit()
- if messageType == nil {
- panic(fmt.Sprintf("weak message %v is not linked in", fd.Message().FullName()))
- }
- dm = messageType.New().Interface()
- dst.WeakFields().set(f.num, dm)
- }
- opts.Merge(dm, sm)
- },
- }
-}
-
-func makeMessageFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
- if mi := getMessageInfo(ft); mi != nil {
- funcs := pointerCoderFuncs{
- size: sizeMessageInfo,
- marshal: appendMessageInfo,
- unmarshal: consumeMessageInfo,
- merge: mergeMessage,
- }
- if needsInitCheck(mi.Desc) {
- funcs.isInit = isInitMessageInfo
- }
- return funcs
- } else {
- return pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- m := asMessage(p.AsValueOf(ft).Elem())
- return sizeMessage(m, f.tagsize, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- m := asMessage(p.AsValueOf(ft).Elem())
- return appendMessage(b, m, f.wiretag, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- mp := p.AsValueOf(ft).Elem()
- if mp.IsNil() {
- mp.Set(reflect.New(ft.Elem()))
- }
- return consumeMessage(b, asMessage(mp), wtyp, opts)
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- m := asMessage(p.AsValueOf(ft).Elem())
- return proto.CheckInitialized(m)
- },
- merge: mergeMessage,
- }
- }
-}
-
-func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return protowire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize
-}
-
-func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))
- return f.mi.marshalAppendPointer(b, p.Elem(), opts)
-}
-
-func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if p.Elem().IsNil() {
- p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))
- }
- o, err := f.mi.unmarshalPointer(v, p.Elem(), 0, opts)
- if err != nil {
- return out, err
- }
- out.n = n
- out.initialized = o.initialized
- return out, nil
-}
-
-func isInitMessageInfo(p pointer, f *coderFieldInfo) error {
- return f.mi.checkInitializedPointer(p.Elem())
-}
-
-func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {
- return protowire.SizeBytes(proto.Size(m)) + tagsize
-}
-
-func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(proto.Size(m)))
- return opts.Options().MarshalAppend(b, m)
-}
-
-func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: v,
- Message: m.ProtoReflect(),
- })
- if err != nil {
- return out, err
- }
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return out, nil
-}
-
-func sizeMessageValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- m := v.Message().Interface()
- return sizeMessage(m, tagsize, opts)
-}
-
-func appendMessageValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- m := v.Message().Interface()
- return appendMessage(b, m, wiretag, opts)
-}
-
-func consumeMessageValue(b []byte, v protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
- m := v.Message().Interface()
- out, err := consumeMessage(b, m, wtyp, opts)
- return v, out, err
-}
-
-func isInitMessageValue(v protoreflect.Value) error {
- m := v.Message().Interface()
- return proto.CheckInitialized(m)
-}
-
-var coderMessageValue = valueCoderFuncs{
- size: sizeMessageValue,
- marshal: appendMessageValue,
- unmarshal: consumeMessageValue,
- isInit: isInitMessageValue,
- merge: mergeMessageValue,
-}
-
-func sizeGroupValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- m := v.Message().Interface()
- return sizeGroup(m, tagsize, opts)
-}
-
-func appendGroupValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- m := v.Message().Interface()
- return appendGroup(b, m, wiretag, opts)
-}
-
-func consumeGroupValue(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error) {
- m := v.Message().Interface()
- out, err := consumeGroup(b, m, num, wtyp, opts)
- return v, out, err
-}
-
-var coderGroupValue = valueCoderFuncs{
- size: sizeGroupValue,
- marshal: appendGroupValue,
- unmarshal: consumeGroupValue,
- isInit: isInitMessageValue,
- merge: mergeMessageValue,
-}
-
-func makeGroupFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
- num := fd.Number()
- if mi := getMessageInfo(ft); mi != nil {
- funcs := pointerCoderFuncs{
- size: sizeGroupType,
- marshal: appendGroupType,
- unmarshal: consumeGroupType,
- merge: mergeMessage,
- }
- if needsInitCheck(mi.Desc) {
- funcs.isInit = isInitMessageInfo
- }
- return funcs
- } else {
- return pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- m := asMessage(p.AsValueOf(ft).Elem())
- return sizeGroup(m, f.tagsize, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- m := asMessage(p.AsValueOf(ft).Elem())
- return appendGroup(b, m, f.wiretag, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- mp := p.AsValueOf(ft).Elem()
- if mp.IsNil() {
- mp.Set(reflect.New(ft.Elem()))
- }
- return consumeGroup(b, asMessage(mp), num, wtyp, opts)
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- m := asMessage(p.AsValueOf(ft).Elem())
- return proto.CheckInitialized(m)
- },
- merge: mergeMessage,
- }
- }
-}
-
-func sizeGroupType(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return 2*f.tagsize + f.mi.sizePointer(p.Elem(), opts)
-}
-
-func appendGroupType(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, f.wiretag) // start group
- b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)
- b = protowire.AppendVarint(b, f.wiretag+1) // end group
- return b, err
-}
-
-func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.StartGroupType {
- return out, errUnknown
- }
- if p.Elem().IsNil() {
- p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))
- }
- return f.mi.unmarshalPointer(b, p.Elem(), f.num, opts)
-}
-
-func sizeGroup(m proto.Message, tagsize int, _ marshalOptions) int {
- return 2*tagsize + proto.Size(m)
-}
-
-func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag) // start group
- b, err := opts.Options().MarshalAppend(b, m)
- b = protowire.AppendVarint(b, wiretag+1) // end group
- return b, err
-}
-
-func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.StartGroupType {
- return out, errUnknown
- }
- b, n := protowire.ConsumeGroup(num, b)
- if n < 0 {
- return out, errDecode
- }
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: b,
- Message: m.ProtoReflect(),
- })
- if err != nil {
- return out, err
- }
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return out, nil
-}
-
-func makeMessageSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
- if mi := getMessageInfo(ft); mi != nil {
- funcs := pointerCoderFuncs{
- size: sizeMessageSliceInfo,
- marshal: appendMessageSliceInfo,
- unmarshal: consumeMessageSliceInfo,
- merge: mergeMessageSlice,
- }
- if needsInitCheck(mi.Desc) {
- funcs.isInit = isInitMessageSliceInfo
- }
- return funcs
- }
- return pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return sizeMessageSlice(p, ft, f.tagsize, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- return appendMessageSlice(b, p, f.wiretag, ft, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- return consumeMessageSlice(b, p, ft, wtyp, opts)
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- return isInitMessageSlice(p, ft)
- },
- merge: mergeMessageSlice,
- }
-}
-
-func sizeMessageSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- s := p.PointerSlice()
- n := 0
- for _, v := range s {
- n += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize
- }
- return n
-}
-
-func appendMessageSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := p.PointerSlice()
- var err error
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- siz := f.mi.sizePointer(v, opts)
- b = protowire.AppendVarint(b, uint64(siz))
- b, err = f.mi.marshalAppendPointer(b, v, opts)
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- m := reflect.New(f.mi.GoReflectType.Elem()).Interface()
- mp := pointerOfIface(m)
- o, err := f.mi.unmarshalPointer(v, mp, 0, opts)
- if err != nil {
- return out, err
- }
- p.AppendPointerSlice(mp)
- out.n = n
- out.initialized = o.initialized
- return out, nil
-}
-
-func isInitMessageSliceInfo(p pointer, f *coderFieldInfo) error {
- s := p.PointerSlice()
- for _, v := range s {
- if err := f.mi.checkInitializedPointer(v); err != nil {
- return err
- }
- }
- return nil
-}
-
-func sizeMessageSlice(p pointer, goType reflect.Type, tagsize int, _ marshalOptions) int {
- s := p.PointerSlice()
- n := 0
- for _, v := range s {
- m := asMessage(v.AsValueOf(goType.Elem()))
- n += protowire.SizeBytes(proto.Size(m)) + tagsize
- }
- return n
-}
-
-func appendMessageSlice(b []byte, p pointer, wiretag uint64, goType reflect.Type, opts marshalOptions) ([]byte, error) {
- s := p.PointerSlice()
- var err error
- for _, v := range s {
- m := asMessage(v.AsValueOf(goType.Elem()))
- b = protowire.AppendVarint(b, wiretag)
- siz := proto.Size(m)
- b = protowire.AppendVarint(b, uint64(siz))
- b, err = opts.Options().MarshalAppend(b, m)
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- mp := reflect.New(goType.Elem())
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: v,
- Message: asMessage(mp).ProtoReflect(),
- })
- if err != nil {
- return out, err
- }
- p.AppendPointerSlice(pointerOfValue(mp))
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return out, nil
-}
-
-func isInitMessageSlice(p pointer, goType reflect.Type) error {
- s := p.PointerSlice()
- for _, v := range s {
- m := asMessage(v.AsValueOf(goType.Elem()))
- if err := proto.CheckInitialized(m); err != nil {
- return err
- }
- }
- return nil
-}
-
-// Slices of messages
-
-func sizeMessageSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
- list := listv.List()
- n := 0
- for i, llen := 0, list.Len(); i < llen; i++ {
- m := list.Get(i).Message().Interface()
- n += protowire.SizeBytes(proto.Size(m)) + tagsize
- }
- return n
-}
-
-func appendMessageSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- mopts := opts.Options()
- for i, llen := 0, list.Len(); i < llen; i++ {
- m := list.Get(i).Message().Interface()
- b = protowire.AppendVarint(b, wiretag)
- siz := proto.Size(m)
- b = protowire.AppendVarint(b, uint64(siz))
- var err error
- b, err = mopts.MarshalAppend(b, m)
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func consumeMessageSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- m := list.NewElement()
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: v,
- Message: m.Message(),
- })
- if err != nil {
- return protoreflect.Value{}, out, err
- }
- list.Append(m)
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return listv, out, nil
-}
-
-func isInitMessageSliceValue(listv protoreflect.Value) error {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- m := list.Get(i).Message().Interface()
- if err := proto.CheckInitialized(m); err != nil {
- return err
- }
- }
- return nil
-}
-
-var coderMessageSliceValue = valueCoderFuncs{
- size: sizeMessageSliceValue,
- marshal: appendMessageSliceValue,
- unmarshal: consumeMessageSliceValue,
- isInit: isInitMessageSliceValue,
- merge: mergeMessageListValue,
-}
-
-func sizeGroupSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) int {
- list := listv.List()
- n := 0
- for i, llen := 0, list.Len(); i < llen; i++ {
- m := list.Get(i).Message().Interface()
- n += 2*tagsize + proto.Size(m)
- }
- return n
-}
-
-func appendGroupSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- mopts := opts.Options()
- for i, llen := 0, list.Len(); i < llen; i++ {
- m := list.Get(i).Message().Interface()
- b = protowire.AppendVarint(b, wiretag) // start group
- var err error
- b, err = mopts.MarshalAppend(b, m)
- if err != nil {
- return b, err
- }
- b = protowire.AppendVarint(b, wiretag+1) // end group
- }
- return b, nil
-}
-
-func consumeGroupSliceValue(b []byte, listv protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp != protowire.StartGroupType {
- return protoreflect.Value{}, out, errUnknown
- }
- b, n := protowire.ConsumeGroup(num, b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- m := list.NewElement()
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: b,
- Message: m.Message(),
- })
- if err != nil {
- return protoreflect.Value{}, out, err
- }
- list.Append(m)
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return listv, out, nil
-}
-
-var coderGroupSliceValue = valueCoderFuncs{
- size: sizeGroupSliceValue,
- marshal: appendGroupSliceValue,
- unmarshal: consumeGroupSliceValue,
- isInit: isInitMessageSliceValue,
- merge: mergeMessageListValue,
-}
-
-func makeGroupSliceFieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) pointerCoderFuncs {
- num := fd.Number()
- if mi := getMessageInfo(ft); mi != nil {
- funcs := pointerCoderFuncs{
- size: sizeGroupSliceInfo,
- marshal: appendGroupSliceInfo,
- unmarshal: consumeGroupSliceInfo,
- merge: mergeMessageSlice,
- }
- if needsInitCheck(mi.Desc) {
- funcs.isInit = isInitMessageSliceInfo
- }
- return funcs
- }
- return pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return sizeGroupSlice(p, ft, f.tagsize, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- return appendGroupSlice(b, p, f.wiretag, ft, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- return consumeGroupSlice(b, p, num, wtyp, ft, opts)
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- return isInitMessageSlice(p, ft)
- },
- merge: mergeMessageSlice,
- }
-}
-
-func sizeGroupSlice(p pointer, messageType reflect.Type, tagsize int, _ marshalOptions) int {
- s := p.PointerSlice()
- n := 0
- for _, v := range s {
- m := asMessage(v.AsValueOf(messageType.Elem()))
- n += 2*tagsize + proto.Size(m)
- }
- return n
-}
-
-func appendGroupSlice(b []byte, p pointer, wiretag uint64, messageType reflect.Type, opts marshalOptions) ([]byte, error) {
- s := p.PointerSlice()
- var err error
- for _, v := range s {
- m := asMessage(v.AsValueOf(messageType.Elem()))
- b = protowire.AppendVarint(b, wiretag) // start group
- b, err = opts.Options().MarshalAppend(b, m)
- if err != nil {
- return b, err
- }
- b = protowire.AppendVarint(b, wiretag+1) // end group
- }
- return b, nil
-}
-
-func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.StartGroupType {
- return out, errUnknown
- }
- b, n := protowire.ConsumeGroup(num, b)
- if n < 0 {
- return out, errDecode
- }
- mp := reflect.New(goType.Elem())
- o, err := opts.Options().UnmarshalState(protoiface.UnmarshalInput{
- Buf: b,
- Message: asMessage(mp).ProtoReflect(),
- })
- if err != nil {
- return out, err
- }
- p.AppendPointerSlice(pointerOfValue(mp))
- out.n = n
- out.initialized = o.Flags&protoiface.UnmarshalInitialized != 0
- return out, nil
-}
-
-func sizeGroupSliceInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- s := p.PointerSlice()
- n := 0
- for _, v := range s {
- n += 2*f.tagsize + f.mi.sizePointer(v, opts)
- }
- return n
-}
-
-func appendGroupSliceInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := p.PointerSlice()
- var err error
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag) // start group
- b, err = f.mi.marshalAppendPointer(b, v, opts)
- if err != nil {
- return b, err
- }
- b = protowire.AppendVarint(b, f.wiretag+1) // end group
- }
- return b, nil
-}
-
-func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- if wtyp != protowire.StartGroupType {
- return unmarshalOutput{}, errUnknown
- }
- m := reflect.New(f.mi.GoReflectType.Elem()).Interface()
- mp := pointerOfIface(m)
- out, err := f.mi.unmarshalPointer(b, mp, f.num, opts)
- if err != nil {
- return out, err
- }
- p.AppendPointerSlice(mp)
- return out, nil
-}
-
-func asMessage(v reflect.Value) protoreflect.ProtoMessage {
- if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
- return m
- }
- return legacyWrapMessage(v).Interface()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go b/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
deleted file mode 100644
index f55dc01..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go
+++ /dev/null
@@ -1,5724 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package impl
-
-import (
- "math"
- "unicode/utf8"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// sizeBool returns the size of wire encoding a bool pointer as a Bool.
-func sizeBool(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Bool()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
-}
-
-// appendBool wire encodes a bool pointer as a Bool.
-func appendBool(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bool()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v))
- return b, nil
-}
-
-// consumeBool wire decodes a bool pointer as a Bool.
-func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Bool() = protowire.DecodeBool(v)
- out.n = n
- return out, nil
-}
-
-var coderBool = pointerCoderFuncs{
- size: sizeBool,
- marshal: appendBool,
- unmarshal: consumeBool,
- merge: mergeBool,
-}
-
-// sizeBoolNoZero returns the size of wire encoding a bool pointer as a Bool.
-// The zero value is not encoded.
-func sizeBoolNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Bool()
- if v == false {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
-}
-
-// appendBoolNoZero wire encodes a bool pointer as a Bool.
-// The zero value is not encoded.
-func appendBoolNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bool()
- if v == false {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v))
- return b, nil
-}
-
-var coderBoolNoZero = pointerCoderFuncs{
- size: sizeBoolNoZero,
- marshal: appendBoolNoZero,
- unmarshal: consumeBool,
- merge: mergeBoolNoZero,
-}
-
-// sizeBoolPtr returns the size of wire encoding a *bool pointer as a Bool.
-// It panics if the pointer is nil.
-func sizeBoolPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.BoolPtr()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
-}
-
-// appendBoolPtr wire encodes a *bool pointer as a Bool.
-// It panics if the pointer is nil.
-func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.BoolPtr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v))
- return b, nil
-}
-
-// consumeBoolPtr wire decodes a *bool pointer as a Bool.
-func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.BoolPtr()
- if *vp == nil {
- *vp = new(bool)
- }
- **vp = protowire.DecodeBool(v)
- out.n = n
- return out, nil
-}
-
-var coderBoolPtr = pointerCoderFuncs{
- size: sizeBoolPtr,
- marshal: appendBoolPtr,
- unmarshal: consumeBoolPtr,
- merge: mergeBoolPtr,
-}
-
-// sizeBoolSlice returns the size of wire encoding a []bool pointer as a repeated Bool.
-func sizeBoolSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.BoolSlice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
- }
- return size
-}
-
-// appendBoolSlice encodes a []bool pointer as a repeated Bool.
-func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.BoolSlice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v))
- }
- return b, nil
-}
-
-// consumeBoolSlice wire decodes a []bool pointer as a repeated Bool.
-func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.BoolSlice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growBoolSlice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, protowire.DecodeBool(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, protowire.DecodeBool(v))
- out.n = n
- return out, nil
-}
-
-var coderBoolSlice = pointerCoderFuncs{
- size: sizeBoolSlice,
- marshal: appendBoolSlice,
- unmarshal: consumeBoolSlice,
- merge: mergeBoolSlice,
-}
-
-// sizeBoolPackedSlice returns the size of wire encoding a []bool pointer as a packed repeated Bool.
-func sizeBoolPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.BoolSlice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeBool(v))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.
-func appendBoolPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.BoolSlice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeBool(v))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, protowire.EncodeBool(v))
- }
- return b, nil
-}
-
-var coderBoolPackedSlice = pointerCoderFuncs{
- size: sizeBoolPackedSlice,
- marshal: appendBoolPackedSlice,
- unmarshal: consumeBoolSlice,
- merge: mergeBoolSlice,
-}
-
-// sizeBoolValue returns the size of wire encoding a bool value as a Bool.
-func sizeBoolValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
-}
-
-// appendBoolValue encodes a bool value as a Bool.
-func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
- return b, nil
-}
-
-// consumeBoolValue decodes a bool value as a Bool.
-func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil
-}
-
-var coderBoolValue = valueCoderFuncs{
- size: sizeBoolValue,
- marshal: appendBoolValue,
- unmarshal: consumeBoolValue,
- merge: mergeScalarValue,
-}
-
-// sizeBoolSliceValue returns the size of wire encoding a []bool value as a repeated Bool.
-func sizeBoolSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
- }
- return size
-}
-
-// appendBoolSliceValue encodes a []bool value as a repeated Bool.
-func appendBoolSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
- }
- return b, nil
-}
-
-// consumeBoolSliceValue wire decodes a []bool value as a repeated Bool.
-func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderBoolSliceValue = valueCoderFuncs{
- size: sizeBoolSliceValue,
- marshal: appendBoolSliceValue,
- unmarshal: consumeBoolSliceValue,
- merge: mergeListValue,
-}
-
-// sizeBoolPackedSliceValue returns the size of wire encoding a []bool value as a packed repeated Bool.
-func sizeBoolPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool.
-func appendBoolPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
- }
- return b, nil
-}
-
-var coderBoolPackedSliceValue = valueCoderFuncs{
- size: sizeBoolPackedSliceValue,
- marshal: appendBoolPackedSliceValue,
- unmarshal: consumeBoolSliceValue,
- merge: mergeListValue,
-}
-
-// sizeEnumValue returns the size of wire encoding a value as a Enum.
-func sizeEnumValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(uint64(v.Enum()))
-}
-
-// appendEnumValue encodes a value as a Enum.
-func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(v.Enum()))
- return b, nil
-}
-
-// consumeEnumValue decodes a value as a Enum.
-func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil
-}
-
-var coderEnumValue = valueCoderFuncs{
- size: sizeEnumValue,
- marshal: appendEnumValue,
- unmarshal: consumeEnumValue,
- merge: mergeScalarValue,
-}
-
-// sizeEnumSliceValue returns the size of wire encoding a [] value as a repeated Enum.
-func sizeEnumSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(uint64(v.Enum()))
- }
- return size
-}
-
-// appendEnumSliceValue encodes a [] value as a repeated Enum.
-func appendEnumSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(v.Enum()))
- }
- return b, nil
-}
-
-// consumeEnumSliceValue wire decodes a [] value as a repeated Enum.
-func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderEnumSliceValue = valueCoderFuncs{
- size: sizeEnumSliceValue,
- marshal: appendEnumSliceValue,
- unmarshal: consumeEnumSliceValue,
- merge: mergeListValue,
-}
-
-// sizeEnumPackedSliceValue returns the size of wire encoding a [] value as a packed repeated Enum.
-func sizeEnumPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(v.Enum()))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum.
-func appendEnumPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(v.Enum()))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, uint64(v.Enum()))
- }
- return b, nil
-}
-
-var coderEnumPackedSliceValue = valueCoderFuncs{
- size: sizeEnumPackedSliceValue,
- marshal: appendEnumPackedSliceValue,
- unmarshal: consumeEnumSliceValue,
- merge: mergeListValue,
-}
-
-// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
-func sizeInt32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int32()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt32 wire encodes a int32 pointer as a Int32.
-func appendInt32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeInt32 wire decodes a int32 pointer as a Int32.
-func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Int32() = int32(v)
- out.n = n
- return out, nil
-}
-
-var coderInt32 = pointerCoderFuncs{
- size: sizeInt32,
- marshal: appendInt32,
- unmarshal: consumeInt32,
- merge: mergeInt32,
-}
-
-// sizeInt32NoZero returns the size of wire encoding a int32 pointer as a Int32.
-// The zero value is not encoded.
-func sizeInt32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int32()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt32NoZero wire encodes a int32 pointer as a Int32.
-// The zero value is not encoded.
-func appendInt32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-var coderInt32NoZero = pointerCoderFuncs{
- size: sizeInt32NoZero,
- marshal: appendInt32NoZero,
- unmarshal: consumeInt32,
- merge: mergeInt32NoZero,
-}
-
-// sizeInt32Ptr returns the size of wire encoding a *int32 pointer as a Int32.
-// It panics if the pointer is nil.
-func sizeInt32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Int32Ptr()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt32Ptr wire encodes a *int32 pointer as a Int32.
-// It panics if the pointer is nil.
-func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeInt32Ptr wire decodes a *int32 pointer as a Int32.
-func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int32Ptr()
- if *vp == nil {
- *vp = new(int32)
- }
- **vp = int32(v)
- out.n = n
- return out, nil
-}
-
-var coderInt32Ptr = pointerCoderFuncs{
- size: sizeInt32Ptr,
- marshal: appendInt32Ptr,
- unmarshal: consumeInt32Ptr,
- merge: mergeInt32Ptr,
-}
-
-// sizeInt32Slice returns the size of wire encoding a []int32 pointer as a repeated Int32.
-func sizeInt32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(uint64(v))
- }
- return size
-}
-
-// appendInt32Slice encodes a []int32 pointer as a repeated Int32.
-func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-// consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32.
-func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growInt32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, int32(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, int32(v))
- out.n = n
- return out, nil
-}
-
-var coderInt32Slice = pointerCoderFuncs{
- size: sizeInt32Slice,
- marshal: appendInt32Slice,
- unmarshal: consumeInt32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeInt32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Int32.
-func sizeInt32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.
-func appendInt32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-var coderInt32PackedSlice = pointerCoderFuncs{
- size: sizeInt32PackedSlice,
- marshal: appendInt32PackedSlice,
- unmarshal: consumeInt32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeInt32Value returns the size of wire encoding a int32 value as a Int32.
-func sizeInt32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
-}
-
-// appendInt32Value encodes a int32 value as a Int32.
-func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(int32(v.Int())))
- return b, nil
-}
-
-// consumeInt32Value decodes a int32 value as a Int32.
-func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt32(int32(v)), out, nil
-}
-
-var coderInt32Value = valueCoderFuncs{
- size: sizeInt32Value,
- marshal: appendInt32Value,
- unmarshal: consumeInt32Value,
- merge: mergeScalarValue,
-}
-
-// sizeInt32SliceValue returns the size of wire encoding a []int32 value as a repeated Int32.
-func sizeInt32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
- }
- return size
-}
-
-// appendInt32SliceValue encodes a []int32 value as a repeated Int32.
-func appendInt32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(int32(v.Int())))
- }
- return b, nil
-}
-
-// consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32.
-func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderInt32SliceValue = valueCoderFuncs{
- size: sizeInt32SliceValue,
- marshal: appendInt32SliceValue,
- unmarshal: consumeInt32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeInt32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Int32.
-func sizeInt32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(int32(v.Int())))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32.
-func appendInt32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(int32(v.Int())))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, uint64(int32(v.Int())))
- }
- return b, nil
-}
-
-var coderInt32PackedSliceValue = valueCoderFuncs{
- size: sizeInt32PackedSliceValue,
- marshal: appendInt32PackedSliceValue,
- unmarshal: consumeInt32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
-func sizeSint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int32()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
-}
-
-// appendSint32 wire encodes a int32 pointer as a Sint32.
-func appendSint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
- return b, nil
-}
-
-// consumeSint32 wire decodes a int32 pointer as a Sint32.
-func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))
- out.n = n
- return out, nil
-}
-
-var coderSint32 = pointerCoderFuncs{
- size: sizeSint32,
- marshal: appendSint32,
- unmarshal: consumeSint32,
- merge: mergeInt32,
-}
-
-// sizeSint32NoZero returns the size of wire encoding a int32 pointer as a Sint32.
-// The zero value is not encoded.
-func sizeSint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int32()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
-}
-
-// appendSint32NoZero wire encodes a int32 pointer as a Sint32.
-// The zero value is not encoded.
-func appendSint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
- return b, nil
-}
-
-var coderSint32NoZero = pointerCoderFuncs{
- size: sizeSint32NoZero,
- marshal: appendSint32NoZero,
- unmarshal: consumeSint32,
- merge: mergeInt32NoZero,
-}
-
-// sizeSint32Ptr returns the size of wire encoding a *int32 pointer as a Sint32.
-// It panics if the pointer is nil.
-func sizeSint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Int32Ptr()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
-}
-
-// appendSint32Ptr wire encodes a *int32 pointer as a Sint32.
-// It panics if the pointer is nil.
-func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
- return b, nil
-}
-
-// consumeSint32Ptr wire decodes a *int32 pointer as a Sint32.
-func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int32Ptr()
- if *vp == nil {
- *vp = new(int32)
- }
- **vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))
- out.n = n
- return out, nil
-}
-
-var coderSint32Ptr = pointerCoderFuncs{
- size: sizeSint32Ptr,
- marshal: appendSint32Ptr,
- unmarshal: consumeSint32Ptr,
- merge: mergeInt32Ptr,
-}
-
-// sizeSint32Slice returns the size of wire encoding a []int32 pointer as a repeated Sint32.
-func sizeSint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
- }
- return size
-}
-
-// appendSint32Slice encodes a []int32 pointer as a repeated Sint32.
-func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
- }
- return b, nil
-}
-
-// consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32.
-func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growInt32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
- out.n = n
- return out, nil
-}
-
-var coderSint32Slice = pointerCoderFuncs{
- size: sizeSint32Slice,
- marshal: appendSint32Slice,
- unmarshal: consumeSint32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeSint32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sint32.
-func sizeSint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.
-func appendSint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
- }
- return b, nil
-}
-
-var coderSint32PackedSlice = pointerCoderFuncs{
- size: sizeSint32PackedSlice,
- marshal: appendSint32PackedSlice,
- unmarshal: consumeSint32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeSint32Value returns the size of wire encoding a int32 value as a Sint32.
-func sizeSint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
-}
-
-// appendSint32Value encodes a int32 value as a Sint32.
-func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
- return b, nil
-}
-
-// consumeSint32Value decodes a int32 value as a Sint32.
-func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil
-}
-
-var coderSint32Value = valueCoderFuncs{
- size: sizeSint32Value,
- marshal: appendSint32Value,
- unmarshal: consumeSint32Value,
- merge: mergeScalarValue,
-}
-
-// sizeSint32SliceValue returns the size of wire encoding a []int32 value as a repeated Sint32.
-func sizeSint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
- }
- return size
-}
-
-// appendSint32SliceValue encodes a []int32 value as a repeated Sint32.
-func appendSint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
- }
- return b, nil
-}
-
-// consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32.
-func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
- out.n = n
- return listv, out, nil
-}
-
-var coderSint32SliceValue = valueCoderFuncs{
- size: sizeSint32SliceValue,
- marshal: appendSint32SliceValue,
- unmarshal: consumeSint32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSint32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sint32.
-func sizeSint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32.
-func appendSint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
- }
- return b, nil
-}
-
-var coderSint32PackedSliceValue = valueCoderFuncs{
- size: sizeSint32PackedSliceValue,
- marshal: appendSint32PackedSliceValue,
- unmarshal: consumeSint32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
-func sizeUint32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint32()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendUint32 wire encodes a uint32 pointer as a Uint32.
-func appendUint32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeUint32 wire decodes a uint32 pointer as a Uint32.
-func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Uint32() = uint32(v)
- out.n = n
- return out, nil
-}
-
-var coderUint32 = pointerCoderFuncs{
- size: sizeUint32,
- marshal: appendUint32,
- unmarshal: consumeUint32,
- merge: mergeUint32,
-}
-
-// sizeUint32NoZero returns the size of wire encoding a uint32 pointer as a Uint32.
-// The zero value is not encoded.
-func sizeUint32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint32()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendUint32NoZero wire encodes a uint32 pointer as a Uint32.
-// The zero value is not encoded.
-func appendUint32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint32()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-var coderUint32NoZero = pointerCoderFuncs{
- size: sizeUint32NoZero,
- marshal: appendUint32NoZero,
- unmarshal: consumeUint32,
- merge: mergeUint32NoZero,
-}
-
-// sizeUint32Ptr returns the size of wire encoding a *uint32 pointer as a Uint32.
-// It panics if the pointer is nil.
-func sizeUint32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Uint32Ptr()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendUint32Ptr wire encodes a *uint32 pointer as a Uint32.
-// It panics if the pointer is nil.
-func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Uint32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32.
-func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Uint32Ptr()
- if *vp == nil {
- *vp = new(uint32)
- }
- **vp = uint32(v)
- out.n = n
- return out, nil
-}
-
-var coderUint32Ptr = pointerCoderFuncs{
- size: sizeUint32Ptr,
- marshal: appendUint32Ptr,
- unmarshal: consumeUint32Ptr,
- merge: mergeUint32Ptr,
-}
-
-// sizeUint32Slice returns the size of wire encoding a []uint32 pointer as a repeated Uint32.
-func sizeUint32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint32Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(uint64(v))
- }
- return size
-}
-
-// appendUint32Slice encodes a []uint32 pointer as a repeated Uint32.
-func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-// consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32.
-func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Uint32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growUint32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, uint32(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, uint32(v))
- out.n = n
- return out, nil
-}
-
-var coderUint32Slice = pointerCoderFuncs{
- size: sizeUint32Slice,
- marshal: appendUint32Slice,
- unmarshal: consumeUint32Slice,
- merge: mergeUint32Slice,
-}
-
-// sizeUint32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Uint32.
-func sizeUint32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint32Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.
-func appendUint32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-var coderUint32PackedSlice = pointerCoderFuncs{
- size: sizeUint32PackedSlice,
- marshal: appendUint32PackedSlice,
- unmarshal: consumeUint32Slice,
- merge: mergeUint32Slice,
-}
-
-// sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32.
-func sizeUint32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
-}
-
-// appendUint32Value encodes a uint32 value as a Uint32.
-func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
- return b, nil
-}
-
-// consumeUint32Value decodes a uint32 value as a Uint32.
-func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfUint32(uint32(v)), out, nil
-}
-
-var coderUint32Value = valueCoderFuncs{
- size: sizeUint32Value,
- marshal: appendUint32Value,
- unmarshal: consumeUint32Value,
- merge: mergeScalarValue,
-}
-
-// sizeUint32SliceValue returns the size of wire encoding a []uint32 value as a repeated Uint32.
-func sizeUint32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
- }
- return size
-}
-
-// appendUint32SliceValue encodes a []uint32 value as a repeated Uint32.
-func appendUint32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
- }
- return b, nil
-}
-
-// consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32.
-func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderUint32SliceValue = valueCoderFuncs{
- size: sizeUint32SliceValue,
- marshal: appendUint32SliceValue,
- unmarshal: consumeUint32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeUint32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Uint32.
-func sizeUint32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(uint32(v.Uint())))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32.
-func appendUint32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(uint32(v.Uint())))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
- }
- return b, nil
-}
-
-var coderUint32PackedSliceValue = valueCoderFuncs{
- size: sizeUint32PackedSliceValue,
- marshal: appendUint32PackedSliceValue,
- unmarshal: consumeUint32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
-func sizeInt64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int64()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt64 wire encodes a int64 pointer as a Int64.
-func appendInt64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeInt64 wire decodes a int64 pointer as a Int64.
-func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Int64() = int64(v)
- out.n = n
- return out, nil
-}
-
-var coderInt64 = pointerCoderFuncs{
- size: sizeInt64,
- marshal: appendInt64,
- unmarshal: consumeInt64,
- merge: mergeInt64,
-}
-
-// sizeInt64NoZero returns the size of wire encoding a int64 pointer as a Int64.
-// The zero value is not encoded.
-func sizeInt64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int64()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt64NoZero wire encodes a int64 pointer as a Int64.
-// The zero value is not encoded.
-func appendInt64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-var coderInt64NoZero = pointerCoderFuncs{
- size: sizeInt64NoZero,
- marshal: appendInt64NoZero,
- unmarshal: consumeInt64,
- merge: mergeInt64NoZero,
-}
-
-// sizeInt64Ptr returns the size of wire encoding a *int64 pointer as a Int64.
-// It panics if the pointer is nil.
-func sizeInt64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Int64Ptr()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-// appendInt64Ptr wire encodes a *int64 pointer as a Int64.
-// It panics if the pointer is nil.
-func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-// consumeInt64Ptr wire decodes a *int64 pointer as a Int64.
-func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int64Ptr()
- if *vp == nil {
- *vp = new(int64)
- }
- **vp = int64(v)
- out.n = n
- return out, nil
-}
-
-var coderInt64Ptr = pointerCoderFuncs{
- size: sizeInt64Ptr,
- marshal: appendInt64Ptr,
- unmarshal: consumeInt64Ptr,
- merge: mergeInt64Ptr,
-}
-
-// sizeInt64Slice returns the size of wire encoding a []int64 pointer as a repeated Int64.
-func sizeInt64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(uint64(v))
- }
- return size
-}
-
-// appendInt64Slice encodes a []int64 pointer as a repeated Int64.
-func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-// consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64.
-func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growInt64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, int64(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, int64(v))
- out.n = n
- return out, nil
-}
-
-var coderInt64Slice = pointerCoderFuncs{
- size: sizeInt64Slice,
- marshal: appendInt64Slice,
- unmarshal: consumeInt64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeInt64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Int64.
-func sizeInt64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.
-func appendInt64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(uint64(v))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, uint64(v))
- }
- return b, nil
-}
-
-var coderInt64PackedSlice = pointerCoderFuncs{
- size: sizeInt64PackedSlice,
- marshal: appendInt64PackedSlice,
- unmarshal: consumeInt64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeInt64Value returns the size of wire encoding a int64 value as a Int64.
-func sizeInt64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(uint64(v.Int()))
-}
-
-// appendInt64Value encodes a int64 value as a Int64.
-func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(v.Int()))
- return b, nil
-}
-
-// consumeInt64Value decodes a int64 value as a Int64.
-func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt64(int64(v)), out, nil
-}
-
-var coderInt64Value = valueCoderFuncs{
- size: sizeInt64Value,
- marshal: appendInt64Value,
- unmarshal: consumeInt64Value,
- merge: mergeScalarValue,
-}
-
-// sizeInt64SliceValue returns the size of wire encoding a []int64 value as a repeated Int64.
-func sizeInt64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(uint64(v.Int()))
- }
- return size
-}
-
-// appendInt64SliceValue encodes a []int64 value as a repeated Int64.
-func appendInt64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, uint64(v.Int()))
- }
- return b, nil
-}
-
-// consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64.
-func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderInt64SliceValue = valueCoderFuncs{
- size: sizeInt64SliceValue,
- marshal: appendInt64SliceValue,
- unmarshal: consumeInt64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeInt64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Int64.
-func sizeInt64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(v.Int()))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64.
-func appendInt64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(uint64(v.Int()))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, uint64(v.Int()))
- }
- return b, nil
-}
-
-var coderInt64PackedSliceValue = valueCoderFuncs{
- size: sizeInt64PackedSliceValue,
- marshal: appendInt64PackedSliceValue,
- unmarshal: consumeInt64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
-func sizeSint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int64()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
-}
-
-// appendSint64 wire encodes a int64 pointer as a Sint64.
-func appendSint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
- return b, nil
-}
-
-// consumeSint64 wire decodes a int64 pointer as a Sint64.
-func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Int64() = protowire.DecodeZigZag(v)
- out.n = n
- return out, nil
-}
-
-var coderSint64 = pointerCoderFuncs{
- size: sizeSint64,
- marshal: appendSint64,
- unmarshal: consumeSint64,
- merge: mergeInt64,
-}
-
-// sizeSint64NoZero returns the size of wire encoding a int64 pointer as a Sint64.
-// The zero value is not encoded.
-func sizeSint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int64()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
-}
-
-// appendSint64NoZero wire encodes a int64 pointer as a Sint64.
-// The zero value is not encoded.
-func appendSint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
- return b, nil
-}
-
-var coderSint64NoZero = pointerCoderFuncs{
- size: sizeSint64NoZero,
- marshal: appendSint64NoZero,
- unmarshal: consumeSint64,
- merge: mergeInt64NoZero,
-}
-
-// sizeSint64Ptr returns the size of wire encoding a *int64 pointer as a Sint64.
-// It panics if the pointer is nil.
-func sizeSint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Int64Ptr()
- return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
-}
-
-// appendSint64Ptr wire encodes a *int64 pointer as a Sint64.
-// It panics if the pointer is nil.
-func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
- return b, nil
-}
-
-// consumeSint64Ptr wire decodes a *int64 pointer as a Sint64.
-func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int64Ptr()
- if *vp == nil {
- *vp = new(int64)
- }
- **vp = protowire.DecodeZigZag(v)
- out.n = n
- return out, nil
-}
-
-var coderSint64Ptr = pointerCoderFuncs{
- size: sizeSint64Ptr,
- marshal: appendSint64Ptr,
- unmarshal: consumeSint64Ptr,
- merge: mergeInt64Ptr,
-}
-
-// sizeSint64Slice returns the size of wire encoding a []int64 pointer as a repeated Sint64.
-func sizeSint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
- }
- return size
-}
-
-// appendSint64Slice encodes a []int64 pointer as a repeated Sint64.
-func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
- }
- return b, nil
-}
-
-// consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64.
-func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growInt64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, protowire.DecodeZigZag(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, protowire.DecodeZigZag(v))
- out.n = n
- return out, nil
-}
-
-var coderSint64Slice = pointerCoderFuncs{
- size: sizeSint64Slice,
- marshal: appendSint64Slice,
- unmarshal: consumeSint64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeSint64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sint64.
-func sizeSint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeZigZag(v))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.
-func appendSint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(protowire.EncodeZigZag(v))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
- }
- return b, nil
-}
-
-var coderSint64PackedSlice = pointerCoderFuncs{
- size: sizeSint64PackedSlice,
- marshal: appendSint64PackedSlice,
- unmarshal: consumeSint64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeSint64Value returns the size of wire encoding a int64 value as a Sint64.
-func sizeSint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
-}
-
-// appendSint64Value encodes a int64 value as a Sint64.
-func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
- return b, nil
-}
-
-// consumeSint64Value decodes a int64 value as a Sint64.
-func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil
-}
-
-var coderSint64Value = valueCoderFuncs{
- size: sizeSint64Value,
- marshal: appendSint64Value,
- unmarshal: consumeSint64Value,
- merge: mergeScalarValue,
-}
-
-// sizeSint64SliceValue returns the size of wire encoding a []int64 value as a repeated Sint64.
-func sizeSint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
- }
- return size
-}
-
-// appendSint64SliceValue encodes a []int64 value as a repeated Sint64.
-func appendSint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
- }
- return b, nil
-}
-
-// consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64.
-func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderSint64SliceValue = valueCoderFuncs{
- size: sizeSint64SliceValue,
- marshal: appendSint64SliceValue,
- unmarshal: consumeSint64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSint64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sint64.
-func sizeSint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64.
-func appendSint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
- }
- return b, nil
-}
-
-var coderSint64PackedSliceValue = valueCoderFuncs{
- size: sizeSint64PackedSliceValue,
- marshal: appendSint64PackedSliceValue,
- unmarshal: consumeSint64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
-func sizeUint64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint64()
- return f.tagsize + protowire.SizeVarint(v)
-}
-
-// appendUint64 wire encodes a uint64 pointer as a Uint64.
-func appendUint64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, v)
- return b, nil
-}
-
-// consumeUint64 wire decodes a uint64 pointer as a Uint64.
-func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *p.Uint64() = v
- out.n = n
- return out, nil
-}
-
-var coderUint64 = pointerCoderFuncs{
- size: sizeUint64,
- marshal: appendUint64,
- unmarshal: consumeUint64,
- merge: mergeUint64,
-}
-
-// sizeUint64NoZero returns the size of wire encoding a uint64 pointer as a Uint64.
-// The zero value is not encoded.
-func sizeUint64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint64()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeVarint(v)
-}
-
-// appendUint64NoZero wire encodes a uint64 pointer as a Uint64.
-// The zero value is not encoded.
-func appendUint64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint64()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, v)
- return b, nil
-}
-
-var coderUint64NoZero = pointerCoderFuncs{
- size: sizeUint64NoZero,
- marshal: appendUint64NoZero,
- unmarshal: consumeUint64,
- merge: mergeUint64NoZero,
-}
-
-// sizeUint64Ptr returns the size of wire encoding a *uint64 pointer as a Uint64.
-// It panics if the pointer is nil.
-func sizeUint64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.Uint64Ptr()
- return f.tagsize + protowire.SizeVarint(v)
-}
-
-// appendUint64Ptr wire encodes a *uint64 pointer as a Uint64.
-// It panics if the pointer is nil.
-func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Uint64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, v)
- return b, nil
-}
-
-// consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64.
-func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- vp := p.Uint64Ptr()
- if *vp == nil {
- *vp = new(uint64)
- }
- **vp = v
- out.n = n
- return out, nil
-}
-
-var coderUint64Ptr = pointerCoderFuncs{
- size: sizeUint64Ptr,
- marshal: appendUint64Ptr,
- unmarshal: consumeUint64Ptr,
- merge: mergeUint64Ptr,
-}
-
-// sizeUint64Slice returns the size of wire encoding a []uint64 pointer as a repeated Uint64.
-func sizeUint64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint64Slice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeVarint(v)
- }
- return size
-}
-
-// appendUint64Slice encodes a []uint64 pointer as a repeated Uint64.
-func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, v)
- }
- return b, nil
-}
-
-// consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64.
-func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Uint64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := 0
- for _, v := range b {
- if v < 0x80 {
- count++
- }
- }
- if count > 0 {
- p.growUint64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- s = append(s, v)
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, v)
- out.n = n
- return out, nil
-}
-
-var coderUint64Slice = pointerCoderFuncs{
- size: sizeUint64Slice,
- marshal: appendUint64Slice,
- unmarshal: consumeUint64Slice,
- merge: mergeUint64Slice,
-}
-
-// sizeUint64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Uint64.
-func sizeUint64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint64Slice()
- if len(s) == 0 {
- return 0
- }
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(v)
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.
-func appendUint64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for _, v := range s {
- n += protowire.SizeVarint(v)
- }
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendVarint(b, v)
- }
- return b, nil
-}
-
-var coderUint64PackedSlice = pointerCoderFuncs{
- size: sizeUint64PackedSlice,
- marshal: appendUint64PackedSlice,
- unmarshal: consumeUint64Slice,
- merge: mergeUint64Slice,
-}
-
-// sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64.
-func sizeUint64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeVarint(v.Uint())
-}
-
-// appendUint64Value encodes a uint64 value as a Uint64.
-func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, v.Uint())
- return b, nil
-}
-
-// consumeUint64Value decodes a uint64 value as a Uint64.
-func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfUint64(v), out, nil
-}
-
-var coderUint64Value = valueCoderFuncs{
- size: sizeUint64Value,
- marshal: appendUint64Value,
- unmarshal: consumeUint64Value,
- merge: mergeScalarValue,
-}
-
-// sizeUint64SliceValue returns the size of wire encoding a []uint64 value as a repeated Uint64.
-func sizeUint64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeVarint(v.Uint())
- }
- return size
-}
-
-// appendUint64SliceValue encodes a []uint64 value as a repeated Uint64.
-func appendUint64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendVarint(b, v.Uint())
- }
- return b, nil
-}
-
-// consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64.
-func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.VarintType {
- return protoreflect.Value{}, out, errUnknown
- }
- var v uint64
- var n int
- if len(b) >= 1 && b[0] < 0x80 {
- v = uint64(b[0])
- n = 1
- } else if len(b) >= 2 && b[1] < 128 {
- v = uint64(b[0]&0x7f) + uint64(b[1])<<7
- n = 2
- } else {
- v, n = protowire.ConsumeVarint(b)
- }
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- out.n = n
- return listv, out, nil
-}
-
-var coderUint64SliceValue = valueCoderFuncs{
- size: sizeUint64SliceValue,
- marshal: appendUint64SliceValue,
- unmarshal: consumeUint64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeUint64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Uint64.
-func sizeUint64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i, llen := 0, llen; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(v.Uint())
- }
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64.
-func appendUint64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- n += protowire.SizeVarint(v.Uint())
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, v.Uint())
- }
- return b, nil
-}
-
-var coderUint64PackedSliceValue = valueCoderFuncs{
- size: sizeUint64PackedSliceValue,
- marshal: appendUint64PackedSliceValue,
- unmarshal: consumeUint64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
-func sizeSfixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
-func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, uint32(v))
- return b, nil
-}
-
-// consumeSfixed32 wire decodes a int32 pointer as a Sfixed32.
-func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Int32() = int32(v)
- out.n = n
- return out, nil
-}
-
-var coderSfixed32 = pointerCoderFuncs{
- size: sizeSfixed32,
- marshal: appendSfixed32,
- unmarshal: consumeSfixed32,
- merge: mergeInt32,
-}
-
-// sizeSfixed32NoZero returns the size of wire encoding a int32 pointer as a Sfixed32.
-// The zero value is not encoded.
-func sizeSfixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int32()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32.
-// The zero value is not encoded.
-func appendSfixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int32()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, uint32(v))
- return b, nil
-}
-
-var coderSfixed32NoZero = pointerCoderFuncs{
- size: sizeSfixed32NoZero,
- marshal: appendSfixed32NoZero,
- unmarshal: consumeSfixed32,
- merge: mergeInt32NoZero,
-}
-
-// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.
-// It panics if the pointer is nil.
-func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32.
-// It panics if the pointer is nil.
-func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, uint32(v))
- return b, nil
-}
-
-// consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32.
-func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int32Ptr()
- if *vp == nil {
- *vp = new(int32)
- }
- **vp = int32(v)
- out.n = n
- return out, nil
-}
-
-var coderSfixed32Ptr = pointerCoderFuncs{
- size: sizeSfixed32Ptr,
- marshal: appendSfixed32Ptr,
- unmarshal: consumeSfixed32Ptr,
- merge: mergeInt32Ptr,
-}
-
-// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.
-func sizeSfixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendSfixed32Slice encodes a []int32 pointer as a repeated Sfixed32.
-func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, uint32(v))
- }
- return b, nil
-}
-
-// consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32.
-func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed32()
- if count > 0 {
- p.growInt32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, int32(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, int32(v))
- out.n = n
- return out, nil
-}
-
-var coderSfixed32Slice = pointerCoderFuncs{
- size: sizeSfixed32Slice,
- marshal: appendSfixed32Slice,
- unmarshal: consumeSfixed32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeSfixed32PackedSlice returns the size of wire encoding a []int32 pointer as a packed repeated Sfixed32.
-func sizeSfixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed32()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.
-func appendSfixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed32(b, uint32(v))
- }
- return b, nil
-}
-
-var coderSfixed32PackedSlice = pointerCoderFuncs{
- size: sizeSfixed32PackedSlice,
- marshal: appendSfixed32PackedSlice,
- unmarshal: consumeSfixed32Slice,
- merge: mergeInt32Slice,
-}
-
-// sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32.
-func sizeSfixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed32()
-}
-
-// appendSfixed32Value encodes a int32 value as a Sfixed32.
-func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, uint32(v.Int()))
- return b, nil
-}
-
-// consumeSfixed32Value decodes a int32 value as a Sfixed32.
-func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt32(int32(v)), out, nil
-}
-
-var coderSfixed32Value = valueCoderFuncs{
- size: sizeSfixed32Value,
- marshal: appendSfixed32Value,
- unmarshal: consumeSfixed32Value,
- merge: mergeScalarValue,
-}
-
-// sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32.
-func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendSfixed32SliceValue encodes a []int32 value as a repeated Sfixed32.
-func appendSfixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, uint32(v.Int()))
- }
- return b, nil
-}
-
-// consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32.
-func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderSfixed32SliceValue = valueCoderFuncs{
- size: sizeSfixed32SliceValue,
- marshal: appendSfixed32SliceValue,
- unmarshal: consumeSfixed32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSfixed32PackedSliceValue returns the size of wire encoding a []int32 value as a packed repeated Sfixed32.
-func sizeSfixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed32()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32.
-func appendSfixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed32(b, uint32(v.Int()))
- }
- return b, nil
-}
-
-var coderSfixed32PackedSliceValue = valueCoderFuncs{
- size: sizeSfixed32PackedSliceValue,
- marshal: appendSfixed32PackedSliceValue,
- unmarshal: consumeSfixed32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
-func sizeFixed32(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
-func appendFixed32(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, v)
- return b, nil
-}
-
-// consumeFixed32 wire decodes a uint32 pointer as a Fixed32.
-func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Uint32() = v
- out.n = n
- return out, nil
-}
-
-var coderFixed32 = pointerCoderFuncs{
- size: sizeFixed32,
- marshal: appendFixed32,
- unmarshal: consumeFixed32,
- merge: mergeUint32,
-}
-
-// sizeFixed32NoZero returns the size of wire encoding a uint32 pointer as a Fixed32.
-// The zero value is not encoded.
-func sizeFixed32NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint32()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32.
-// The zero value is not encoded.
-func appendFixed32NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint32()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, v)
- return b, nil
-}
-
-var coderFixed32NoZero = pointerCoderFuncs{
- size: sizeFixed32NoZero,
- marshal: appendFixed32NoZero,
- unmarshal: consumeFixed32,
- merge: mergeUint32NoZero,
-}
-
-// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.
-// It panics if the pointer is nil.
-func sizeFixed32Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32.
-// It panics if the pointer is nil.
-func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Uint32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, v)
- return b, nil
-}
-
-// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.
-func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Uint32Ptr()
- if *vp == nil {
- *vp = new(uint32)
- }
- **vp = v
- out.n = n
- return out, nil
-}
-
-var coderFixed32Ptr = pointerCoderFuncs{
- size: sizeFixed32Ptr,
- marshal: appendFixed32Ptr,
- unmarshal: consumeFixed32Ptr,
- merge: mergeUint32Ptr,
-}
-
-// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.
-func sizeFixed32Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint32Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendFixed32Slice encodes a []uint32 pointer as a repeated Fixed32.
-func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, v)
- }
- return b, nil
-}
-
-// consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32.
-func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Uint32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed32()
- if count > 0 {
- p.growUint32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, v)
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, v)
- out.n = n
- return out, nil
-}
-
-var coderFixed32Slice = pointerCoderFuncs{
- size: sizeFixed32Slice,
- marshal: appendFixed32Slice,
- unmarshal: consumeFixed32Slice,
- merge: mergeUint32Slice,
-}
-
-// sizeFixed32PackedSlice returns the size of wire encoding a []uint32 pointer as a packed repeated Fixed32.
-func sizeFixed32PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint32Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed32()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.
-func appendFixed32PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed32(b, v)
- }
- return b, nil
-}
-
-var coderFixed32PackedSlice = pointerCoderFuncs{
- size: sizeFixed32PackedSlice,
- marshal: appendFixed32PackedSlice,
- unmarshal: consumeFixed32Slice,
- merge: mergeUint32Slice,
-}
-
-// sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32.
-func sizeFixed32Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed32()
-}
-
-// appendFixed32Value encodes a uint32 value as a Fixed32.
-func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, uint32(v.Uint()))
- return b, nil
-}
-
-// consumeFixed32Value decodes a uint32 value as a Fixed32.
-func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfUint32(uint32(v)), out, nil
-}
-
-var coderFixed32Value = valueCoderFuncs{
- size: sizeFixed32Value,
- marshal: appendFixed32Value,
- unmarshal: consumeFixed32Value,
- merge: mergeScalarValue,
-}
-
-// sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32.
-func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendFixed32SliceValue encodes a []uint32 value as a repeated Fixed32.
-func appendFixed32SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, uint32(v.Uint()))
- }
- return b, nil
-}
-
-// consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32.
-func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderFixed32SliceValue = valueCoderFuncs{
- size: sizeFixed32SliceValue,
- marshal: appendFixed32SliceValue,
- unmarshal: consumeFixed32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeFixed32PackedSliceValue returns the size of wire encoding a []uint32 value as a packed repeated Fixed32.
-func sizeFixed32PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed32()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32.
-func appendFixed32PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed32(b, uint32(v.Uint()))
- }
- return b, nil
-}
-
-var coderFixed32PackedSliceValue = valueCoderFuncs{
- size: sizeFixed32PackedSliceValue,
- marshal: appendFixed32PackedSliceValue,
- unmarshal: consumeFixed32SliceValue,
- merge: mergeListValue,
-}
-
-// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
-func sizeFloat(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFloat wire encodes a float32 pointer as a Float.
-func appendFloat(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Float32()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(v))
- return b, nil
-}
-
-// consumeFloat wire decodes a float32 pointer as a Float.
-func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Float32() = math.Float32frombits(v)
- out.n = n
- return out, nil
-}
-
-var coderFloat = pointerCoderFuncs{
- size: sizeFloat,
- marshal: appendFloat,
- unmarshal: consumeFloat,
- merge: mergeFloat32,
-}
-
-// sizeFloatNoZero returns the size of wire encoding a float32 pointer as a Float.
-// The zero value is not encoded.
-func sizeFloatNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Float32()
- if v == 0 && !math.Signbit(float64(v)) {
- return 0
- }
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFloatNoZero wire encodes a float32 pointer as a Float.
-// The zero value is not encoded.
-func appendFloatNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Float32()
- if v == 0 && !math.Signbit(float64(v)) {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(v))
- return b, nil
-}
-
-var coderFloatNoZero = pointerCoderFuncs{
- size: sizeFloatNoZero,
- marshal: appendFloatNoZero,
- unmarshal: consumeFloat,
- merge: mergeFloat32NoZero,
-}
-
-// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.
-// It panics if the pointer is nil.
-func sizeFloatPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed32()
-}
-
-// appendFloatPtr wire encodes a *float32 pointer as a Float.
-// It panics if the pointer is nil.
-func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Float32Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(v))
- return b, nil
-}
-
-// consumeFloatPtr wire decodes a *float32 pointer as a Float.
-func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Float32Ptr()
- if *vp == nil {
- *vp = new(float32)
- }
- **vp = math.Float32frombits(v)
- out.n = n
- return out, nil
-}
-
-var coderFloatPtr = pointerCoderFuncs{
- size: sizeFloatPtr,
- marshal: appendFloatPtr,
- unmarshal: consumeFloatPtr,
- merge: mergeFloat32Ptr,
-}
-
-// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.
-func sizeFloatSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Float32Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendFloatSlice encodes a []float32 pointer as a repeated Float.
-func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Float32Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-
-// consumeFloatSlice wire decodes a []float32 pointer as a repeated Float.
-func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Float32Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed32()
- if count > 0 {
- p.growFloat32Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, math.Float32frombits(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, math.Float32frombits(v))
- out.n = n
- return out, nil
-}
-
-var coderFloatSlice = pointerCoderFuncs{
- size: sizeFloatSlice,
- marshal: appendFloatSlice,
- unmarshal: consumeFloatSlice,
- merge: mergeFloat32Slice,
-}
-
-// sizeFloatPackedSlice returns the size of wire encoding a []float32 pointer as a packed repeated Float.
-func sizeFloatPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Float32Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed32()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.
-func appendFloatPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Float32Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed32(b, math.Float32bits(v))
- }
- return b, nil
-}
-
-var coderFloatPackedSlice = pointerCoderFuncs{
- size: sizeFloatPackedSlice,
- marshal: appendFloatPackedSlice,
- unmarshal: consumeFloatSlice,
- merge: mergeFloat32Slice,
-}
-
-// sizeFloatValue returns the size of wire encoding a float32 value as a Float.
-func sizeFloatValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed32()
-}
-
-// appendFloatValue encodes a float32 value as a Float.
-func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
- return b, nil
-}
-
-// consumeFloatValue decodes a float32 value as a Float.
-func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil
-}
-
-var coderFloatValue = valueCoderFuncs{
- size: sizeFloatValue,
- marshal: appendFloatValue,
- unmarshal: consumeFloatValue,
- merge: mergeScalarValue,
-}
-
-// sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float.
-func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed32())
- return size
-}
-
-// appendFloatSliceValue encodes a []float32 value as a repeated Float.
-func appendFloatSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
- }
- return b, nil
-}
-
-// consumeFloatSliceValue wire decodes a []float32 value as a repeated Float.
-func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed32Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
- out.n = n
- return listv, out, nil
-}
-
-var coderFloatSliceValue = valueCoderFuncs{
- size: sizeFloatSliceValue,
- marshal: appendFloatSliceValue,
- unmarshal: consumeFloatSliceValue,
- merge: mergeListValue,
-}
-
-// sizeFloatPackedSliceValue returns the size of wire encoding a []float32 value as a packed repeated Float.
-func sizeFloatPackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed32()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float.
-func appendFloatPackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed32()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
- }
- return b, nil
-}
-
-var coderFloatPackedSliceValue = valueCoderFuncs{
- size: sizeFloatPackedSliceValue,
- marshal: appendFloatPackedSliceValue,
- unmarshal: consumeFloatSliceValue,
- merge: mergeListValue,
-}
-
-// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
-func sizeSfixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
-func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, uint64(v))
- return b, nil
-}
-
-// consumeSfixed64 wire decodes a int64 pointer as a Sfixed64.
-func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Int64() = int64(v)
- out.n = n
- return out, nil
-}
-
-var coderSfixed64 = pointerCoderFuncs{
- size: sizeSfixed64,
- marshal: appendSfixed64,
- unmarshal: consumeSfixed64,
- merge: mergeInt64,
-}
-
-// sizeSfixed64NoZero returns the size of wire encoding a int64 pointer as a Sfixed64.
-// The zero value is not encoded.
-func sizeSfixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Int64()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64.
-// The zero value is not encoded.
-func appendSfixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Int64()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, uint64(v))
- return b, nil
-}
-
-var coderSfixed64NoZero = pointerCoderFuncs{
- size: sizeSfixed64NoZero,
- marshal: appendSfixed64NoZero,
- unmarshal: consumeSfixed64,
- merge: mergeInt64NoZero,
-}
-
-// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.
-// It panics if the pointer is nil.
-func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64.
-// It panics if the pointer is nil.
-func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Int64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, uint64(v))
- return b, nil
-}
-
-// consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64.
-func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Int64Ptr()
- if *vp == nil {
- *vp = new(int64)
- }
- **vp = int64(v)
- out.n = n
- return out, nil
-}
-
-var coderSfixed64Ptr = pointerCoderFuncs{
- size: sizeSfixed64Ptr,
- marshal: appendSfixed64Ptr,
- unmarshal: consumeSfixed64Ptr,
- merge: mergeInt64Ptr,
-}
-
-// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.
-func sizeSfixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendSfixed64Slice encodes a []int64 pointer as a repeated Sfixed64.
-func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, uint64(v))
- }
- return b, nil
-}
-
-// consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64.
-func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Int64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed64()
- if count > 0 {
- p.growInt64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, int64(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, int64(v))
- out.n = n
- return out, nil
-}
-
-var coderSfixed64Slice = pointerCoderFuncs{
- size: sizeSfixed64Slice,
- marshal: appendSfixed64Slice,
- unmarshal: consumeSfixed64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeSfixed64PackedSlice returns the size of wire encoding a []int64 pointer as a packed repeated Sfixed64.
-func sizeSfixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed64()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.
-func appendSfixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Int64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed64(b, uint64(v))
- }
- return b, nil
-}
-
-var coderSfixed64PackedSlice = pointerCoderFuncs{
- size: sizeSfixed64PackedSlice,
- marshal: appendSfixed64PackedSlice,
- unmarshal: consumeSfixed64Slice,
- merge: mergeInt64Slice,
-}
-
-// sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64.
-func sizeSfixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed64()
-}
-
-// appendSfixed64Value encodes a int64 value as a Sfixed64.
-func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, uint64(v.Int()))
- return b, nil
-}
-
-// consumeSfixed64Value decodes a int64 value as a Sfixed64.
-func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfInt64(int64(v)), out, nil
-}
-
-var coderSfixed64Value = valueCoderFuncs{
- size: sizeSfixed64Value,
- marshal: appendSfixed64Value,
- unmarshal: consumeSfixed64Value,
- merge: mergeScalarValue,
-}
-
-// sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64.
-func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendSfixed64SliceValue encodes a []int64 value as a repeated Sfixed64.
-func appendSfixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, uint64(v.Int()))
- }
- return b, nil
-}
-
-// consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64.
-func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderSfixed64SliceValue = valueCoderFuncs{
- size: sizeSfixed64SliceValue,
- marshal: appendSfixed64SliceValue,
- unmarshal: consumeSfixed64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeSfixed64PackedSliceValue returns the size of wire encoding a []int64 value as a packed repeated Sfixed64.
-func sizeSfixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed64()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64.
-func appendSfixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed64(b, uint64(v.Int()))
- }
- return b, nil
-}
-
-var coderSfixed64PackedSliceValue = valueCoderFuncs{
- size: sizeSfixed64PackedSliceValue,
- marshal: appendSfixed64PackedSliceValue,
- unmarshal: consumeSfixed64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
-func sizeFixed64(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
-func appendFixed64(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, v)
- return b, nil
-}
-
-// consumeFixed64 wire decodes a uint64 pointer as a Fixed64.
-func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Uint64() = v
- out.n = n
- return out, nil
-}
-
-var coderFixed64 = pointerCoderFuncs{
- size: sizeFixed64,
- marshal: appendFixed64,
- unmarshal: consumeFixed64,
- merge: mergeUint64,
-}
-
-// sizeFixed64NoZero returns the size of wire encoding a uint64 pointer as a Fixed64.
-// The zero value is not encoded.
-func sizeFixed64NoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Uint64()
- if v == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64.
-// The zero value is not encoded.
-func appendFixed64NoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Uint64()
- if v == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, v)
- return b, nil
-}
-
-var coderFixed64NoZero = pointerCoderFuncs{
- size: sizeFixed64NoZero,
- marshal: appendFixed64NoZero,
- unmarshal: consumeFixed64,
- merge: mergeUint64NoZero,
-}
-
-// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.
-// It panics if the pointer is nil.
-func sizeFixed64Ptr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64.
-// It panics if the pointer is nil.
-func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Uint64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, v)
- return b, nil
-}
-
-// consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64.
-func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Uint64Ptr()
- if *vp == nil {
- *vp = new(uint64)
- }
- **vp = v
- out.n = n
- return out, nil
-}
-
-var coderFixed64Ptr = pointerCoderFuncs{
- size: sizeFixed64Ptr,
- marshal: appendFixed64Ptr,
- unmarshal: consumeFixed64Ptr,
- merge: mergeUint64Ptr,
-}
-
-// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.
-func sizeFixed64Slice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint64Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendFixed64Slice encodes a []uint64 pointer as a repeated Fixed64.
-func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, v)
- }
- return b, nil
-}
-
-// consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64.
-func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Uint64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed64()
- if count > 0 {
- p.growUint64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, v)
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, v)
- out.n = n
- return out, nil
-}
-
-var coderFixed64Slice = pointerCoderFuncs{
- size: sizeFixed64Slice,
- marshal: appendFixed64Slice,
- unmarshal: consumeFixed64Slice,
- merge: mergeUint64Slice,
-}
-
-// sizeFixed64PackedSlice returns the size of wire encoding a []uint64 pointer as a packed repeated Fixed64.
-func sizeFixed64PackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Uint64Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed64()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.
-func appendFixed64PackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Uint64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed64(b, v)
- }
- return b, nil
-}
-
-var coderFixed64PackedSlice = pointerCoderFuncs{
- size: sizeFixed64PackedSlice,
- marshal: appendFixed64PackedSlice,
- unmarshal: consumeFixed64Slice,
- merge: mergeUint64Slice,
-}
-
-// sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64.
-func sizeFixed64Value(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed64()
-}
-
-// appendFixed64Value encodes a uint64 value as a Fixed64.
-func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, v.Uint())
- return b, nil
-}
-
-// consumeFixed64Value decodes a uint64 value as a Fixed64.
-func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfUint64(v), out, nil
-}
-
-var coderFixed64Value = valueCoderFuncs{
- size: sizeFixed64Value,
- marshal: appendFixed64Value,
- unmarshal: consumeFixed64Value,
- merge: mergeScalarValue,
-}
-
-// sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64.
-func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendFixed64SliceValue encodes a []uint64 value as a repeated Fixed64.
-func appendFixed64SliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, v.Uint())
- }
- return b, nil
-}
-
-// consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64.
-func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- out.n = n
- return listv, out, nil
-}
-
-var coderFixed64SliceValue = valueCoderFuncs{
- size: sizeFixed64SliceValue,
- marshal: appendFixed64SliceValue,
- unmarshal: consumeFixed64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeFixed64PackedSliceValue returns the size of wire encoding a []uint64 value as a packed repeated Fixed64.
-func sizeFixed64PackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed64()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64.
-func appendFixed64PackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed64(b, v.Uint())
- }
- return b, nil
-}
-
-var coderFixed64PackedSliceValue = valueCoderFuncs{
- size: sizeFixed64PackedSliceValue,
- marshal: appendFixed64PackedSliceValue,
- unmarshal: consumeFixed64SliceValue,
- merge: mergeListValue,
-}
-
-// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
-func sizeDouble(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
-
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendDouble wire encodes a float64 pointer as a Double.
-func appendDouble(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Float64()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v))
- return b, nil
-}
-
-// consumeDouble wire decodes a float64 pointer as a Double.
-func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Float64() = math.Float64frombits(v)
- out.n = n
- return out, nil
-}
-
-var coderDouble = pointerCoderFuncs{
- size: sizeDouble,
- marshal: appendDouble,
- unmarshal: consumeDouble,
- merge: mergeFloat64,
-}
-
-// sizeDoubleNoZero returns the size of wire encoding a float64 pointer as a Double.
-// The zero value is not encoded.
-func sizeDoubleNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Float64()
- if v == 0 && !math.Signbit(float64(v)) {
- return 0
- }
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendDoubleNoZero wire encodes a float64 pointer as a Double.
-// The zero value is not encoded.
-func appendDoubleNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Float64()
- if v == 0 && !math.Signbit(float64(v)) {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v))
- return b, nil
-}
-
-var coderDoubleNoZero = pointerCoderFuncs{
- size: sizeDoubleNoZero,
- marshal: appendDoubleNoZero,
- unmarshal: consumeDouble,
- merge: mergeFloat64NoZero,
-}
-
-// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.
-// It panics if the pointer is nil.
-func sizeDoublePtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return f.tagsize + protowire.SizeFixed64()
-}
-
-// appendDoublePtr wire encodes a *float64 pointer as a Double.
-// It panics if the pointer is nil.
-func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.Float64Ptr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v))
- return b, nil
-}
-
-// consumeDoublePtr wire decodes a *float64 pointer as a Double.
-func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.Float64Ptr()
- if *vp == nil {
- *vp = new(float64)
- }
- **vp = math.Float64frombits(v)
- out.n = n
- return out, nil
-}
-
-var coderDoublePtr = pointerCoderFuncs{
- size: sizeDoublePtr,
- marshal: appendDoublePtr,
- unmarshal: consumeDoublePtr,
- merge: mergeFloat64Ptr,
-}
-
-// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.
-func sizeDoubleSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Float64Slice()
- size = len(s) * (f.tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendDoubleSlice encodes a []float64 pointer as a repeated Double.
-func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Float64Slice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-
-// consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double.
-func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.Float64Slice()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- count := len(b) / protowire.SizeFixed64()
- if count > 0 {
- p.growFloat64Slice(count)
- }
- s := *sp
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- s = append(s, math.Float64frombits(v))
- b = b[n:]
- }
- *sp = s
- out.n = n
- return out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, math.Float64frombits(v))
- out.n = n
- return out, nil
-}
-
-var coderDoubleSlice = pointerCoderFuncs{
- size: sizeDoubleSlice,
- marshal: appendDoubleSlice,
- unmarshal: consumeDoubleSlice,
- merge: mergeFloat64Slice,
-}
-
-// sizeDoublePackedSlice returns the size of wire encoding a []float64 pointer as a packed repeated Double.
-func sizeDoublePackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.Float64Slice()
- if len(s) == 0 {
- return 0
- }
- n := len(s) * protowire.SizeFixed64()
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.
-func appendDoublePackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.Float64Slice()
- if len(s) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := len(s) * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for _, v := range s {
- b = protowire.AppendFixed64(b, math.Float64bits(v))
- }
- return b, nil
-}
-
-var coderDoublePackedSlice = pointerCoderFuncs{
- size: sizeDoublePackedSlice,
- marshal: appendDoublePackedSlice,
- unmarshal: consumeDoubleSlice,
- merge: mergeFloat64Slice,
-}
-
-// sizeDoubleValue returns the size of wire encoding a float64 value as a Double.
-func sizeDoubleValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeFixed64()
-}
-
-// appendDoubleValue encodes a float64 value as a Double.
-func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
- return b, nil
-}
-
-// consumeDoubleValue decodes a float64 value as a Double.
-func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil
-}
-
-var coderDoubleValue = valueCoderFuncs{
- size: sizeDoubleValue,
- marshal: appendDoubleValue,
- unmarshal: consumeDoubleValue,
- merge: mergeScalarValue,
-}
-
-// sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double.
-func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- size = list.Len() * (tagsize + protowire.SizeFixed64())
- return size
-}
-
-// appendDoubleSliceValue encodes a []float64 value as a repeated Double.
-func appendDoubleSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
- }
- return b, nil
-}
-
-// consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double.
-func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
- b = b[n:]
- }
- out.n = n
- return listv, out, nil
- }
- if wtyp != protowire.Fixed64Type {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderDoubleSliceValue = valueCoderFuncs{
- size: sizeDoubleSliceValue,
- marshal: appendDoubleSliceValue,
- unmarshal: consumeDoubleSliceValue,
- merge: mergeListValue,
-}
-
-// sizeDoublePackedSliceValue returns the size of wire encoding a []float64 value as a packed repeated Double.
-func sizeDoublePackedSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return 0
- }
- n := llen * protowire.SizeFixed64()
- return tagsize + protowire.SizeBytes(n)
-}
-
-// appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double.
-func appendDoublePackedSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- llen := list.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, wiretag)
- n := llen * protowire.SizeFixed64()
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
- }
- return b, nil
-}
-
-var coderDoublePackedSliceValue = valueCoderFuncs{
- size: sizeDoublePackedSliceValue,
- marshal: appendDoublePackedSliceValue,
- unmarshal: consumeDoubleSliceValue,
- merge: mergeListValue,
-}
-
-// sizeString returns the size of wire encoding a string pointer as a String.
-func sizeString(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.String()
- return f.tagsize + protowire.SizeBytes(len(v))
-}
-
-// appendString wire encodes a string pointer as a String.
-func appendString(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.String()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- return b, nil
-}
-
-// consumeString wire decodes a string pointer as a String.
-func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- *p.String() = string(v)
- out.n = n
- return out, nil
-}
-
-var coderString = pointerCoderFuncs{
- size: sizeString,
- marshal: appendString,
- unmarshal: consumeString,
- merge: mergeString,
-}
-
-// appendStringValidateUTF8 wire encodes a string pointer as a String.
-func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.String()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- if !utf8.ValidString(v) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-// consumeStringValidateUTF8 wire decodes a string pointer as a String.
-func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- *p.String() = string(v)
- out.n = n
- return out, nil
-}
-
-var coderStringValidateUTF8 = pointerCoderFuncs{
- size: sizeString,
- marshal: appendStringValidateUTF8,
- unmarshal: consumeStringValidateUTF8,
- merge: mergeString,
-}
-
-// sizeStringNoZero returns the size of wire encoding a string pointer as a String.
-// The zero value is not encoded.
-func sizeStringNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.String()
- if len(v) == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeBytes(len(v))
-}
-
-// appendStringNoZero wire encodes a string pointer as a String.
-// The zero value is not encoded.
-func appendStringNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.String()
- if len(v) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- return b, nil
-}
-
-var coderStringNoZero = pointerCoderFuncs{
- size: sizeStringNoZero,
- marshal: appendStringNoZero,
- unmarshal: consumeString,
- merge: mergeStringNoZero,
-}
-
-// appendStringNoZeroValidateUTF8 wire encodes a string pointer as a String.
-// The zero value is not encoded.
-func appendStringNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.String()
- if len(v) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- if !utf8.ValidString(v) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-var coderStringNoZeroValidateUTF8 = pointerCoderFuncs{
- size: sizeStringNoZero,
- marshal: appendStringNoZeroValidateUTF8,
- unmarshal: consumeStringValidateUTF8,
- merge: mergeStringNoZero,
-}
-
-// sizeStringPtr returns the size of wire encoding a *string pointer as a String.
-// It panics if the pointer is nil.
-func sizeStringPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := **p.StringPtr()
- return f.tagsize + protowire.SizeBytes(len(v))
-}
-
-// appendStringPtr wire encodes a *string pointer as a String.
-// It panics if the pointer is nil.
-func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.StringPtr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- return b, nil
-}
-
-// consumeStringPtr wire decodes a *string pointer as a String.
-func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- vp := p.StringPtr()
- if *vp == nil {
- *vp = new(string)
- }
- **vp = string(v)
- out.n = n
- return out, nil
-}
-
-var coderStringPtr = pointerCoderFuncs{
- size: sizeStringPtr,
- marshal: appendStringPtr,
- unmarshal: consumeStringPtr,
- merge: mergeStringPtr,
-}
-
-// appendStringPtrValidateUTF8 wire encodes a *string pointer as a String.
-// It panics if the pointer is nil.
-func appendStringPtrValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := **p.StringPtr()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- if !utf8.ValidString(v) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-// consumeStringPtrValidateUTF8 wire decodes a *string pointer as a String.
-func consumeStringPtrValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- vp := p.StringPtr()
- if *vp == nil {
- *vp = new(string)
- }
- **vp = string(v)
- out.n = n
- return out, nil
-}
-
-var coderStringPtrValidateUTF8 = pointerCoderFuncs{
- size: sizeStringPtr,
- marshal: appendStringPtrValidateUTF8,
- unmarshal: consumeStringPtrValidateUTF8,
- merge: mergeStringPtr,
-}
-
-// sizeStringSlice returns the size of wire encoding a []string pointer as a repeated String.
-func sizeStringSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.StringSlice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeBytes(len(v))
- }
- return size
-}
-
-// appendStringSlice encodes a []string pointer as a repeated String.
-func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.StringSlice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- }
- return b, nil
-}
-
-// consumeStringSlice wire decodes a []string pointer as a repeated String.
-func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.StringSlice()
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, string(v))
- out.n = n
- return out, nil
-}
-
-var coderStringSlice = pointerCoderFuncs{
- size: sizeStringSlice,
- marshal: appendStringSlice,
- unmarshal: consumeStringSlice,
- merge: mergeStringSlice,
-}
-
-// appendStringSliceValidateUTF8 encodes a []string pointer as a repeated String.
-func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.StringSlice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendString(b, v)
- if !utf8.ValidString(v) {
- return b, errInvalidUTF8{}
- }
- }
- return b, nil
-}
-
-// consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String.
-func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- sp := p.StringSlice()
- *sp = append(*sp, string(v))
- out.n = n
- return out, nil
-}
-
-var coderStringSliceValidateUTF8 = pointerCoderFuncs{
- size: sizeStringSlice,
- marshal: appendStringSliceValidateUTF8,
- unmarshal: consumeStringSliceValidateUTF8,
- merge: mergeStringSlice,
-}
-
-// sizeStringValue returns the size of wire encoding a string value as a String.
-func sizeStringValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeBytes(len(v.String()))
-}
-
-// appendStringValue encodes a string value as a String.
-func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendString(b, v.String())
- return b, nil
-}
-
-// consumeStringValue decodes a string value as a String.
-func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfString(string(v)), out, nil
-}
-
-var coderStringValue = valueCoderFuncs{
- size: sizeStringValue,
- marshal: appendStringValue,
- unmarshal: consumeStringValue,
- merge: mergeScalarValue,
-}
-
-// appendStringValueValidateUTF8 encodes a string value as a String.
-func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendString(b, v.String())
- if !utf8.ValidString(v.String()) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-// consumeStringValueValidateUTF8 decodes a string value as a String.
-func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- if !utf8.Valid(v) {
- return protoreflect.Value{}, out, errInvalidUTF8{}
- }
- out.n = n
- return protoreflect.ValueOfString(string(v)), out, nil
-}
-
-var coderStringValueValidateUTF8 = valueCoderFuncs{
- size: sizeStringValue,
- marshal: appendStringValueValidateUTF8,
- unmarshal: consumeStringValueValidateUTF8,
- merge: mergeScalarValue,
-}
-
-// sizeStringSliceValue returns the size of wire encoding a []string value as a repeated String.
-func sizeStringSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeBytes(len(v.String()))
- }
- return size
-}
-
-// appendStringSliceValue encodes a []string value as a repeated String.
-func appendStringSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendString(b, v.String())
- }
- return b, nil
-}
-
-// consumeStringSliceValue wire decodes a []string value as a repeated String.
-func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfString(string(v)))
- out.n = n
- return listv, out, nil
-}
-
-var coderStringSliceValue = valueCoderFuncs{
- size: sizeStringSliceValue,
- marshal: appendStringSliceValue,
- unmarshal: consumeStringSliceValue,
- merge: mergeListValue,
-}
-
-// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
-func sizeBytes(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Bytes()
- return f.tagsize + protowire.SizeBytes(len(v))
-}
-
-// appendBytes wire encodes a []byte pointer as a Bytes.
-func appendBytes(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bytes()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- return b, nil
-}
-
-// consumeBytes wire decodes a []byte pointer as a Bytes.
-func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Bytes() = append(emptyBuf[:], v...)
- out.n = n
- return out, nil
-}
-
-var coderBytes = pointerCoderFuncs{
- size: sizeBytes,
- marshal: appendBytes,
- unmarshal: consumeBytes,
- merge: mergeBytes,
-}
-
-// appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes.
-func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bytes()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- if !utf8.Valid(v) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-// consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes.
-func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- *p.Bytes() = append(emptyBuf[:], v...)
- out.n = n
- return out, nil
-}
-
-var coderBytesValidateUTF8 = pointerCoderFuncs{
- size: sizeBytes,
- marshal: appendBytesValidateUTF8,
- unmarshal: consumeBytesValidateUTF8,
- merge: mergeBytes,
-}
-
-// sizeBytesNoZero returns the size of wire encoding a []byte pointer as a Bytes.
-// The zero value is not encoded.
-func sizeBytesNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- v := *p.Bytes()
- if len(v) == 0 {
- return 0
- }
- return f.tagsize + protowire.SizeBytes(len(v))
-}
-
-// appendBytesNoZero wire encodes a []byte pointer as a Bytes.
-// The zero value is not encoded.
-func appendBytesNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bytes()
- if len(v) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- return b, nil
-}
-
-// consumeBytesNoZero wire decodes a []byte pointer as a Bytes.
-// The zero value is not decoded.
-func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- *p.Bytes() = append(([]byte)(nil), v...)
- out.n = n
- return out, nil
-}
-
-var coderBytesNoZero = pointerCoderFuncs{
- size: sizeBytesNoZero,
- marshal: appendBytesNoZero,
- unmarshal: consumeBytesNoZero,
- merge: mergeBytesNoZero,
-}
-
-// appendBytesNoZeroValidateUTF8 wire encodes a []byte pointer as a Bytes.
-// The zero value is not encoded.
-func appendBytesNoZeroValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := *p.Bytes()
- if len(v) == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- if !utf8.Valid(v) {
- return b, errInvalidUTF8{}
- }
- return b, nil
-}
-
-// consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes.
-func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- *p.Bytes() = append(([]byte)(nil), v...)
- out.n = n
- return out, nil
-}
-
-var coderBytesNoZeroValidateUTF8 = pointerCoderFuncs{
- size: sizeBytesNoZero,
- marshal: appendBytesNoZeroValidateUTF8,
- unmarshal: consumeBytesNoZeroValidateUTF8,
- merge: mergeBytesNoZero,
-}
-
-// sizeBytesSlice returns the size of wire encoding a [][]byte pointer as a repeated Bytes.
-func sizeBytesSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := *p.BytesSlice()
- for _, v := range s {
- size += f.tagsize + protowire.SizeBytes(len(v))
- }
- return size
-}
-
-// appendBytesSlice encodes a [][]byte pointer as a repeated Bytes.
-func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.BytesSlice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- }
- return b, nil
-}
-
-// consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes.
-func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- sp := p.BytesSlice()
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- *sp = append(*sp, append(emptyBuf[:], v...))
- out.n = n
- return out, nil
-}
-
-var coderBytesSlice = pointerCoderFuncs{
- size: sizeBytesSlice,
- marshal: appendBytesSlice,
- unmarshal: consumeBytesSlice,
- merge: mergeBytesSlice,
-}
-
-// appendBytesSliceValidateUTF8 encodes a [][]byte pointer as a repeated Bytes.
-func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := *p.BytesSlice()
- for _, v := range s {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendBytes(b, v)
- if !utf8.Valid(v) {
- return b, errInvalidUTF8{}
- }
- }
- return b, nil
-}
-
-// consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes.
-func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- if !utf8.Valid(v) {
- return out, errInvalidUTF8{}
- }
- sp := p.BytesSlice()
- *sp = append(*sp, append(emptyBuf[:], v...))
- out.n = n
- return out, nil
-}
-
-var coderBytesSliceValidateUTF8 = pointerCoderFuncs{
- size: sizeBytesSlice,
- marshal: appendBytesSliceValidateUTF8,
- unmarshal: consumeBytesSliceValidateUTF8,
- merge: mergeBytesSlice,
-}
-
-// sizeBytesValue returns the size of wire encoding a []byte value as a Bytes.
-func sizeBytesValue(v protoreflect.Value, tagsize int, opts marshalOptions) int {
- return tagsize + protowire.SizeBytes(len(v.Bytes()))
-}
-
-// appendBytesValue encodes a []byte value as a Bytes.
-func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendBytes(b, v.Bytes())
- return b, nil
-}
-
-// consumeBytesValue decodes a []byte value as a Bytes.
-func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- out.n = n
- return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil
-}
-
-var coderBytesValue = valueCoderFuncs{
- size: sizeBytesValue,
- marshal: appendBytesValue,
- unmarshal: consumeBytesValue,
- merge: mergeBytesValue,
-}
-
-// sizeBytesSliceValue returns the size of wire encoding a [][]byte value as a repeated Bytes.
-func sizeBytesSliceValue(listv protoreflect.Value, tagsize int, opts marshalOptions) (size int) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- size += tagsize + protowire.SizeBytes(len(v.Bytes()))
- }
- return size
-}
-
-// appendBytesSliceValue encodes a [][]byte value as a repeated Bytes.
-func appendBytesSliceValue(b []byte, listv protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error) {
- list := listv.List()
- for i, llen := 0, list.Len(); i < llen; i++ {
- v := list.Get(i)
- b = protowire.AppendVarint(b, wiretag)
- b = protowire.AppendBytes(b, v.Bytes())
- }
- return b, nil
-}
-
-// consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes.
-func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- list := listv.List()
- if wtyp != protowire.BytesType {
- return protoreflect.Value{}, out, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return protoreflect.Value{}, out, errDecode
- }
- list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
- out.n = n
- return listv, out, nil
-}
-
-var coderBytesSliceValue = valueCoderFuncs{
- size: sizeBytesSliceValue,
- marshal: appendBytesSliceValue,
- unmarshal: consumeBytesSliceValue,
- merge: mergeBytesListValue,
-}
-
-// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.
-var emptyBuf [0]byte
-
-var wireTypes = map[protoreflect.Kind]protowire.Type{
- protoreflect.BoolKind: protowire.VarintType,
- protoreflect.EnumKind: protowire.VarintType,
- protoreflect.Int32Kind: protowire.VarintType,
- protoreflect.Sint32Kind: protowire.VarintType,
- protoreflect.Uint32Kind: protowire.VarintType,
- protoreflect.Int64Kind: protowire.VarintType,
- protoreflect.Sint64Kind: protowire.VarintType,
- protoreflect.Uint64Kind: protowire.VarintType,
- protoreflect.Sfixed32Kind: protowire.Fixed32Type,
- protoreflect.Fixed32Kind: protowire.Fixed32Type,
- protoreflect.FloatKind: protowire.Fixed32Type,
- protoreflect.Sfixed64Kind: protowire.Fixed64Type,
- protoreflect.Fixed64Kind: protowire.Fixed64Type,
- protoreflect.DoubleKind: protowire.Fixed64Type,
- protoreflect.StringKind: protowire.BytesType,
- protoreflect.BytesKind: protowire.BytesType,
- protoreflect.MessageKind: protowire.BytesType,
- protoreflect.GroupKind: protowire.StartGroupType,
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
deleted file mode 100644
index 111b9d1..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go
+++ /dev/null
@@ -1,388 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "reflect"
- "sort"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type mapInfo struct {
- goType reflect.Type
- keyWiretag uint64
- valWiretag uint64
- keyFuncs valueCoderFuncs
- valFuncs valueCoderFuncs
- keyZero protoreflect.Value
- keyKind protoreflect.Kind
- conv *mapConverter
-}
-
-func encoderFuncsForMap(fd protoreflect.FieldDescriptor, ft reflect.Type) (valueMessage *MessageInfo, funcs pointerCoderFuncs) {
- // TODO: Consider generating specialized map coders.
- keyField := fd.MapKey()
- valField := fd.MapValue()
- keyWiretag := protowire.EncodeTag(1, wireTypes[keyField.Kind()])
- valWiretag := protowire.EncodeTag(2, wireTypes[valField.Kind()])
- keyFuncs := encoderFuncsForValue(keyField)
- valFuncs := encoderFuncsForValue(valField)
- conv := newMapConverter(ft, fd)
-
- mapi := &mapInfo{
- goType: ft,
- keyWiretag: keyWiretag,
- valWiretag: valWiretag,
- keyFuncs: keyFuncs,
- valFuncs: valFuncs,
- keyZero: keyField.Default(),
- keyKind: keyField.Kind(),
- conv: conv,
- }
- if valField.Kind() == protoreflect.MessageKind {
- valueMessage = getMessageInfo(ft.Elem())
- }
-
- funcs = pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return sizeMap(p.AsValueOf(ft).Elem(), mapi, f, opts)
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- return appendMap(b, p.AsValueOf(ft).Elem(), mapi, f, opts)
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- mp := p.AsValueOf(ft)
- if mp.Elem().IsNil() {
- mp.Elem().Set(reflect.MakeMap(mapi.goType))
- }
- if f.mi == nil {
- return consumeMap(b, mp.Elem(), wtyp, mapi, f, opts)
- } else {
- return consumeMapOfMessage(b, mp.Elem(), wtyp, mapi, f, opts)
- }
- },
- }
- switch valField.Kind() {
- case protoreflect.MessageKind:
- funcs.merge = mergeMapOfMessage
- case protoreflect.BytesKind:
- funcs.merge = mergeMapOfBytes
- default:
- funcs.merge = mergeMap
- }
- if valFuncs.isInit != nil {
- funcs.isInit = func(p pointer, f *coderFieldInfo) error {
- return isInitMap(p.AsValueOf(ft).Elem(), mapi, f)
- }
- }
- return valueMessage, funcs
-}
-
-const (
- mapKeyTagSize = 1 // field 1, tag size 1.
- mapValTagSize = 1 // field 2, tag size 2.
-)
-
-func sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) int {
- if mapv.Len() == 0 {
- return 0
- }
- n := 0
- iter := mapRange(mapv)
- for iter.Next() {
- key := mapi.conv.keyConv.PBValueOf(iter.Key()).MapKey()
- keySize := mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
- var valSize int
- value := mapi.conv.valConv.PBValueOf(iter.Value())
- if f.mi == nil {
- valSize = mapi.valFuncs.size(value, mapValTagSize, opts)
- } else {
- p := pointerOfValue(iter.Value())
- valSize += mapValTagSize
- valSize += protowire.SizeBytes(f.mi.sizePointer(p, opts))
- }
- n += f.tagsize + protowire.SizeBytes(keySize+valSize)
- }
- return n
-}
-
-func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- var (
- key = mapi.keyZero
- val = mapi.conv.valConv.New()
- )
- for len(b) > 0 {
- num, wtyp, n := protowire.ConsumeTag(b)
- if n < 0 {
- return out, errDecode
- }
- if num > protowire.MaxValidNumber {
- return out, errDecode
- }
- b = b[n:]
- err := errUnknown
- switch num {
- case genid.MapEntry_Key_field_number:
- var v protoreflect.Value
- var o unmarshalOutput
- v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
- if err != nil {
- break
- }
- key = v
- n = o.n
- case genid.MapEntry_Value_field_number:
- var v protoreflect.Value
- var o unmarshalOutput
- v, o, err = mapi.valFuncs.unmarshal(b, val, num, wtyp, opts)
- if err != nil {
- break
- }
- val = v
- n = o.n
- }
- if err == errUnknown {
- n = protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return out, errDecode
- }
- } else if err != nil {
- return out, err
- }
- b = b[n:]
- }
- mapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), mapi.conv.valConv.GoValueOf(val))
- out.n = n
- return out, nil
-}
-
-func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.BytesType {
- return out, errUnknown
- }
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- var (
- key = mapi.keyZero
- val = reflect.New(f.mi.GoReflectType.Elem())
- )
- for len(b) > 0 {
- num, wtyp, n := protowire.ConsumeTag(b)
- if n < 0 {
- return out, errDecode
- }
- if num > protowire.MaxValidNumber {
- return out, errDecode
- }
- b = b[n:]
- err := errUnknown
- switch num {
- case 1:
- var v protoreflect.Value
- var o unmarshalOutput
- v, o, err = mapi.keyFuncs.unmarshal(b, key, num, wtyp, opts)
- if err != nil {
- break
- }
- key = v
- n = o.n
- case 2:
- if wtyp != protowire.BytesType {
- break
- }
- var v []byte
- v, n = protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- var o unmarshalOutput
- o, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts)
- if o.initialized {
- // Consider this map item initialized so long as we see
- // an initialized value.
- out.initialized = true
- }
- }
- if err == errUnknown {
- n = protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return out, errDecode
- }
- } else if err != nil {
- return out, err
- }
- b = b[n:]
- }
- mapv.SetMapIndex(mapi.conv.keyConv.GoValueOf(key), val)
- out.n = n
- return out, nil
-}
-
-func appendMapItem(b []byte, keyrv, valrv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- if f.mi == nil {
- key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()
- val := mapi.conv.valConv.PBValueOf(valrv)
- size := 0
- size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
- size += mapi.valFuncs.size(val, mapValTagSize, opts)
- b = protowire.AppendVarint(b, uint64(size))
- b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
- if err != nil {
- return nil, err
- }
- return mapi.valFuncs.marshal(b, val, mapi.valWiretag, opts)
- } else {
- key := mapi.conv.keyConv.PBValueOf(keyrv).MapKey()
- val := pointerOfValue(valrv)
- valSize := f.mi.sizePointer(val, opts)
- size := 0
- size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
- size += mapValTagSize + protowire.SizeBytes(valSize)
- b = protowire.AppendVarint(b, uint64(size))
- b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
- if err != nil {
- return nil, err
- }
- b = protowire.AppendVarint(b, mapi.valWiretag)
- b = protowire.AppendVarint(b, uint64(valSize))
- return f.mi.marshalAppendPointer(b, val, opts)
- }
-}
-
-func appendMap(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- if mapv.Len() == 0 {
- return b, nil
- }
- if opts.Deterministic() {
- return appendMapDeterministic(b, mapv, mapi, f, opts)
- }
- iter := mapRange(mapv)
- for iter.Next() {
- var err error
- b = protowire.AppendVarint(b, f.wiretag)
- b, err = appendMapItem(b, iter.Key(), iter.Value(), mapi, f, opts)
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func appendMapDeterministic(b []byte, mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- keys := mapv.MapKeys()
- sort.Slice(keys, func(i, j int) bool {
- switch keys[i].Kind() {
- case reflect.Bool:
- return !keys[i].Bool() && keys[j].Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return keys[i].Int() < keys[j].Int()
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return keys[i].Uint() < keys[j].Uint()
- case reflect.Float32, reflect.Float64:
- return keys[i].Float() < keys[j].Float()
- case reflect.String:
- return keys[i].String() < keys[j].String()
- default:
- panic("invalid kind: " + keys[i].Kind().String())
- }
- })
- for _, key := range keys {
- var err error
- b = protowire.AppendVarint(b, f.wiretag)
- b, err = appendMapItem(b, key, mapv.MapIndex(key), mapi, f, opts)
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func isInitMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo) error {
- if mi := f.mi; mi != nil {
- mi.init()
- if !mi.needsInitCheck {
- return nil
- }
- iter := mapRange(mapv)
- for iter.Next() {
- val := pointerOfValue(iter.Value())
- if err := mi.checkInitializedPointer(val); err != nil {
- return err
- }
- }
- } else {
- iter := mapRange(mapv)
- for iter.Next() {
- val := mapi.conv.valConv.PBValueOf(iter.Value())
- if err := mapi.valFuncs.isInit(val); err != nil {
- return err
- }
- }
- }
- return nil
-}
-
-func mergeMap(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- dstm := dst.AsValueOf(f.ft).Elem()
- srcm := src.AsValueOf(f.ft).Elem()
- if srcm.Len() == 0 {
- return
- }
- if dstm.IsNil() {
- dstm.Set(reflect.MakeMap(f.ft))
- }
- iter := mapRange(srcm)
- for iter.Next() {
- dstm.SetMapIndex(iter.Key(), iter.Value())
- }
-}
-
-func mergeMapOfBytes(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- dstm := dst.AsValueOf(f.ft).Elem()
- srcm := src.AsValueOf(f.ft).Elem()
- if srcm.Len() == 0 {
- return
- }
- if dstm.IsNil() {
- dstm.Set(reflect.MakeMap(f.ft))
- }
- iter := mapRange(srcm)
- for iter.Next() {
- dstm.SetMapIndex(iter.Key(), reflect.ValueOf(append(emptyBuf[:], iter.Value().Bytes()...)))
- }
-}
-
-func mergeMapOfMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- dstm := dst.AsValueOf(f.ft).Elem()
- srcm := src.AsValueOf(f.ft).Elem()
- if srcm.Len() == 0 {
- return
- }
- if dstm.IsNil() {
- dstm.Set(reflect.MakeMap(f.ft))
- }
- iter := mapRange(srcm)
- for iter.Next() {
- val := reflect.New(f.ft.Elem().Elem())
- if f.mi != nil {
- f.mi.mergePointer(pointerOfValue(val), pointerOfValue(iter.Value()), opts)
- } else {
- opts.Merge(asMessage(val), asMessage(iter.Value()))
- }
- dstm.SetMapIndex(iter.Key(), val)
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
deleted file mode 100644
index 4b15493..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// 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.
-
-//go:build !go1.12
-// +build !go1.12
-
-package impl
-
-import "reflect"
-
-type mapIter struct {
- v reflect.Value
- keys []reflect.Value
-}
-
-// mapRange provides a less-efficient equivalent to
-// the Go 1.12 reflect.Value.MapRange method.
-func mapRange(v reflect.Value) *mapIter {
- return &mapIter{v: v}
-}
-
-func (i *mapIter) Next() bool {
- if i.keys == nil {
- i.keys = i.v.MapKeys()
- } else {
- i.keys = i.keys[1:]
- }
- return len(i.keys) > 0
-}
-
-func (i *mapIter) Key() reflect.Value {
- return i.keys[0]
-}
-
-func (i *mapIter) Value() reflect.Value {
- return i.v.MapIndex(i.keys[0])
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
deleted file mode 100644
index 0b31b66..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// 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.
-
-//go:build go1.12
-// +build go1.12
-
-package impl
-
-import "reflect"
-
-func mapRange(v reflect.Value) *reflect.MapIter { return v.MapRange() }
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go b/vendor/google.golang.org/protobuf/internal/impl/codec_message.go
deleted file mode 100644
index 6b2fdbb..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_message.go
+++ /dev/null
@@ -1,217 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "sort"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/order"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// coderMessageInfo contains per-message information used by the fast-path functions.
-// This is a different type from MessageInfo to keep MessageInfo as general-purpose as
-// possible.
-type coderMessageInfo struct {
- methods protoiface.Methods
-
- orderedCoderFields []*coderFieldInfo
- denseCoderFields []*coderFieldInfo
- coderFields map[protowire.Number]*coderFieldInfo
- sizecacheOffset offset
- unknownOffset offset
- unknownPtrKind bool
- extensionOffset offset
- needsInitCheck bool
- isMessageSet bool
- numRequiredFields uint8
-}
-
-type coderFieldInfo struct {
- funcs pointerCoderFuncs // fast-path per-field functions
- mi *MessageInfo // field's message
- ft reflect.Type
- validation validationInfo // information used by message validation
- num protoreflect.FieldNumber // field number
- offset offset // struct field offset
- wiretag uint64 // field tag (number + wire type)
- tagsize int // size of the varint-encoded tag
- isPointer bool // true if IsNil may be called on the struct field
- isRequired bool // true if field is required
-}
-
-func (mi *MessageInfo) makeCoderMethods(t reflect.Type, si structInfo) {
- mi.sizecacheOffset = invalidOffset
- mi.unknownOffset = invalidOffset
- mi.extensionOffset = invalidOffset
-
- if si.sizecacheOffset.IsValid() && si.sizecacheType == sizecacheType {
- mi.sizecacheOffset = si.sizecacheOffset
- }
- if si.unknownOffset.IsValid() && (si.unknownType == unknownFieldsAType || si.unknownType == unknownFieldsBType) {
- mi.unknownOffset = si.unknownOffset
- mi.unknownPtrKind = si.unknownType.Kind() == reflect.Ptr
- }
- if si.extensionOffset.IsValid() && si.extensionType == extensionFieldsType {
- mi.extensionOffset = si.extensionOffset
- }
-
- mi.coderFields = make(map[protowire.Number]*coderFieldInfo)
- fields := mi.Desc.Fields()
- preallocFields := make([]coderFieldInfo, fields.Len())
- for i := 0; i < fields.Len(); i++ {
- fd := fields.Get(i)
-
- fs := si.fieldsByNumber[fd.Number()]
- isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()
- if isOneof {
- fs = si.oneofsByName[fd.ContainingOneof().Name()]
- }
- ft := fs.Type
- var wiretag uint64
- if !fd.IsPacked() {
- wiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()])
- } else {
- wiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType)
- }
- var fieldOffset offset
- var funcs pointerCoderFuncs
- var childMessage *MessageInfo
- switch {
- case ft == nil:
- // This never occurs for generated message types.
- // It implies that a hand-crafted type has missing Go fields
- // for specific protobuf message fields.
- funcs = pointerCoderFuncs{
- size: func(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return 0
- },
- marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- return nil, nil
- },
- unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- isInit: func(p pointer, f *coderFieldInfo) error {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- merge: func(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- }
- case isOneof:
- fieldOffset = offsetOf(fs, mi.Exporter)
- case fd.IsWeak():
- fieldOffset = si.weakOffset
- funcs = makeWeakMessageFieldCoder(fd)
- default:
- fieldOffset = offsetOf(fs, mi.Exporter)
- childMessage, funcs = fieldCoder(fd, ft)
- }
- cf := &preallocFields[i]
- *cf = coderFieldInfo{
- num: fd.Number(),
- offset: fieldOffset,
- wiretag: wiretag,
- ft: ft,
- tagsize: protowire.SizeVarint(wiretag),
- funcs: funcs,
- mi: childMessage,
- validation: newFieldValidationInfo(mi, si, fd, ft),
- isPointer: fd.Cardinality() == protoreflect.Repeated || fd.HasPresence(),
- isRequired: fd.Cardinality() == protoreflect.Required,
- }
- mi.orderedCoderFields = append(mi.orderedCoderFields, cf)
- mi.coderFields[cf.num] = cf
- }
- for i, oneofs := 0, mi.Desc.Oneofs(); i < oneofs.Len(); i++ {
- if od := oneofs.Get(i); !od.IsSynthetic() {
- mi.initOneofFieldCoders(od, si)
- }
- }
- if messageset.IsMessageSet(mi.Desc) {
- if !mi.extensionOffset.IsValid() {
- panic(fmt.Sprintf("%v: MessageSet with no extensions field", mi.Desc.FullName()))
- }
- if !mi.unknownOffset.IsValid() {
- panic(fmt.Sprintf("%v: MessageSet with no unknown field", mi.Desc.FullName()))
- }
- mi.isMessageSet = true
- }
- sort.Slice(mi.orderedCoderFields, func(i, j int) bool {
- return mi.orderedCoderFields[i].num < mi.orderedCoderFields[j].num
- })
-
- var maxDense protoreflect.FieldNumber
- for _, cf := range mi.orderedCoderFields {
- if cf.num >= 16 && cf.num >= 2*maxDense {
- break
- }
- maxDense = cf.num
- }
- mi.denseCoderFields = make([]*coderFieldInfo, maxDense+1)
- for _, cf := range mi.orderedCoderFields {
- if int(cf.num) >= len(mi.denseCoderFields) {
- break
- }
- mi.denseCoderFields[cf.num] = cf
- }
-
- // To preserve compatibility with historic wire output, marshal oneofs last.
- if mi.Desc.Oneofs().Len() > 0 {
- sort.Slice(mi.orderedCoderFields, func(i, j int) bool {
- fi := fields.ByNumber(mi.orderedCoderFields[i].num)
- fj := fields.ByNumber(mi.orderedCoderFields[j].num)
- return order.LegacyFieldOrder(fi, fj)
- })
- }
-
- mi.needsInitCheck = needsInitCheck(mi.Desc)
- if mi.methods.Marshal == nil && mi.methods.Size == nil {
- mi.methods.Flags |= protoiface.SupportMarshalDeterministic
- mi.methods.Marshal = mi.marshal
- mi.methods.Size = mi.size
- }
- if mi.methods.Unmarshal == nil {
- mi.methods.Flags |= protoiface.SupportUnmarshalDiscardUnknown
- mi.methods.Unmarshal = mi.unmarshal
- }
- if mi.methods.CheckInitialized == nil {
- mi.methods.CheckInitialized = mi.checkInitialized
- }
- if mi.methods.Merge == nil {
- mi.methods.Merge = mi.merge
- }
-}
-
-// getUnknownBytes returns a *[]byte for the unknown fields.
-// It is the caller's responsibility to check whether the pointer is nil.
-// This function is specially designed to be inlineable.
-func (mi *MessageInfo) getUnknownBytes(p pointer) *[]byte {
- if mi.unknownPtrKind {
- return *p.Apply(mi.unknownOffset).BytesPtr()
- } else {
- return p.Apply(mi.unknownOffset).Bytes()
- }
-}
-
-// mutableUnknownBytes returns a *[]byte for the unknown fields.
-// The returned pointer is guaranteed to not be nil.
-func (mi *MessageInfo) mutableUnknownBytes(p pointer) *[]byte {
- if mi.unknownPtrKind {
- bp := p.Apply(mi.unknownOffset).BytesPtr()
- if *bp == nil {
- *bp = new([]byte)
- }
- return *bp
- } else {
- return p.Apply(mi.unknownOffset).Bytes()
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go b/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
deleted file mode 100644
index b7a23fa..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "sort"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
-)
-
-func sizeMessageSet(mi *MessageInfo, p pointer, opts marshalOptions) (size int) {
- if !flags.ProtoLegacy {
- return 0
- }
-
- ext := *p.Apply(mi.extensionOffset).Extensions()
- for _, x := range ext {
- xi := getExtensionFieldInfo(x.Type())
- if xi.funcs.size == nil {
- continue
- }
- num, _ := protowire.DecodeTag(xi.wiretag)
- size += messageset.SizeField(num)
- size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)
- }
-
- if u := mi.getUnknownBytes(p); u != nil {
- size += messageset.SizeUnknown(*u)
- }
-
- return size
-}
-
-func marshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts marshalOptions) ([]byte, error) {
- if !flags.ProtoLegacy {
- return b, errors.New("no support for message_set_wire_format")
- }
-
- ext := *p.Apply(mi.extensionOffset).Extensions()
- switch len(ext) {
- case 0:
- case 1:
- // Fast-path for one extension: Don't bother sorting the keys.
- for _, x := range ext {
- var err error
- b, err = marshalMessageSetField(mi, b, x, opts)
- if err != nil {
- return b, err
- }
- }
- default:
- // Sort the keys to provide a deterministic encoding.
- // Not sure this is required, but the old code does it.
- keys := make([]int, 0, len(ext))
- for k := range ext {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
- for _, k := range keys {
- var err error
- b, err = marshalMessageSetField(mi, b, ext[int32(k)], opts)
- if err != nil {
- return b, err
- }
- }
- }
-
- if u := mi.getUnknownBytes(p); u != nil {
- var err error
- b, err = messageset.AppendUnknown(b, *u)
- if err != nil {
- return b, err
- }
- }
-
- return b, nil
-}
-
-func marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts marshalOptions) ([]byte, error) {
- xi := getExtensionFieldInfo(x.Type())
- num, _ := protowire.DecodeTag(xi.wiretag)
- b = messageset.AppendFieldStart(b, num)
- b, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts)
- if err != nil {
- return b, err
- }
- b = messageset.AppendFieldEnd(b)
- return b, nil
-}
-
-func unmarshalMessageSet(mi *MessageInfo, b []byte, p pointer, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if !flags.ProtoLegacy {
- return out, errors.New("no support for message_set_wire_format")
- }
-
- ep := p.Apply(mi.extensionOffset).Extensions()
- if *ep == nil {
- *ep = make(map[int32]ExtensionField)
- }
- ext := *ep
- initialized := true
- err = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error {
- o, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts)
- if err == errUnknown {
- u := mi.mutableUnknownBytes(p)
- *u = protowire.AppendTag(*u, num, protowire.BytesType)
- *u = append(*u, v...)
- return nil
- }
- if !o.initialized {
- initialized = false
- }
- return err
- })
- out.n = len(b)
- out.initialized = initialized
- return out, err
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
deleted file mode 100644
index 145c577..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go
+++ /dev/null
@@ -1,210 +0,0 @@
-// 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.
-
-//go:build purego || appengine
-// +build purego appengine
-
-package impl
-
-import (
- "reflect"
-
- "google.golang.org/protobuf/encoding/protowire"
-)
-
-func sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- v := p.v.Elem().Int()
- return f.tagsize + protowire.SizeVarint(uint64(v))
-}
-
-func appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- v := p.v.Elem().Int()
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(v))
- return b, nil
-}
-
-func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return out, errDecode
- }
- p.v.Elem().SetInt(int64(v))
- out.n = n
- return out, nil
-}
-
-func mergeEnum(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- dst.v.Elem().Set(src.v.Elem())
-}
-
-var coderEnum = pointerCoderFuncs{
- size: sizeEnum,
- marshal: appendEnum,
- unmarshal: consumeEnum,
- merge: mergeEnum,
-}
-
-func sizeEnumNoZero(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- if p.v.Elem().Int() == 0 {
- return 0
- }
- return sizeEnum(p, f, opts)
-}
-
-func appendEnumNoZero(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- if p.v.Elem().Int() == 0 {
- return b, nil
- }
- return appendEnum(b, p, f, opts)
-}
-
-func mergeEnumNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- if src.v.Elem().Int() != 0 {
- dst.v.Elem().Set(src.v.Elem())
- }
-}
-
-var coderEnumNoZero = pointerCoderFuncs{
- size: sizeEnumNoZero,
- marshal: appendEnumNoZero,
- unmarshal: consumeEnum,
- merge: mergeEnumNoZero,
-}
-
-func sizeEnumPtr(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- return sizeEnum(pointer{p.v.Elem()}, f, opts)
-}
-
-func appendEnumPtr(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- return appendEnum(b, pointer{p.v.Elem()}, f, opts)
-}
-
-func consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- if p.v.Elem().IsNil() {
- p.v.Elem().Set(reflect.New(p.v.Elem().Type().Elem()))
- }
- return consumeEnum(b, pointer{p.v.Elem()}, wtyp, f, opts)
-}
-
-func mergeEnumPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- if !src.v.Elem().IsNil() {
- v := reflect.New(dst.v.Type().Elem().Elem())
- v.Elem().Set(src.v.Elem().Elem())
- dst.v.Elem().Set(v)
- }
-}
-
-var coderEnumPtr = pointerCoderFuncs{
- size: sizeEnumPtr,
- marshal: appendEnumPtr,
- unmarshal: consumeEnumPtr,
- merge: mergeEnumPtr,
-}
-
-func sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := p.v.Elem()
- for i, llen := 0, s.Len(); i < llen; i++ {
- size += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize
- }
- return size
-}
-
-func appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := p.v.Elem()
- for i, llen := 0, s.Len(); i < llen; i++ {
- b = protowire.AppendVarint(b, f.wiretag)
- b = protowire.AppendVarint(b, uint64(s.Index(i).Int()))
- }
- return b, nil
-}
-
-func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- s := p.v.Elem()
- if wtyp == protowire.BytesType {
- b, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, errDecode
- }
- for len(b) > 0 {
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return out, errDecode
- }
- rv := reflect.New(s.Type().Elem()).Elem()
- rv.SetInt(int64(v))
- s.Set(reflect.Append(s, rv))
- b = b[n:]
- }
- out.n = n
- return out, nil
- }
- if wtyp != protowire.VarintType {
- return out, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return out, errDecode
- }
- rv := reflect.New(s.Type().Elem()).Elem()
- rv.SetInt(int64(v))
- s.Set(reflect.Append(s, rv))
- out.n = n
- return out, nil
-}
-
-func mergeEnumSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- dst.v.Elem().Set(reflect.AppendSlice(dst.v.Elem(), src.v.Elem()))
-}
-
-var coderEnumSlice = pointerCoderFuncs{
- size: sizeEnumSlice,
- marshal: appendEnumSlice,
- unmarshal: consumeEnumSlice,
- merge: mergeEnumSlice,
-}
-
-func sizeEnumPackedSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
- s := p.v.Elem()
- llen := s.Len()
- if llen == 0 {
- return 0
- }
- n := 0
- for i := 0; i < llen; i++ {
- n += protowire.SizeVarint(uint64(s.Index(i).Int()))
- }
- return f.tagsize + protowire.SizeBytes(n)
-}
-
-func appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- s := p.v.Elem()
- llen := s.Len()
- if llen == 0 {
- return b, nil
- }
- b = protowire.AppendVarint(b, f.wiretag)
- n := 0
- for i := 0; i < llen; i++ {
- n += protowire.SizeVarint(uint64(s.Index(i).Int()))
- }
- b = protowire.AppendVarint(b, uint64(n))
- for i := 0; i < llen; i++ {
- b = protowire.AppendVarint(b, uint64(s.Index(i).Int()))
- }
- return b, nil
-}
-
-var coderEnumPackedSlice = pointerCoderFuncs{
- size: sizeEnumPackedSlice,
- marshal: appendEnumPackedSlice,
- unmarshal: consumeEnumSlice,
- merge: mergeEnumSlice,
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go b/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
deleted file mode 100644
index 576dcf3..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go
+++ /dev/null
@@ -1,557 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// pointerCoderFuncs is a set of pointer encoding functions.
-type pointerCoderFuncs struct {
- mi *MessageInfo
- size func(p pointer, f *coderFieldInfo, opts marshalOptions) int
- marshal func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error)
- unmarshal func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error)
- isInit func(p pointer, f *coderFieldInfo) error
- merge func(dst, src pointer, f *coderFieldInfo, opts mergeOptions)
-}
-
-// valueCoderFuncs is a set of protoreflect.Value encoding functions.
-type valueCoderFuncs struct {
- size func(v protoreflect.Value, tagsize int, opts marshalOptions) int
- marshal func(b []byte, v protoreflect.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
- unmarshal func(b []byte, v protoreflect.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (protoreflect.Value, unmarshalOutput, error)
- isInit func(v protoreflect.Value) error
- merge func(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value
-}
-
-// fieldCoder returns pointer functions for a field, used for operating on
-// struct fields.
-func fieldCoder(fd protoreflect.FieldDescriptor, ft reflect.Type) (*MessageInfo, pointerCoderFuncs) {
- switch {
- case fd.IsMap():
- return encoderFuncsForMap(fd, ft)
- case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
- // Repeated fields (not packed).
- if ft.Kind() != reflect.Slice {
- break
- }
- ft := ft.Elem()
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if ft.Kind() == reflect.Bool {
- return nil, coderBoolSlice
- }
- case protoreflect.EnumKind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderEnumSlice
- }
- case protoreflect.Int32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderInt32Slice
- }
- case protoreflect.Sint32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSint32Slice
- }
- case protoreflect.Uint32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderUint32Slice
- }
- case protoreflect.Int64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderInt64Slice
- }
- case protoreflect.Sint64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSint64Slice
- }
- case protoreflect.Uint64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderUint64Slice
- }
- case protoreflect.Sfixed32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSfixed32Slice
- }
- case protoreflect.Fixed32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderFixed32Slice
- }
- case protoreflect.FloatKind:
- if ft.Kind() == reflect.Float32 {
- return nil, coderFloatSlice
- }
- case protoreflect.Sfixed64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSfixed64Slice
- }
- case protoreflect.Fixed64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderFixed64Slice
- }
- case protoreflect.DoubleKind:
- if ft.Kind() == reflect.Float64 {
- return nil, coderDoubleSlice
- }
- case protoreflect.StringKind:
- if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
- return nil, coderStringSliceValidateUTF8
- }
- if ft.Kind() == reflect.String {
- return nil, coderStringSlice
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {
- return nil, coderBytesSliceValidateUTF8
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytesSlice
- }
- case protoreflect.BytesKind:
- if ft.Kind() == reflect.String {
- return nil, coderStringSlice
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytesSlice
- }
- case protoreflect.MessageKind:
- return getMessageInfo(ft), makeMessageSliceFieldCoder(fd, ft)
- case protoreflect.GroupKind:
- return getMessageInfo(ft), makeGroupSliceFieldCoder(fd, ft)
- }
- case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
- // Packed repeated fields.
- //
- // Only repeated fields of primitive numeric types
- // (Varint, Fixed32, or Fixed64 wire type) can be packed.
- if ft.Kind() != reflect.Slice {
- break
- }
- ft := ft.Elem()
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if ft.Kind() == reflect.Bool {
- return nil, coderBoolPackedSlice
- }
- case protoreflect.EnumKind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderEnumPackedSlice
- }
- case protoreflect.Int32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderInt32PackedSlice
- }
- case protoreflect.Sint32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSint32PackedSlice
- }
- case protoreflect.Uint32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderUint32PackedSlice
- }
- case protoreflect.Int64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderInt64PackedSlice
- }
- case protoreflect.Sint64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSint64PackedSlice
- }
- case protoreflect.Uint64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderUint64PackedSlice
- }
- case protoreflect.Sfixed32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSfixed32PackedSlice
- }
- case protoreflect.Fixed32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderFixed32PackedSlice
- }
- case protoreflect.FloatKind:
- if ft.Kind() == reflect.Float32 {
- return nil, coderFloatPackedSlice
- }
- case protoreflect.Sfixed64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSfixed64PackedSlice
- }
- case protoreflect.Fixed64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderFixed64PackedSlice
- }
- case protoreflect.DoubleKind:
- if ft.Kind() == reflect.Float64 {
- return nil, coderDoublePackedSlice
- }
- }
- case fd.Kind() == protoreflect.MessageKind:
- return getMessageInfo(ft), makeMessageFieldCoder(fd, ft)
- case fd.Kind() == protoreflect.GroupKind:
- return getMessageInfo(ft), makeGroupFieldCoder(fd, ft)
- case fd.Syntax() == protoreflect.Proto3 && fd.ContainingOneof() == nil:
- // Populated oneof fields always encode even if set to the zero value,
- // which normally are not encoded in proto3.
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if ft.Kind() == reflect.Bool {
- return nil, coderBoolNoZero
- }
- case protoreflect.EnumKind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderEnumNoZero
- }
- case protoreflect.Int32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderInt32NoZero
- }
- case protoreflect.Sint32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSint32NoZero
- }
- case protoreflect.Uint32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderUint32NoZero
- }
- case protoreflect.Int64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderInt64NoZero
- }
- case protoreflect.Sint64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSint64NoZero
- }
- case protoreflect.Uint64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderUint64NoZero
- }
- case protoreflect.Sfixed32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSfixed32NoZero
- }
- case protoreflect.Fixed32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderFixed32NoZero
- }
- case protoreflect.FloatKind:
- if ft.Kind() == reflect.Float32 {
- return nil, coderFloatNoZero
- }
- case protoreflect.Sfixed64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSfixed64NoZero
- }
- case protoreflect.Fixed64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderFixed64NoZero
- }
- case protoreflect.DoubleKind:
- if ft.Kind() == reflect.Float64 {
- return nil, coderDoubleNoZero
- }
- case protoreflect.StringKind:
- if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
- return nil, coderStringNoZeroValidateUTF8
- }
- if ft.Kind() == reflect.String {
- return nil, coderStringNoZero
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {
- return nil, coderBytesNoZeroValidateUTF8
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytesNoZero
- }
- case protoreflect.BytesKind:
- if ft.Kind() == reflect.String {
- return nil, coderStringNoZero
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytesNoZero
- }
- }
- case ft.Kind() == reflect.Ptr:
- ft := ft.Elem()
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if ft.Kind() == reflect.Bool {
- return nil, coderBoolPtr
- }
- case protoreflect.EnumKind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderEnumPtr
- }
- case protoreflect.Int32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderInt32Ptr
- }
- case protoreflect.Sint32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSint32Ptr
- }
- case protoreflect.Uint32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderUint32Ptr
- }
- case protoreflect.Int64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderInt64Ptr
- }
- case protoreflect.Sint64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSint64Ptr
- }
- case protoreflect.Uint64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderUint64Ptr
- }
- case protoreflect.Sfixed32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSfixed32Ptr
- }
- case protoreflect.Fixed32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderFixed32Ptr
- }
- case protoreflect.FloatKind:
- if ft.Kind() == reflect.Float32 {
- return nil, coderFloatPtr
- }
- case protoreflect.Sfixed64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSfixed64Ptr
- }
- case protoreflect.Fixed64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderFixed64Ptr
- }
- case protoreflect.DoubleKind:
- if ft.Kind() == reflect.Float64 {
- return nil, coderDoublePtr
- }
- case protoreflect.StringKind:
- if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
- return nil, coderStringPtrValidateUTF8
- }
- if ft.Kind() == reflect.String {
- return nil, coderStringPtr
- }
- case protoreflect.BytesKind:
- if ft.Kind() == reflect.String {
- return nil, coderStringPtr
- }
- }
- default:
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if ft.Kind() == reflect.Bool {
- return nil, coderBool
- }
- case protoreflect.EnumKind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderEnum
- }
- case protoreflect.Int32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderInt32
- }
- case protoreflect.Sint32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSint32
- }
- case protoreflect.Uint32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderUint32
- }
- case protoreflect.Int64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderInt64
- }
- case protoreflect.Sint64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSint64
- }
- case protoreflect.Uint64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderUint64
- }
- case protoreflect.Sfixed32Kind:
- if ft.Kind() == reflect.Int32 {
- return nil, coderSfixed32
- }
- case protoreflect.Fixed32Kind:
- if ft.Kind() == reflect.Uint32 {
- return nil, coderFixed32
- }
- case protoreflect.FloatKind:
- if ft.Kind() == reflect.Float32 {
- return nil, coderFloat
- }
- case protoreflect.Sfixed64Kind:
- if ft.Kind() == reflect.Int64 {
- return nil, coderSfixed64
- }
- case protoreflect.Fixed64Kind:
- if ft.Kind() == reflect.Uint64 {
- return nil, coderFixed64
- }
- case protoreflect.DoubleKind:
- if ft.Kind() == reflect.Float64 {
- return nil, coderDouble
- }
- case protoreflect.StringKind:
- if ft.Kind() == reflect.String && strs.EnforceUTF8(fd) {
- return nil, coderStringValidateUTF8
- }
- if ft.Kind() == reflect.String {
- return nil, coderString
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 && strs.EnforceUTF8(fd) {
- return nil, coderBytesValidateUTF8
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytes
- }
- case protoreflect.BytesKind:
- if ft.Kind() == reflect.String {
- return nil, coderString
- }
- if ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8 {
- return nil, coderBytes
- }
- }
- }
- panic(fmt.Sprintf("invalid type: no encoder for %v %v %v/%v", fd.FullName(), fd.Cardinality(), fd.Kind(), ft))
-}
-
-// encoderFuncsForValue returns value functions for a field, used for
-// extension values and map encoding.
-func encoderFuncsForValue(fd protoreflect.FieldDescriptor) valueCoderFuncs {
- switch {
- case fd.Cardinality() == protoreflect.Repeated && !fd.IsPacked():
- switch fd.Kind() {
- case protoreflect.BoolKind:
- return coderBoolSliceValue
- case protoreflect.EnumKind:
- return coderEnumSliceValue
- case protoreflect.Int32Kind:
- return coderInt32SliceValue
- case protoreflect.Sint32Kind:
- return coderSint32SliceValue
- case protoreflect.Uint32Kind:
- return coderUint32SliceValue
- case protoreflect.Int64Kind:
- return coderInt64SliceValue
- case protoreflect.Sint64Kind:
- return coderSint64SliceValue
- case protoreflect.Uint64Kind:
- return coderUint64SliceValue
- case protoreflect.Sfixed32Kind:
- return coderSfixed32SliceValue
- case protoreflect.Fixed32Kind:
- return coderFixed32SliceValue
- case protoreflect.FloatKind:
- return coderFloatSliceValue
- case protoreflect.Sfixed64Kind:
- return coderSfixed64SliceValue
- case protoreflect.Fixed64Kind:
- return coderFixed64SliceValue
- case protoreflect.DoubleKind:
- return coderDoubleSliceValue
- case protoreflect.StringKind:
- // We don't have a UTF-8 validating coder for repeated string fields.
- // Value coders are used for extensions and maps.
- // Extensions are never proto3, and maps never contain lists.
- return coderStringSliceValue
- case protoreflect.BytesKind:
- return coderBytesSliceValue
- case protoreflect.MessageKind:
- return coderMessageSliceValue
- case protoreflect.GroupKind:
- return coderGroupSliceValue
- }
- case fd.Cardinality() == protoreflect.Repeated && fd.IsPacked():
- switch fd.Kind() {
- case protoreflect.BoolKind:
- return coderBoolPackedSliceValue
- case protoreflect.EnumKind:
- return coderEnumPackedSliceValue
- case protoreflect.Int32Kind:
- return coderInt32PackedSliceValue
- case protoreflect.Sint32Kind:
- return coderSint32PackedSliceValue
- case protoreflect.Uint32Kind:
- return coderUint32PackedSliceValue
- case protoreflect.Int64Kind:
- return coderInt64PackedSliceValue
- case protoreflect.Sint64Kind:
- return coderSint64PackedSliceValue
- case protoreflect.Uint64Kind:
- return coderUint64PackedSliceValue
- case protoreflect.Sfixed32Kind:
- return coderSfixed32PackedSliceValue
- case protoreflect.Fixed32Kind:
- return coderFixed32PackedSliceValue
- case protoreflect.FloatKind:
- return coderFloatPackedSliceValue
- case protoreflect.Sfixed64Kind:
- return coderSfixed64PackedSliceValue
- case protoreflect.Fixed64Kind:
- return coderFixed64PackedSliceValue
- case protoreflect.DoubleKind:
- return coderDoublePackedSliceValue
- }
- default:
- switch fd.Kind() {
- default:
- case protoreflect.BoolKind:
- return coderBoolValue
- case protoreflect.EnumKind:
- return coderEnumValue
- case protoreflect.Int32Kind:
- return coderInt32Value
- case protoreflect.Sint32Kind:
- return coderSint32Value
- case protoreflect.Uint32Kind:
- return coderUint32Value
- case protoreflect.Int64Kind:
- return coderInt64Value
- case protoreflect.Sint64Kind:
- return coderSint64Value
- case protoreflect.Uint64Kind:
- return coderUint64Value
- case protoreflect.Sfixed32Kind:
- return coderSfixed32Value
- case protoreflect.Fixed32Kind:
- return coderFixed32Value
- case protoreflect.FloatKind:
- return coderFloatValue
- case protoreflect.Sfixed64Kind:
- return coderSfixed64Value
- case protoreflect.Fixed64Kind:
- return coderFixed64Value
- case protoreflect.DoubleKind:
- return coderDoubleValue
- case protoreflect.StringKind:
- if strs.EnforceUTF8(fd) {
- return coderStringValueValidateUTF8
- }
- return coderStringValue
- case protoreflect.BytesKind:
- return coderBytesValue
- case protoreflect.MessageKind:
- return coderMessageValue
- case protoreflect.GroupKind:
- return coderGroupValue
- }
- }
- panic(fmt.Sprintf("invalid field: no encoder for %v %v %v", fd.FullName(), fd.Cardinality(), fd.Kind()))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
deleted file mode 100644
index 757642e..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-//go:build !purego && !appengine
-// +build !purego,!appengine
-
-package impl
-
-// When using unsafe pointers, we can just treat enum values as int32s.
-
-var (
- coderEnumNoZero = coderInt32NoZero
- coderEnum = coderInt32
- coderEnumPtr = coderInt32Ptr
- coderEnumSlice = coderInt32Slice
- coderEnumPackedSlice = coderInt32PackedSlice
-)
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert.go b/vendor/google.golang.org/protobuf/internal/impl/convert.go
deleted file mode 100644
index 185ef2e..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/convert.go
+++ /dev/null
@@ -1,495 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// unwrapper unwraps the value to the underlying value.
-// This is implemented by List and Map.
-type unwrapper interface {
- protoUnwrap() interface{}
-}
-
-// A Converter coverts to/from Go reflect.Value types and protobuf protoreflect.Value types.
-type Converter interface {
- // PBValueOf converts a reflect.Value to a protoreflect.Value.
- PBValueOf(reflect.Value) protoreflect.Value
-
- // GoValueOf converts a protoreflect.Value to a reflect.Value.
- GoValueOf(protoreflect.Value) reflect.Value
-
- // IsValidPB returns whether a protoreflect.Value is compatible with this type.
- IsValidPB(protoreflect.Value) bool
-
- // IsValidGo returns whether a reflect.Value is compatible with this type.
- IsValidGo(reflect.Value) bool
-
- // New returns a new field value.
- // For scalars, it returns the default value of the field.
- // For composite types, it returns a new mutable value.
- New() protoreflect.Value
-
- // Zero returns a new field value.
- // For scalars, it returns the default value of the field.
- // For composite types, it returns an immutable, empty value.
- Zero() protoreflect.Value
-}
-
-// NewConverter matches a Go type with a protobuf field and returns a Converter
-// that converts between the two. Enums must be a named int32 kind that
-// implements protoreflect.Enum, and messages must be pointer to a named
-// struct type that implements protoreflect.ProtoMessage.
-//
-// This matcher deliberately supports a wider range of Go types than what
-// protoc-gen-go historically generated to be able to automatically wrap some
-// v1 messages generated by other forks of protoc-gen-go.
-func NewConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
- switch {
- case fd.IsList():
- return newListConverter(t, fd)
- case fd.IsMap():
- return newMapConverter(t, fd)
- default:
- return newSingularConverter(t, fd)
- }
-}
-
-var (
- boolType = reflect.TypeOf(bool(false))
- int32Type = reflect.TypeOf(int32(0))
- int64Type = reflect.TypeOf(int64(0))
- uint32Type = reflect.TypeOf(uint32(0))
- uint64Type = reflect.TypeOf(uint64(0))
- float32Type = reflect.TypeOf(float32(0))
- float64Type = reflect.TypeOf(float64(0))
- stringType = reflect.TypeOf(string(""))
- bytesType = reflect.TypeOf([]byte(nil))
- byteType = reflect.TypeOf(byte(0))
-)
-
-var (
- boolZero = protoreflect.ValueOfBool(false)
- int32Zero = protoreflect.ValueOfInt32(0)
- int64Zero = protoreflect.ValueOfInt64(0)
- uint32Zero = protoreflect.ValueOfUint32(0)
- uint64Zero = protoreflect.ValueOfUint64(0)
- float32Zero = protoreflect.ValueOfFloat32(0)
- float64Zero = protoreflect.ValueOfFloat64(0)
- stringZero = protoreflect.ValueOfString("")
- bytesZero = protoreflect.ValueOfBytes(nil)
-)
-
-func newSingularConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
- defVal := func(fd protoreflect.FieldDescriptor, zero protoreflect.Value) protoreflect.Value {
- if fd.Cardinality() == protoreflect.Repeated {
- // Default isn't defined for repeated fields.
- return zero
- }
- return fd.Default()
- }
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if t.Kind() == reflect.Bool {
- return &boolConverter{t, defVal(fd, boolZero)}
- }
- case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind:
- if t.Kind() == reflect.Int32 {
- return &int32Converter{t, defVal(fd, int32Zero)}
- }
- case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
- if t.Kind() == reflect.Int64 {
- return &int64Converter{t, defVal(fd, int64Zero)}
- }
- case protoreflect.Uint32Kind, protoreflect.Fixed32Kind:
- if t.Kind() == reflect.Uint32 {
- return &uint32Converter{t, defVal(fd, uint32Zero)}
- }
- case protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
- if t.Kind() == reflect.Uint64 {
- return &uint64Converter{t, defVal(fd, uint64Zero)}
- }
- case protoreflect.FloatKind:
- if t.Kind() == reflect.Float32 {
- return &float32Converter{t, defVal(fd, float32Zero)}
- }
- case protoreflect.DoubleKind:
- if t.Kind() == reflect.Float64 {
- return &float64Converter{t, defVal(fd, float64Zero)}
- }
- case protoreflect.StringKind:
- if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
- return &stringConverter{t, defVal(fd, stringZero)}
- }
- case protoreflect.BytesKind:
- if t.Kind() == reflect.String || (t.Kind() == reflect.Slice && t.Elem() == byteType) {
- return &bytesConverter{t, defVal(fd, bytesZero)}
- }
- case protoreflect.EnumKind:
- // Handle enums, which must be a named int32 type.
- if t.Kind() == reflect.Int32 {
- return newEnumConverter(t, fd)
- }
- case protoreflect.MessageKind, protoreflect.GroupKind:
- return newMessageConverter(t)
- }
- panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
-}
-
-type boolConverter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *boolConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfBool(v.Bool())
-}
-func (c *boolConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(v.Bool()).Convert(c.goType)
-}
-func (c *boolConverter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(bool)
- return ok
-}
-func (c *boolConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *boolConverter) New() protoreflect.Value { return c.def }
-func (c *boolConverter) Zero() protoreflect.Value { return c.def }
-
-type int32Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *int32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfInt32(int32(v.Int()))
-}
-func (c *int32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(int32(v.Int())).Convert(c.goType)
-}
-func (c *int32Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(int32)
- return ok
-}
-func (c *int32Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *int32Converter) New() protoreflect.Value { return c.def }
-func (c *int32Converter) Zero() protoreflect.Value { return c.def }
-
-type int64Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *int64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfInt64(int64(v.Int()))
-}
-func (c *int64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(int64(v.Int())).Convert(c.goType)
-}
-func (c *int64Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(int64)
- return ok
-}
-func (c *int64Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *int64Converter) New() protoreflect.Value { return c.def }
-func (c *int64Converter) Zero() protoreflect.Value { return c.def }
-
-type uint32Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *uint32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfUint32(uint32(v.Uint()))
-}
-func (c *uint32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(uint32(v.Uint())).Convert(c.goType)
-}
-func (c *uint32Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(uint32)
- return ok
-}
-func (c *uint32Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *uint32Converter) New() protoreflect.Value { return c.def }
-func (c *uint32Converter) Zero() protoreflect.Value { return c.def }
-
-type uint64Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *uint64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfUint64(uint64(v.Uint()))
-}
-func (c *uint64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(uint64(v.Uint())).Convert(c.goType)
-}
-func (c *uint64Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(uint64)
- return ok
-}
-func (c *uint64Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *uint64Converter) New() protoreflect.Value { return c.def }
-func (c *uint64Converter) Zero() protoreflect.Value { return c.def }
-
-type float32Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *float32Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfFloat32(float32(v.Float()))
-}
-func (c *float32Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(float32(v.Float())).Convert(c.goType)
-}
-func (c *float32Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(float32)
- return ok
-}
-func (c *float32Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *float32Converter) New() protoreflect.Value { return c.def }
-func (c *float32Converter) Zero() protoreflect.Value { return c.def }
-
-type float64Converter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *float64Converter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfFloat64(float64(v.Float()))
-}
-func (c *float64Converter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(float64(v.Float())).Convert(c.goType)
-}
-func (c *float64Converter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(float64)
- return ok
-}
-func (c *float64Converter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *float64Converter) New() protoreflect.Value { return c.def }
-func (c *float64Converter) Zero() protoreflect.Value { return c.def }
-
-type stringConverter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *stringConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfString(v.Convert(stringType).String())
-}
-func (c *stringConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- // pref.Value.String never panics, so we go through an interface
- // conversion here to check the type.
- s := v.Interface().(string)
- if c.goType.Kind() == reflect.Slice && s == "" {
- return reflect.Zero(c.goType) // ensure empty string is []byte(nil)
- }
- return reflect.ValueOf(s).Convert(c.goType)
-}
-func (c *stringConverter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(string)
- return ok
-}
-func (c *stringConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *stringConverter) New() protoreflect.Value { return c.def }
-func (c *stringConverter) Zero() protoreflect.Value { return c.def }
-
-type bytesConverter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func (c *bytesConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- if c.goType.Kind() == reflect.String && v.Len() == 0 {
- return protoreflect.ValueOfBytes(nil) // ensure empty string is []byte(nil)
- }
- return protoreflect.ValueOfBytes(v.Convert(bytesType).Bytes())
-}
-func (c *bytesConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(v.Bytes()).Convert(c.goType)
-}
-func (c *bytesConverter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().([]byte)
- return ok
-}
-func (c *bytesConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-func (c *bytesConverter) New() protoreflect.Value { return c.def }
-func (c *bytesConverter) Zero() protoreflect.Value { return c.def }
-
-type enumConverter struct {
- goType reflect.Type
- def protoreflect.Value
-}
-
-func newEnumConverter(goType reflect.Type, fd protoreflect.FieldDescriptor) Converter {
- var def protoreflect.Value
- if fd.Cardinality() == protoreflect.Repeated {
- def = protoreflect.ValueOfEnum(fd.Enum().Values().Get(0).Number())
- } else {
- def = fd.Default()
- }
- return &enumConverter{goType, def}
-}
-
-func (c *enumConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v.Int()))
-}
-
-func (c *enumConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- return reflect.ValueOf(v.Enum()).Convert(c.goType)
-}
-
-func (c *enumConverter) IsValidPB(v protoreflect.Value) bool {
- _, ok := v.Interface().(protoreflect.EnumNumber)
- return ok
-}
-
-func (c *enumConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-
-func (c *enumConverter) New() protoreflect.Value {
- return c.def
-}
-
-func (c *enumConverter) Zero() protoreflect.Value {
- return c.def
-}
-
-type messageConverter struct {
- goType reflect.Type
-}
-
-func newMessageConverter(goType reflect.Type) Converter {
- return &messageConverter{goType}
-}
-
-func (c *messageConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- if c.isNonPointer() {
- if v.CanAddr() {
- v = v.Addr() // T => *T
- } else {
- v = reflect.Zero(reflect.PtrTo(v.Type()))
- }
- }
- if m, ok := v.Interface().(protoreflect.ProtoMessage); ok {
- return protoreflect.ValueOfMessage(m.ProtoReflect())
- }
- return protoreflect.ValueOfMessage(legacyWrapMessage(v))
-}
-
-func (c *messageConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- m := v.Message()
- var rv reflect.Value
- if u, ok := m.(unwrapper); ok {
- rv = reflect.ValueOf(u.protoUnwrap())
- } else {
- rv = reflect.ValueOf(m.Interface())
- }
- if c.isNonPointer() {
- if rv.Type() != reflect.PtrTo(c.goType) {
- panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), reflect.PtrTo(c.goType)))
- }
- if !rv.IsNil() {
- rv = rv.Elem() // *T => T
- } else {
- rv = reflect.Zero(rv.Type().Elem())
- }
- }
- if rv.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", rv.Type(), c.goType))
- }
- return rv
-}
-
-func (c *messageConverter) IsValidPB(v protoreflect.Value) bool {
- m := v.Message()
- var rv reflect.Value
- if u, ok := m.(unwrapper); ok {
- rv = reflect.ValueOf(u.protoUnwrap())
- } else {
- rv = reflect.ValueOf(m.Interface())
- }
- if c.isNonPointer() {
- return rv.Type() == reflect.PtrTo(c.goType)
- }
- return rv.Type() == c.goType
-}
-
-func (c *messageConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-
-func (c *messageConverter) New() protoreflect.Value {
- if c.isNonPointer() {
- return c.PBValueOf(reflect.New(c.goType).Elem())
- }
- return c.PBValueOf(reflect.New(c.goType.Elem()))
-}
-
-func (c *messageConverter) Zero() protoreflect.Value {
- return c.PBValueOf(reflect.Zero(c.goType))
-}
-
-// isNonPointer reports whether the type is a non-pointer type.
-// This never occurs for generated message types.
-func (c *messageConverter) isNonPointer() bool {
- return c.goType.Kind() != reflect.Ptr
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go b/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
deleted file mode 100644
index f891365..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/convert_list.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-func newListConverter(t reflect.Type, fd protoreflect.FieldDescriptor) Converter {
- switch {
- case t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Slice:
- return &listPtrConverter{t, newSingularConverter(t.Elem().Elem(), fd)}
- case t.Kind() == reflect.Slice:
- return &listConverter{t, newSingularConverter(t.Elem(), fd)}
- }
- panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
-}
-
-type listConverter struct {
- goType reflect.Type // []T
- c Converter
-}
-
-func (c *listConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- pv := reflect.New(c.goType)
- pv.Elem().Set(v)
- return protoreflect.ValueOfList(&listReflect{pv, c.c})
-}
-
-func (c *listConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- rv := v.List().(*listReflect).v
- if rv.IsNil() {
- return reflect.Zero(c.goType)
- }
- return rv.Elem()
-}
-
-func (c *listConverter) IsValidPB(v protoreflect.Value) bool {
- list, ok := v.Interface().(*listReflect)
- if !ok {
- return false
- }
- return list.v.Type().Elem() == c.goType
-}
-
-func (c *listConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-
-func (c *listConverter) New() protoreflect.Value {
- return protoreflect.ValueOfList(&listReflect{reflect.New(c.goType), c.c})
-}
-
-func (c *listConverter) Zero() protoreflect.Value {
- return protoreflect.ValueOfList(&listReflect{reflect.Zero(reflect.PtrTo(c.goType)), c.c})
-}
-
-type listPtrConverter struct {
- goType reflect.Type // *[]T
- c Converter
-}
-
-func (c *listPtrConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfList(&listReflect{v, c.c})
-}
-
-func (c *listPtrConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- return v.List().(*listReflect).v
-}
-
-func (c *listPtrConverter) IsValidPB(v protoreflect.Value) bool {
- list, ok := v.Interface().(*listReflect)
- if !ok {
- return false
- }
- return list.v.Type() == c.goType
-}
-
-func (c *listPtrConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-
-func (c *listPtrConverter) New() protoreflect.Value {
- return c.PBValueOf(reflect.New(c.goType.Elem()))
-}
-
-func (c *listPtrConverter) Zero() protoreflect.Value {
- return c.PBValueOf(reflect.Zero(c.goType))
-}
-
-type listReflect struct {
- v reflect.Value // *[]T
- conv Converter
-}
-
-func (ls *listReflect) Len() int {
- if ls.v.IsNil() {
- return 0
- }
- return ls.v.Elem().Len()
-}
-func (ls *listReflect) Get(i int) protoreflect.Value {
- return ls.conv.PBValueOf(ls.v.Elem().Index(i))
-}
-func (ls *listReflect) Set(i int, v protoreflect.Value) {
- ls.v.Elem().Index(i).Set(ls.conv.GoValueOf(v))
-}
-func (ls *listReflect) Append(v protoreflect.Value) {
- ls.v.Elem().Set(reflect.Append(ls.v.Elem(), ls.conv.GoValueOf(v)))
-}
-func (ls *listReflect) AppendMutable() protoreflect.Value {
- if _, ok := ls.conv.(*messageConverter); !ok {
- panic("invalid AppendMutable on list with non-message type")
- }
- v := ls.NewElement()
- ls.Append(v)
- return v
-}
-func (ls *listReflect) Truncate(i int) {
- ls.v.Elem().Set(ls.v.Elem().Slice(0, i))
-}
-func (ls *listReflect) NewElement() protoreflect.Value {
- return ls.conv.New()
-}
-func (ls *listReflect) IsValid() bool {
- return !ls.v.IsNil()
-}
-func (ls *listReflect) protoUnwrap() interface{} {
- return ls.v.Interface()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go b/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
deleted file mode 100644
index f30b0a0..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/convert_map.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type mapConverter struct {
- goType reflect.Type // map[K]V
- keyConv, valConv Converter
-}
-
-func newMapConverter(t reflect.Type, fd protoreflect.FieldDescriptor) *mapConverter {
- if t.Kind() != reflect.Map {
- panic(fmt.Sprintf("invalid Go type %v for field %v", t, fd.FullName()))
- }
- return &mapConverter{
- goType: t,
- keyConv: newSingularConverter(t.Key(), fd.MapKey()),
- valConv: newSingularConverter(t.Elem(), fd.MapValue()),
- }
-}
-
-func (c *mapConverter) PBValueOf(v reflect.Value) protoreflect.Value {
- if v.Type() != c.goType {
- panic(fmt.Sprintf("invalid type: got %v, want %v", v.Type(), c.goType))
- }
- return protoreflect.ValueOfMap(&mapReflect{v, c.keyConv, c.valConv})
-}
-
-func (c *mapConverter) GoValueOf(v protoreflect.Value) reflect.Value {
- return v.Map().(*mapReflect).v
-}
-
-func (c *mapConverter) IsValidPB(v protoreflect.Value) bool {
- mapv, ok := v.Interface().(*mapReflect)
- if !ok {
- return false
- }
- return mapv.v.Type() == c.goType
-}
-
-func (c *mapConverter) IsValidGo(v reflect.Value) bool {
- return v.IsValid() && v.Type() == c.goType
-}
-
-func (c *mapConverter) New() protoreflect.Value {
- return c.PBValueOf(reflect.MakeMap(c.goType))
-}
-
-func (c *mapConverter) Zero() protoreflect.Value {
- return c.PBValueOf(reflect.Zero(c.goType))
-}
-
-type mapReflect struct {
- v reflect.Value // map[K]V
- keyConv Converter
- valConv Converter
-}
-
-func (ms *mapReflect) Len() int {
- return ms.v.Len()
-}
-func (ms *mapReflect) Has(k protoreflect.MapKey) bool {
- rk := ms.keyConv.GoValueOf(k.Value())
- rv := ms.v.MapIndex(rk)
- return rv.IsValid()
-}
-func (ms *mapReflect) Get(k protoreflect.MapKey) protoreflect.Value {
- rk := ms.keyConv.GoValueOf(k.Value())
- rv := ms.v.MapIndex(rk)
- if !rv.IsValid() {
- return protoreflect.Value{}
- }
- return ms.valConv.PBValueOf(rv)
-}
-func (ms *mapReflect) Set(k protoreflect.MapKey, v protoreflect.Value) {
- rk := ms.keyConv.GoValueOf(k.Value())
- rv := ms.valConv.GoValueOf(v)
- ms.v.SetMapIndex(rk, rv)
-}
-func (ms *mapReflect) Clear(k protoreflect.MapKey) {
- rk := ms.keyConv.GoValueOf(k.Value())
- ms.v.SetMapIndex(rk, reflect.Value{})
-}
-func (ms *mapReflect) Mutable(k protoreflect.MapKey) protoreflect.Value {
- if _, ok := ms.valConv.(*messageConverter); !ok {
- panic("invalid Mutable on map with non-message value type")
- }
- v := ms.Get(k)
- if !v.IsValid() {
- v = ms.NewValue()
- ms.Set(k, v)
- }
- return v
-}
-func (ms *mapReflect) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) {
- iter := mapRange(ms.v)
- for iter.Next() {
- k := ms.keyConv.PBValueOf(iter.Key()).MapKey()
- v := ms.valConv.PBValueOf(iter.Value())
- if !f(k, v) {
- return
- }
- }
-}
-func (ms *mapReflect) NewValue() protoreflect.Value {
- return ms.valConv.New()
-}
-func (ms *mapReflect) IsValid() bool {
- return !ms.v.IsNil()
-}
-func (ms *mapReflect) protoUnwrap() interface{} {
- return ms.v.Interface()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/decode.go b/vendor/google.golang.org/protobuf/internal/impl/decode.go
deleted file mode 100644
index cda0520..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/decode.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "math/bits"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-var errDecode = errors.New("cannot parse invalid wire-format data")
-var errRecursionDepth = errors.New("exceeded maximum recursion depth")
-
-type unmarshalOptions struct {
- flags protoiface.UnmarshalInputFlags
- resolver interface {
- FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- }
- depth int
-}
-
-func (o unmarshalOptions) Options() proto.UnmarshalOptions {
- return proto.UnmarshalOptions{
- Merge: true,
- AllowPartial: true,
- DiscardUnknown: o.DiscardUnknown(),
- Resolver: o.resolver,
- }
-}
-
-func (o unmarshalOptions) DiscardUnknown() bool {
- return o.flags&protoiface.UnmarshalDiscardUnknown != 0
-}
-
-func (o unmarshalOptions) IsDefault() bool {
- return o.flags == 0 && o.resolver == protoregistry.GlobalTypes
-}
-
-var lazyUnmarshalOptions = unmarshalOptions{
- resolver: protoregistry.GlobalTypes,
- depth: protowire.DefaultRecursionLimit,
-}
-
-type unmarshalOutput struct {
- n int // number of bytes consumed
- initialized bool
-}
-
-// unmarshal is protoreflect.Methods.Unmarshal.
-func (mi *MessageInfo) unmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
- var p pointer
- if ms, ok := in.Message.(*messageState); ok {
- p = ms.pointer()
- } else {
- p = in.Message.(*messageReflectWrapper).pointer()
- }
- out, err := mi.unmarshalPointer(in.Buf, p, 0, unmarshalOptions{
- flags: in.Flags,
- resolver: in.Resolver,
- depth: in.Depth,
- })
- var flags protoiface.UnmarshalOutputFlags
- if out.initialized {
- flags |= protoiface.UnmarshalInitialized
- }
- return protoiface.UnmarshalOutput{
- Flags: flags,
- }, err
-}
-
-// errUnknown is returned during unmarshaling to indicate a parse error that
-// should result in a field being placed in the unknown fields section (for example,
-// when the wire type doesn't match) as opposed to the entire unmarshal operation
-// failing (for example, when a field extends past the available input).
-//
-// This is a sentinel error which should never be visible to the user.
-var errUnknown = errors.New("unknown")
-
-func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
- mi.init()
- opts.depth--
- if opts.depth < 0 {
- return out, errRecursionDepth
- }
- if flags.ProtoLegacy && mi.isMessageSet {
- return unmarshalMessageSet(mi, b, p, opts)
- }
- initialized := true
- var requiredMask uint64
- var exts *map[int32]ExtensionField
- start := len(b)
- for len(b) > 0 {
- // Parse the tag (field number and wire type).
- var tag uint64
- if b[0] < 0x80 {
- tag = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- tag = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- tag, n = protowire.ConsumeVarint(b)
- if n < 0 {
- return out, errDecode
- }
- b = b[n:]
- }
- var num protowire.Number
- if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {
- return out, errDecode
- } else {
- num = protowire.Number(n)
- }
- wtyp := protowire.Type(tag & 7)
-
- if wtyp == protowire.EndGroupType {
- if num != groupTag {
- return out, errDecode
- }
- groupTag = 0
- break
- }
-
- var f *coderFieldInfo
- if int(num) < len(mi.denseCoderFields) {
- f = mi.denseCoderFields[num]
- } else {
- f = mi.coderFields[num]
- }
- var n int
- err := errUnknown
- switch {
- case f != nil:
- if f.funcs.unmarshal == nil {
- break
- }
- var o unmarshalOutput
- o, err = f.funcs.unmarshal(b, p.Apply(f.offset), wtyp, f, opts)
- n = o.n
- if err != nil {
- break
- }
- requiredMask |= f.validation.requiredBit
- if f.funcs.isInit != nil && !o.initialized {
- initialized = false
- }
- default:
- // Possible extension.
- if exts == nil && mi.extensionOffset.IsValid() {
- exts = p.Apply(mi.extensionOffset).Extensions()
- if *exts == nil {
- *exts = make(map[int32]ExtensionField)
- }
- }
- if exts == nil {
- break
- }
- var o unmarshalOutput
- o, err = mi.unmarshalExtension(b, num, wtyp, *exts, opts)
- if err != nil {
- break
- }
- n = o.n
- if !o.initialized {
- initialized = false
- }
- }
- if err != nil {
- if err != errUnknown {
- return out, err
- }
- n = protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return out, errDecode
- }
- if !opts.DiscardUnknown() && mi.unknownOffset.IsValid() {
- u := mi.mutableUnknownBytes(p)
- *u = protowire.AppendTag(*u, num, wtyp)
- *u = append(*u, b[:n]...)
- }
- }
- b = b[n:]
- }
- if groupTag != 0 {
- return out, errDecode
- }
- if mi.numRequiredFields > 0 && bits.OnesCount64(requiredMask) != int(mi.numRequiredFields) {
- initialized = false
- }
- if initialized {
- out.initialized = true
- }
- out.n = start - len(b)
- return out, nil
-}
-
-func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp protowire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) {
- x := exts[int32(num)]
- xt := x.Type()
- if xt == nil {
- var err error
- xt, err = opts.resolver.FindExtensionByNumber(mi.Desc.FullName(), num)
- if err != nil {
- if err == protoregistry.NotFound {
- return out, errUnknown
- }
- return out, errors.New("%v: unable to resolve extension %v: %v", mi.Desc.FullName(), num, err)
- }
- }
- xi := getExtensionFieldInfo(xt)
- if xi.funcs.unmarshal == nil {
- return out, errUnknown
- }
- if flags.LazyUnmarshalExtensions {
- if opts.IsDefault() && x.canLazy(xt) {
- out, valid := skipExtension(b, xi, num, wtyp, opts)
- switch valid {
- case ValidationValid:
- if out.initialized {
- x.appendLazyBytes(xt, xi, num, wtyp, b[:out.n])
- exts[int32(num)] = x
- return out, nil
- }
- case ValidationInvalid:
- return out, errDecode
- case ValidationUnknown:
- }
- }
- }
- ival := x.Value()
- if !ival.IsValid() && xi.unmarshalNeedsValue {
- // Create a new message, list, or map value to fill in.
- // For enums, create a prototype value to let the unmarshal func know the
- // concrete type.
- ival = xt.New()
- }
- v, out, err := xi.funcs.unmarshal(b, ival, num, wtyp, opts)
- if err != nil {
- return out, err
- }
- if xi.funcs.isInit == nil {
- out.initialized = true
- }
- x.Set(xt, v)
- exts[int32(num)] = x
- return out, nil
-}
-
-func skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) {
- if xi.validation.mi == nil {
- return out, ValidationUnknown
- }
- xi.validation.mi.init()
- switch xi.validation.typ {
- case validationTypeMessage:
- if wtyp != protowire.BytesType {
- return out, ValidationUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return out, ValidationUnknown
- }
- out, st := xi.validation.mi.validate(v, 0, opts)
- out.n = n
- return out, st
- case validationTypeGroup:
- if wtyp != protowire.StartGroupType {
- return out, ValidationUnknown
- }
- out, st := xi.validation.mi.validate(b, num, opts)
- return out, st
- default:
- return out, ValidationUnknown
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/encode.go b/vendor/google.golang.org/protobuf/internal/impl/encode.go
deleted file mode 100644
index 845c67d..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/encode.go
+++ /dev/null
@@ -1,201 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "math"
- "sort"
- "sync/atomic"
-
- "google.golang.org/protobuf/internal/flags"
- proto "google.golang.org/protobuf/proto"
- piface "google.golang.org/protobuf/runtime/protoiface"
-)
-
-type marshalOptions struct {
- flags piface.MarshalInputFlags
-}
-
-func (o marshalOptions) Options() proto.MarshalOptions {
- return proto.MarshalOptions{
- AllowPartial: true,
- Deterministic: o.Deterministic(),
- UseCachedSize: o.UseCachedSize(),
- }
-}
-
-func (o marshalOptions) Deterministic() bool { return o.flags&piface.MarshalDeterministic != 0 }
-func (o marshalOptions) UseCachedSize() bool { return o.flags&piface.MarshalUseCachedSize != 0 }
-
-// size is protoreflect.Methods.Size.
-func (mi *MessageInfo) size(in piface.SizeInput) piface.SizeOutput {
- var p pointer
- if ms, ok := in.Message.(*messageState); ok {
- p = ms.pointer()
- } else {
- p = in.Message.(*messageReflectWrapper).pointer()
- }
- size := mi.sizePointer(p, marshalOptions{
- flags: in.Flags,
- })
- return piface.SizeOutput{Size: size}
-}
-
-func (mi *MessageInfo) sizePointer(p pointer, opts marshalOptions) (size int) {
- mi.init()
- if p.IsNil() {
- return 0
- }
- if opts.UseCachedSize() && mi.sizecacheOffset.IsValid() {
- if size := atomic.LoadInt32(p.Apply(mi.sizecacheOffset).Int32()); size >= 0 {
- return int(size)
- }
- }
- return mi.sizePointerSlow(p, opts)
-}
-
-func (mi *MessageInfo) sizePointerSlow(p pointer, opts marshalOptions) (size int) {
- if flags.ProtoLegacy && mi.isMessageSet {
- size = sizeMessageSet(mi, p, opts)
- if mi.sizecacheOffset.IsValid() {
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))
- }
- return size
- }
- if mi.extensionOffset.IsValid() {
- e := p.Apply(mi.extensionOffset).Extensions()
- size += mi.sizeExtensions(e, opts)
- }
- for _, f := range mi.orderedCoderFields {
- if f.funcs.size == nil {
- continue
- }
- fptr := p.Apply(f.offset)
- if f.isPointer && fptr.Elem().IsNil() {
- continue
- }
- size += f.funcs.size(fptr, f, opts)
- }
- if mi.unknownOffset.IsValid() {
- if u := mi.getUnknownBytes(p); u != nil {
- size += len(*u)
- }
- }
- if mi.sizecacheOffset.IsValid() {
- if size > math.MaxInt32 {
- // The size is too large for the int32 sizecache field.
- // We will need to recompute the size when encoding;
- // unfortunately expensive, but better than invalid output.
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), -1)
- } else {
- atomic.StoreInt32(p.Apply(mi.sizecacheOffset).Int32(), int32(size))
- }
- }
- return size
-}
-
-// marshal is protoreflect.Methods.Marshal.
-func (mi *MessageInfo) marshal(in piface.MarshalInput) (out piface.MarshalOutput, err error) {
- var p pointer
- if ms, ok := in.Message.(*messageState); ok {
- p = ms.pointer()
- } else {
- p = in.Message.(*messageReflectWrapper).pointer()
- }
- b, err := mi.marshalAppendPointer(in.Buf, p, marshalOptions{
- flags: in.Flags,
- })
- return piface.MarshalOutput{Buf: b}, err
-}
-
-func (mi *MessageInfo) marshalAppendPointer(b []byte, p pointer, opts marshalOptions) ([]byte, error) {
- mi.init()
- if p.IsNil() {
- return b, nil
- }
- if flags.ProtoLegacy && mi.isMessageSet {
- return marshalMessageSet(mi, b, p, opts)
- }
- var err error
- // The old marshaler encodes extensions at beginning.
- if mi.extensionOffset.IsValid() {
- e := p.Apply(mi.extensionOffset).Extensions()
- // TODO: Special handling for MessageSet?
- b, err = mi.appendExtensions(b, e, opts)
- if err != nil {
- return b, err
- }
- }
- for _, f := range mi.orderedCoderFields {
- if f.funcs.marshal == nil {
- continue
- }
- fptr := p.Apply(f.offset)
- if f.isPointer && fptr.Elem().IsNil() {
- continue
- }
- b, err = f.funcs.marshal(b, fptr, f, opts)
- if err != nil {
- return b, err
- }
- }
- if mi.unknownOffset.IsValid() && !mi.isMessageSet {
- if u := mi.getUnknownBytes(p); u != nil {
- b = append(b, (*u)...)
- }
- }
- return b, nil
-}
-
-func (mi *MessageInfo) sizeExtensions(ext *map[int32]ExtensionField, opts marshalOptions) (n int) {
- if ext == nil {
- return 0
- }
- for _, x := range *ext {
- xi := getExtensionFieldInfo(x.Type())
- if xi.funcs.size == nil {
- continue
- }
- n += xi.funcs.size(x.Value(), xi.tagsize, opts)
- }
- return n
-}
-
-func (mi *MessageInfo) appendExtensions(b []byte, ext *map[int32]ExtensionField, opts marshalOptions) ([]byte, error) {
- if ext == nil {
- return b, nil
- }
-
- switch len(*ext) {
- case 0:
- return b, nil
- case 1:
- // Fast-path for one extension: Don't bother sorting the keys.
- var err error
- for _, x := range *ext {
- xi := getExtensionFieldInfo(x.Type())
- b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)
- }
- return b, err
- default:
- // Sort the keys to provide a deterministic encoding.
- // Not sure this is required, but the old code does it.
- keys := make([]int, 0, len(*ext))
- for k := range *ext {
- keys = append(keys, int(k))
- }
- sort.Ints(keys)
- var err error
- for _, k := range keys {
- x := (*ext)[int32(k)]
- xi := getExtensionFieldInfo(x.Type())
- b, err = xi.funcs.marshal(b, x.Value(), xi.wiretag, opts)
- if err != nil {
- return b, err
- }
- }
- return b, nil
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/enum.go b/vendor/google.golang.org/protobuf/internal/impl/enum.go
deleted file mode 100644
index 5f3ef5a..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/enum.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "reflect"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type EnumInfo struct {
- GoReflectType reflect.Type // int32 kind
- Desc protoreflect.EnumDescriptor
-}
-
-func (t *EnumInfo) New(n protoreflect.EnumNumber) protoreflect.Enum {
- return reflect.ValueOf(n).Convert(t.GoReflectType).Interface().(protoreflect.Enum)
-}
-func (t *EnumInfo) Descriptor() protoreflect.EnumDescriptor { return t.Desc }
diff --git a/vendor/google.golang.org/protobuf/internal/impl/extension.go b/vendor/google.golang.org/protobuf/internal/impl/extension.go
deleted file mode 100644
index cb25b0b..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/extension.go
+++ /dev/null
@@ -1,156 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "reflect"
- "sync"
- "sync/atomic"
-
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// ExtensionInfo implements ExtensionType.
-//
-// This type contains a number of exported fields for legacy compatibility.
-// The only non-deprecated use of this type is through the methods of the
-// ExtensionType interface.
-type ExtensionInfo struct {
- // An ExtensionInfo may exist in several stages of initialization.
- //
- // extensionInfoUninitialized: Some or all of the legacy exported
- // fields may be set, but none of the unexported fields have been
- // initialized. This is the starting state for an ExtensionInfo
- // in legacy generated code.
- //
- // extensionInfoDescInit: The desc field is set, but other unexported fields
- // may not be initialized. Legacy exported fields may or may not be set.
- // This is the starting state for an ExtensionInfo in newly generated code.
- //
- // extensionInfoFullInit: The ExtensionInfo is fully initialized.
- // This state is only entered after lazy initialization is complete.
- init uint32
- mu sync.Mutex
-
- goType reflect.Type
- desc extensionTypeDescriptor
- conv Converter
- info *extensionFieldInfo // for fast-path method implementations
-
- // ExtendedType is a typed nil-pointer to the parent message type that
- // is being extended. It is possible for this to be unpopulated in v2
- // since the message may no longer implement the MessageV1 interface.
- //
- // Deprecated: Use the ExtendedType method instead.
- ExtendedType protoiface.MessageV1
-
- // ExtensionType is the zero value of the extension type.
- //
- // For historical reasons, reflect.TypeOf(ExtensionType) and the
- // type returned by InterfaceOf may not be identical.
- //
- // Deprecated: Use InterfaceOf(xt.Zero()) instead.
- ExtensionType interface{}
-
- // Field is the field number of the extension.
- //
- // Deprecated: Use the Descriptor().Number method instead.
- Field int32
-
- // Name is the fully qualified name of extension.
- //
- // Deprecated: Use the Descriptor().FullName method instead.
- Name string
-
- // Tag is the protobuf struct tag used in the v1 API.
- //
- // Deprecated: Do not use.
- Tag string
-
- // Filename is the proto filename in which the extension is defined.
- //
- // Deprecated: Use Descriptor().ParentFile().Path() instead.
- Filename string
-}
-
-// Stages of initialization: See the ExtensionInfo.init field.
-const (
- extensionInfoUninitialized = 0
- extensionInfoDescInit = 1
- extensionInfoFullInit = 2
-)
-
-func InitExtensionInfo(xi *ExtensionInfo, xd protoreflect.ExtensionDescriptor, goType reflect.Type) {
- xi.goType = goType
- xi.desc = extensionTypeDescriptor{xd, xi}
- xi.init = extensionInfoDescInit
-}
-
-func (xi *ExtensionInfo) New() protoreflect.Value {
- return xi.lazyInit().New()
-}
-func (xi *ExtensionInfo) Zero() protoreflect.Value {
- return xi.lazyInit().Zero()
-}
-func (xi *ExtensionInfo) ValueOf(v interface{}) protoreflect.Value {
- return xi.lazyInit().PBValueOf(reflect.ValueOf(v))
-}
-func (xi *ExtensionInfo) InterfaceOf(v protoreflect.Value) interface{} {
- return xi.lazyInit().GoValueOf(v).Interface()
-}
-func (xi *ExtensionInfo) IsValidValue(v protoreflect.Value) bool {
- return xi.lazyInit().IsValidPB(v)
-}
-func (xi *ExtensionInfo) IsValidInterface(v interface{}) bool {
- return xi.lazyInit().IsValidGo(reflect.ValueOf(v))
-}
-func (xi *ExtensionInfo) TypeDescriptor() protoreflect.ExtensionTypeDescriptor {
- if atomic.LoadUint32(&xi.init) < extensionInfoDescInit {
- xi.lazyInitSlow()
- }
- return &xi.desc
-}
-
-func (xi *ExtensionInfo) lazyInit() Converter {
- if atomic.LoadUint32(&xi.init) < extensionInfoFullInit {
- xi.lazyInitSlow()
- }
- return xi.conv
-}
-
-func (xi *ExtensionInfo) lazyInitSlow() {
- xi.mu.Lock()
- defer xi.mu.Unlock()
-
- if xi.init == extensionInfoFullInit {
- return
- }
- defer atomic.StoreUint32(&xi.init, extensionInfoFullInit)
-
- if xi.desc.ExtensionDescriptor == nil {
- xi.initFromLegacy()
- }
- if !xi.desc.ExtensionDescriptor.IsPlaceholder() {
- if xi.ExtensionType == nil {
- xi.initToLegacy()
- }
- xi.conv = NewConverter(xi.goType, xi.desc.ExtensionDescriptor)
- xi.info = makeExtensionFieldInfo(xi.desc.ExtensionDescriptor)
- xi.info.validation = newValidationInfo(xi.desc.ExtensionDescriptor, xi.goType)
- }
-}
-
-type extensionTypeDescriptor struct {
- protoreflect.ExtensionDescriptor
- xi *ExtensionInfo
-}
-
-func (xtd *extensionTypeDescriptor) Type() protoreflect.ExtensionType {
- return xtd.xi
-}
-func (xtd *extensionTypeDescriptor) Descriptor() protoreflect.ExtensionDescriptor {
- return xtd.ExtensionDescriptor
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
deleted file mode 100644
index c2a803b..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
-
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// legacyEnumName returns the name of enums used in legacy code.
-// It is neither the protobuf full name nor the qualified Go name,
-// but rather an odd hybrid of both.
-func legacyEnumName(ed protoreflect.EnumDescriptor) string {
- var protoPkg string
- enumName := string(ed.FullName())
- if fd := ed.ParentFile(); fd != nil {
- protoPkg = string(fd.Package())
- enumName = strings.TrimPrefix(enumName, protoPkg+".")
- }
- if protoPkg == "" {
- return strs.GoCamelCase(enumName)
- }
- return protoPkg + "." + strs.GoCamelCase(enumName)
-}
-
-// legacyWrapEnum wraps v as a protoreflect.Enum,
-// where v must be a int32 kind and not implement the v2 API already.
-func legacyWrapEnum(v reflect.Value) protoreflect.Enum {
- et := legacyLoadEnumType(v.Type())
- return et.New(protoreflect.EnumNumber(v.Int()))
-}
-
-var legacyEnumTypeCache sync.Map // map[reflect.Type]protoreflect.EnumType
-
-// legacyLoadEnumType dynamically loads a protoreflect.EnumType for t,
-// where t must be an int32 kind and not implement the v2 API already.
-func legacyLoadEnumType(t reflect.Type) protoreflect.EnumType {
- // Fast-path: check if a EnumType is cached for this concrete type.
- if et, ok := legacyEnumTypeCache.Load(t); ok {
- return et.(protoreflect.EnumType)
- }
-
- // Slow-path: derive enum descriptor and initialize EnumType.
- var et protoreflect.EnumType
- ed := LegacyLoadEnumDesc(t)
- et = &legacyEnumType{
- desc: ed,
- goType: t,
- }
- if et, ok := legacyEnumTypeCache.LoadOrStore(t, et); ok {
- return et.(protoreflect.EnumType)
- }
- return et
-}
-
-type legacyEnumType struct {
- desc protoreflect.EnumDescriptor
- goType reflect.Type
- m sync.Map // map[protoreflect.EnumNumber]proto.Enum
-}
-
-func (t *legacyEnumType) New(n protoreflect.EnumNumber) protoreflect.Enum {
- if e, ok := t.m.Load(n); ok {
- return e.(protoreflect.Enum)
- }
- e := &legacyEnumWrapper{num: n, pbTyp: t, goTyp: t.goType}
- t.m.Store(n, e)
- return e
-}
-func (t *legacyEnumType) Descriptor() protoreflect.EnumDescriptor {
- return t.desc
-}
-
-type legacyEnumWrapper struct {
- num protoreflect.EnumNumber
- pbTyp protoreflect.EnumType
- goTyp reflect.Type
-}
-
-func (e *legacyEnumWrapper) Descriptor() protoreflect.EnumDescriptor {
- return e.pbTyp.Descriptor()
-}
-func (e *legacyEnumWrapper) Type() protoreflect.EnumType {
- return e.pbTyp
-}
-func (e *legacyEnumWrapper) Number() protoreflect.EnumNumber {
- return e.num
-}
-func (e *legacyEnumWrapper) ProtoReflect() protoreflect.Enum {
- return e
-}
-func (e *legacyEnumWrapper) protoUnwrap() interface{} {
- v := reflect.New(e.goTyp).Elem()
- v.SetInt(int64(e.num))
- return v.Interface()
-}
-
-var (
- _ protoreflect.Enum = (*legacyEnumWrapper)(nil)
- _ unwrapper = (*legacyEnumWrapper)(nil)
-)
-
-var legacyEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
-
-// LegacyLoadEnumDesc returns an EnumDescriptor derived from the Go type,
-// which must be an int32 kind and not implement the v2 API already.
-//
-// This is exported for testing purposes.
-func LegacyLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
- // Fast-path: check if an EnumDescriptor is cached for this concrete type.
- if ed, ok := legacyEnumDescCache.Load(t); ok {
- return ed.(protoreflect.EnumDescriptor)
- }
-
- // Slow-path: initialize EnumDescriptor from the raw descriptor.
- ev := reflect.Zero(t).Interface()
- if _, ok := ev.(protoreflect.Enum); ok {
- panic(fmt.Sprintf("%v already implements proto.Enum", t))
- }
- edV1, ok := ev.(enumV1)
- if !ok {
- return aberrantLoadEnumDesc(t)
- }
- b, idxs := edV1.EnumDescriptor()
-
- var ed protoreflect.EnumDescriptor
- if len(idxs) == 1 {
- ed = legacyLoadFileDesc(b).Enums().Get(idxs[0])
- } else {
- md := legacyLoadFileDesc(b).Messages().Get(idxs[0])
- for _, i := range idxs[1 : len(idxs)-1] {
- md = md.Messages().Get(i)
- }
- ed = md.Enums().Get(idxs[len(idxs)-1])
- }
- if ed, ok := legacyEnumDescCache.LoadOrStore(t, ed); ok {
- return ed.(protoreflect.EnumDescriptor)
- }
- return ed
-}
-
-var aberrantEnumDescCache sync.Map // map[reflect.Type]protoreflect.EnumDescriptor
-
-// aberrantLoadEnumDesc returns an EnumDescriptor derived from the Go type,
-// which must not implement protoreflect.Enum or enumV1.
-//
-// If the type does not implement enumV1, then there is no reliable
-// way to derive the original protobuf type information.
-// We are unable to use the global enum registry since it is
-// unfortunately keyed by the protobuf full name, which we also do not know.
-// Thus, this produces some bogus enum descriptor based on the Go type name.
-func aberrantLoadEnumDesc(t reflect.Type) protoreflect.EnumDescriptor {
- // Fast-path: check if an EnumDescriptor is cached for this concrete type.
- if ed, ok := aberrantEnumDescCache.Load(t); ok {
- return ed.(protoreflect.EnumDescriptor)
- }
-
- // Slow-path: construct a bogus, but unique EnumDescriptor.
- ed := &filedesc.Enum{L2: new(filedesc.EnumL2)}
- ed.L0.FullName = AberrantDeriveFullName(t) // e.g., github_com.user.repo.MyEnum
- ed.L0.ParentFile = filedesc.SurrogateProto3
- ed.L2.Values.List = append(ed.L2.Values.List, filedesc.EnumValue{})
-
- // TODO: Use the presence of a UnmarshalJSON method to determine proto2?
-
- vd := &ed.L2.Values.List[0]
- vd.L0.FullName = ed.L0.FullName + "_UNKNOWN" // e.g., github_com.user.repo.MyEnum_UNKNOWN
- vd.L0.ParentFile = ed.L0.ParentFile
- vd.L0.Parent = ed
-
- // TODO: We could use the String method to obtain some enum value names by
- // starting at 0 and print the enum until it produces invalid identifiers.
- // An exhaustive query is clearly impractical, but can be best-effort.
-
- if ed, ok := aberrantEnumDescCache.LoadOrStore(t, ed); ok {
- return ed.(protoreflect.EnumDescriptor)
- }
- return ed
-}
-
-// AberrantDeriveFullName derives a fully qualified protobuf name for the given Go type
-// The provided name is not guaranteed to be stable nor universally unique.
-// It should be sufficiently unique within a program.
-//
-// This is exported for testing purposes.
-func AberrantDeriveFullName(t reflect.Type) protoreflect.FullName {
- sanitize := func(r rune) rune {
- switch {
- case r == '/':
- return '.'
- case 'a' <= r && r <= 'z', 'A' <= r && r <= 'Z', '0' <= r && r <= '9':
- return r
- default:
- return '_'
- }
- }
- prefix := strings.Map(sanitize, t.PkgPath())
- suffix := strings.Map(sanitize, t.Name())
- if suffix == "" {
- suffix = fmt.Sprintf("UnknownX%X", reflect.ValueOf(t).Pointer())
- }
-
- ss := append(strings.Split(prefix, "."), suffix)
- for i, s := range ss {
- if s == "" || ('0' <= s[0] && s[0] <= '9') {
- ss[i] = "x" + s
- }
- }
- return protoreflect.FullName(strings.Join(ss, "."))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
deleted file mode 100644
index 9b64ad5..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "encoding/binary"
- "encoding/json"
- "hash/crc32"
- "math"
- "reflect"
-
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// These functions exist to support exported APIs in generated protobufs.
-// While these are deprecated, they cannot be removed for compatibility reasons.
-
-// LegacyEnumName returns the name of enums used in legacy code.
-func (Export) LegacyEnumName(ed protoreflect.EnumDescriptor) string {
- return legacyEnumName(ed)
-}
-
-// LegacyMessageTypeOf returns the protoreflect.MessageType for m,
-// with name used as the message name if necessary.
-func (Export) LegacyMessageTypeOf(m protoiface.MessageV1, name protoreflect.FullName) protoreflect.MessageType {
- if mv := (Export{}).protoMessageV2Of(m); mv != nil {
- return mv.ProtoReflect().Type()
- }
- return legacyLoadMessageType(reflect.TypeOf(m), name)
-}
-
-// UnmarshalJSONEnum unmarshals an enum from a JSON-encoded input.
-// The input can either be a string representing the enum value by name,
-// or a number representing the enum number itself.
-func (Export) UnmarshalJSONEnum(ed protoreflect.EnumDescriptor, b []byte) (protoreflect.EnumNumber, error) {
- if b[0] == '"' {
- var name protoreflect.Name
- if err := json.Unmarshal(b, &name); err != nil {
- return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
- }
- ev := ed.Values().ByName(name)
- if ev == nil {
- return 0, errors.New("invalid value for enum %v: %s", ed.FullName(), name)
- }
- return ev.Number(), nil
- } else {
- var num protoreflect.EnumNumber
- if err := json.Unmarshal(b, &num); err != nil {
- return 0, errors.New("invalid input for enum %v: %s", ed.FullName(), b)
- }
- return num, nil
- }
-}
-
-// CompressGZIP compresses the input as a GZIP-encoded file.
-// The current implementation does no compression.
-func (Export) CompressGZIP(in []byte) (out []byte) {
- // RFC 1952, section 2.3.1.
- var gzipHeader = [10]byte{0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}
-
- // RFC 1951, section 3.2.4.
- var blockHeader [5]byte
- const maxBlockSize = math.MaxUint16
- numBlocks := 1 + len(in)/maxBlockSize
-
- // RFC 1952, section 2.3.1.
- var gzipFooter [8]byte
- binary.LittleEndian.PutUint32(gzipFooter[0:4], crc32.ChecksumIEEE(in))
- binary.LittleEndian.PutUint32(gzipFooter[4:8], uint32(len(in)))
-
- // Encode the input without compression using raw DEFLATE blocks.
- out = make([]byte, 0, len(gzipHeader)+len(blockHeader)*numBlocks+len(in)+len(gzipFooter))
- out = append(out, gzipHeader[:]...)
- for blockHeader[0] == 0 {
- blockSize := maxBlockSize
- if blockSize > len(in) {
- blockHeader[0] = 0x01 // final bit per RFC 1951, section 3.2.3.
- blockSize = len(in)
- }
- binary.LittleEndian.PutUint16(blockHeader[1:3], uint16(blockSize))
- binary.LittleEndian.PutUint16(blockHeader[3:5], ^uint16(blockSize))
- out = append(out, blockHeader[:]...)
- out = append(out, in[:blockSize]...)
- in = in[blockSize:]
- }
- out = append(out, gzipFooter[:]...)
- return out
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
deleted file mode 100644
index 87b30d0..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "reflect"
-
- "google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/encoding/messageset"
- ptag "google.golang.org/protobuf/internal/encoding/tag"
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-func (xi *ExtensionInfo) initToLegacy() {
- xd := xi.desc
- var parent protoiface.MessageV1
- messageName := xd.ContainingMessage().FullName()
- if mt, _ := protoregistry.GlobalTypes.FindMessageByName(messageName); mt != nil {
- // Create a new parent message and unwrap it if possible.
- mv := mt.New().Interface()
- t := reflect.TypeOf(mv)
- if mv, ok := mv.(unwrapper); ok {
- t = reflect.TypeOf(mv.protoUnwrap())
- }
-
- // Check whether the message implements the legacy v1 Message interface.
- mz := reflect.Zero(t).Interface()
- if mz, ok := mz.(protoiface.MessageV1); ok {
- parent = mz
- }
- }
-
- // Determine the v1 extension type, which is unfortunately not the same as
- // the v2 ExtensionType.GoType.
- extType := xi.goType
- switch extType.Kind() {
- case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
- extType = reflect.PtrTo(extType) // T -> *T for singular scalar fields
- }
-
- // Reconstruct the legacy enum full name.
- var enumName string
- if xd.Kind() == protoreflect.EnumKind {
- enumName = legacyEnumName(xd.Enum())
- }
-
- // Derive the proto file that the extension was declared within.
- var filename string
- if fd := xd.ParentFile(); fd != nil {
- filename = fd.Path()
- }
-
- // For MessageSet extensions, the name used is the parent message.
- name := xd.FullName()
- if messageset.IsMessageSetExtension(xd) {
- name = name.Parent()
- }
-
- xi.ExtendedType = parent
- xi.ExtensionType = reflect.Zero(extType).Interface()
- xi.Field = int32(xd.Number())
- xi.Name = string(name)
- xi.Tag = ptag.Marshal(xd, enumName)
- xi.Filename = filename
-}
-
-// initFromLegacy initializes an ExtensionInfo from
-// the contents of the deprecated exported fields of the type.
-func (xi *ExtensionInfo) initFromLegacy() {
- // The v1 API returns "type incomplete" descriptors where only the
- // field number is specified. In such a case, use a placeholder.
- if xi.ExtendedType == nil || xi.ExtensionType == nil {
- xd := placeholderExtension{
- name: protoreflect.FullName(xi.Name),
- number: protoreflect.FieldNumber(xi.Field),
- }
- xi.desc = extensionTypeDescriptor{xd, xi}
- return
- }
-
- // Resolve enum or message dependencies.
- var ed protoreflect.EnumDescriptor
- var md protoreflect.MessageDescriptor
- t := reflect.TypeOf(xi.ExtensionType)
- isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
- isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
- if isOptional || isRepeated {
- t = t.Elem()
- }
- switch v := reflect.Zero(t).Interface().(type) {
- case protoreflect.Enum:
- ed = v.Descriptor()
- case enumV1:
- ed = LegacyLoadEnumDesc(t)
- case protoreflect.ProtoMessage:
- md = v.ProtoReflect().Descriptor()
- case messageV1:
- md = LegacyLoadMessageDesc(t)
- }
-
- // Derive basic field information from the struct tag.
- var evs protoreflect.EnumValueDescriptors
- if ed != nil {
- evs = ed.Values()
- }
- fd := ptag.Unmarshal(xi.Tag, t, evs).(*filedesc.Field)
-
- // Construct a v2 ExtensionType.
- xd := &filedesc.Extension{L2: new(filedesc.ExtensionL2)}
- xd.L0.ParentFile = filedesc.SurrogateProto2
- xd.L0.FullName = protoreflect.FullName(xi.Name)
- xd.L1.Number = protoreflect.FieldNumber(xi.Field)
- xd.L1.Cardinality = fd.L1.Cardinality
- xd.L1.Kind = fd.L1.Kind
- xd.L2.IsPacked = fd.L1.IsPacked
- xd.L2.Default = fd.L1.Default
- xd.L1.Extendee = Export{}.MessageDescriptorOf(xi.ExtendedType)
- xd.L2.Enum = ed
- xd.L2.Message = md
-
- // Derive real extension field name for MessageSets.
- if messageset.IsMessageSet(xd.L1.Extendee) && md.FullName() == xd.L0.FullName {
- xd.L0.FullName = xd.L0.FullName.Append(messageset.ExtensionName)
- }
-
- tt := reflect.TypeOf(xi.ExtensionType)
- if isOptional {
- tt = tt.Elem()
- }
- xi.goType = tt
- xi.desc = extensionTypeDescriptor{xd, xi}
-}
-
-type placeholderExtension struct {
- name protoreflect.FullName
- number protoreflect.FieldNumber
-}
-
-func (x placeholderExtension) ParentFile() protoreflect.FileDescriptor { return nil }
-func (x placeholderExtension) Parent() protoreflect.Descriptor { return nil }
-func (x placeholderExtension) Index() int { return 0 }
-func (x placeholderExtension) Syntax() protoreflect.Syntax { return 0 }
-func (x placeholderExtension) Name() protoreflect.Name { return x.name.Name() }
-func (x placeholderExtension) FullName() protoreflect.FullName { return x.name }
-func (x placeholderExtension) IsPlaceholder() bool { return true }
-func (x placeholderExtension) Options() protoreflect.ProtoMessage { return descopts.Field }
-func (x placeholderExtension) Number() protoreflect.FieldNumber { return x.number }
-func (x placeholderExtension) Cardinality() protoreflect.Cardinality { return 0 }
-func (x placeholderExtension) Kind() protoreflect.Kind { return 0 }
-func (x placeholderExtension) HasJSONName() bool { return false }
-func (x placeholderExtension) JSONName() string { return "[" + string(x.name) + "]" }
-func (x placeholderExtension) TextName() string { return "[" + string(x.name) + "]" }
-func (x placeholderExtension) HasPresence() bool { return false }
-func (x placeholderExtension) HasOptionalKeyword() bool { return false }
-func (x placeholderExtension) IsExtension() bool { return true }
-func (x placeholderExtension) IsWeak() bool { return false }
-func (x placeholderExtension) IsPacked() bool { return false }
-func (x placeholderExtension) IsList() bool { return false }
-func (x placeholderExtension) IsMap() bool { return false }
-func (x placeholderExtension) MapKey() protoreflect.FieldDescriptor { return nil }
-func (x placeholderExtension) MapValue() protoreflect.FieldDescriptor { return nil }
-func (x placeholderExtension) HasDefault() bool { return false }
-func (x placeholderExtension) Default() protoreflect.Value { return protoreflect.Value{} }
-func (x placeholderExtension) DefaultEnumValue() protoreflect.EnumValueDescriptor { return nil }
-func (x placeholderExtension) ContainingOneof() protoreflect.OneofDescriptor { return nil }
-func (x placeholderExtension) ContainingMessage() protoreflect.MessageDescriptor { return nil }
-func (x placeholderExtension) Enum() protoreflect.EnumDescriptor { return nil }
-func (x placeholderExtension) Message() protoreflect.MessageDescriptor { return nil }
-func (x placeholderExtension) ProtoType(protoreflect.FieldDescriptor) { return }
-func (x placeholderExtension) ProtoInternal(pragma.DoNotImplement) { return }
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
deleted file mode 100644
index 9ab0910..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "bytes"
- "compress/gzip"
- "io/ioutil"
- "sync"
-
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// Every enum and message type generated by protoc-gen-go since commit 2fc053c5
-// on February 25th, 2016 has had a method to get the raw descriptor.
-// Types that were not generated by protoc-gen-go or were generated prior
-// to that version are not supported.
-//
-// The []byte returned is the encoded form of a FileDescriptorProto message
-// compressed using GZIP. The []int is the path from the top-level file
-// to the specific message or enum declaration.
-type (
- enumV1 interface {
- EnumDescriptor() ([]byte, []int)
- }
- messageV1 interface {
- Descriptor() ([]byte, []int)
- }
-)
-
-var legacyFileDescCache sync.Map // map[*byte]protoreflect.FileDescriptor
-
-// legacyLoadFileDesc unmarshals b as a compressed FileDescriptorProto message.
-//
-// This assumes that b is immutable and that b does not refer to part of a
-// concatenated series of GZIP files (which would require shenanigans that
-// rely on the concatenation properties of both protobufs and GZIP).
-// File descriptors generated by protoc-gen-go do not rely on that property.
-func legacyLoadFileDesc(b []byte) protoreflect.FileDescriptor {
- // Fast-path: check whether we already have a cached file descriptor.
- if fd, ok := legacyFileDescCache.Load(&b[0]); ok {
- return fd.(protoreflect.FileDescriptor)
- }
-
- // Slow-path: decompress and unmarshal the file descriptor proto.
- zr, err := gzip.NewReader(bytes.NewReader(b))
- if err != nil {
- panic(err)
- }
- b2, err := ioutil.ReadAll(zr)
- if err != nil {
- panic(err)
- }
-
- fd := filedesc.Builder{
- RawDescriptor: b2,
- FileRegistry: resolverOnly{protoregistry.GlobalFiles}, // do not register back to global registry
- }.Build().File
- if fd, ok := legacyFileDescCache.LoadOrStore(&b[0], fd); ok {
- return fd.(protoreflect.FileDescriptor)
- }
- return fd
-}
-
-type resolverOnly struct {
- reg *protoregistry.Files
-}
-
-func (r resolverOnly) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
- return r.reg.FindFileByPath(path)
-}
-func (r resolverOnly) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
- return r.reg.FindDescriptorByName(name)
-}
-func (resolverOnly) RegisterFile(protoreflect.FileDescriptor) error {
- return nil
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
deleted file mode 100644
index 2ab2c62..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go
+++ /dev/null
@@ -1,568 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "strings"
- "sync"
-
- "google.golang.org/protobuf/internal/descopts"
- ptag "google.golang.org/protobuf/internal/encoding/tag"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// legacyWrapMessage wraps v as a protoreflect.Message,
-// where v must be a *struct kind and not implement the v2 API already.
-func legacyWrapMessage(v reflect.Value) protoreflect.Message {
- t := v.Type()
- if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
- return aberrantMessage{v: v}
- }
- mt := legacyLoadMessageInfo(t, "")
- return mt.MessageOf(v.Interface())
-}
-
-// legacyLoadMessageType dynamically loads a protoreflect.Type for t,
-// where t must be not implement the v2 API already.
-// The provided name is used if it cannot be determined from the message.
-func legacyLoadMessageType(t reflect.Type, name protoreflect.FullName) protoreflect.MessageType {
- if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
- return aberrantMessageType{t}
- }
- return legacyLoadMessageInfo(t, name)
-}
-
-var legacyMessageTypeCache sync.Map // map[reflect.Type]*MessageInfo
-
-// legacyLoadMessageInfo dynamically loads a *MessageInfo for t,
-// where t must be a *struct kind and not implement the v2 API already.
-// The provided name is used if it cannot be determined from the message.
-func legacyLoadMessageInfo(t reflect.Type, name protoreflect.FullName) *MessageInfo {
- // Fast-path: check if a MessageInfo is cached for this concrete type.
- if mt, ok := legacyMessageTypeCache.Load(t); ok {
- return mt.(*MessageInfo)
- }
-
- // Slow-path: derive message descriptor and initialize MessageInfo.
- mi := &MessageInfo{
- Desc: legacyLoadMessageDesc(t, name),
- GoReflectType: t,
- }
-
- var hasMarshal, hasUnmarshal bool
- v := reflect.Zero(t).Interface()
- if _, hasMarshal = v.(legacyMarshaler); hasMarshal {
- mi.methods.Marshal = legacyMarshal
-
- // We have no way to tell whether the type's Marshal method
- // supports deterministic serialization or not, but this
- // preserves the v1 implementation's behavior of always
- // calling Marshal methods when present.
- mi.methods.Flags |= protoiface.SupportMarshalDeterministic
- }
- if _, hasUnmarshal = v.(legacyUnmarshaler); hasUnmarshal {
- mi.methods.Unmarshal = legacyUnmarshal
- }
- if _, hasMerge := v.(legacyMerger); hasMerge || (hasMarshal && hasUnmarshal) {
- mi.methods.Merge = legacyMerge
- }
-
- if mi, ok := legacyMessageTypeCache.LoadOrStore(t, mi); ok {
- return mi.(*MessageInfo)
- }
- return mi
-}
-
-var legacyMessageDescCache sync.Map // map[reflect.Type]protoreflect.MessageDescriptor
-
-// LegacyLoadMessageDesc returns an MessageDescriptor derived from the Go type,
-// which should be a *struct kind and must not implement the v2 API already.
-//
-// This is exported for testing purposes.
-func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {
- return legacyLoadMessageDesc(t, "")
-}
-func legacyLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
- // Fast-path: check if a MessageDescriptor is cached for this concrete type.
- if mi, ok := legacyMessageDescCache.Load(t); ok {
- return mi.(protoreflect.MessageDescriptor)
- }
-
- // Slow-path: initialize MessageDescriptor from the raw descriptor.
- mv := reflect.Zero(t).Interface()
- if _, ok := mv.(protoreflect.ProtoMessage); ok {
- panic(fmt.Sprintf("%v already implements proto.Message", t))
- }
- mdV1, ok := mv.(messageV1)
- if !ok {
- return aberrantLoadMessageDesc(t, name)
- }
-
- // If this is a dynamic message type where there isn't a 1-1 mapping between
- // Go and protobuf types, calling the Descriptor method on the zero value of
- // the message type isn't likely to work. If it panics, swallow the panic and
- // continue as if the Descriptor method wasn't present.
- b, idxs := func() ([]byte, []int) {
- defer func() {
- recover()
- }()
- return mdV1.Descriptor()
- }()
- if b == nil {
- return aberrantLoadMessageDesc(t, name)
- }
-
- // If the Go type has no fields, then this might be a proto3 empty message
- // from before the size cache was added. If there are any fields, check to
- // see that at least one of them looks like something we generated.
- if t.Elem().Kind() == reflect.Struct {
- if nfield := t.Elem().NumField(); nfield > 0 {
- hasProtoField := false
- for i := 0; i < nfield; i++ {
- f := t.Elem().Field(i)
- if f.Tag.Get("protobuf") != "" || f.Tag.Get("protobuf_oneof") != "" || strings.HasPrefix(f.Name, "XXX_") {
- hasProtoField = true
- break
- }
- }
- if !hasProtoField {
- return aberrantLoadMessageDesc(t, name)
- }
- }
- }
-
- md := legacyLoadFileDesc(b).Messages().Get(idxs[0])
- for _, i := range idxs[1:] {
- md = md.Messages().Get(i)
- }
- if name != "" && md.FullName() != name {
- panic(fmt.Sprintf("mismatching message name: got %v, want %v", md.FullName(), name))
- }
- if md, ok := legacyMessageDescCache.LoadOrStore(t, md); ok {
- return md.(protoreflect.MessageDescriptor)
- }
- return md
-}
-
-var (
- aberrantMessageDescLock sync.Mutex
- aberrantMessageDescCache map[reflect.Type]protoreflect.MessageDescriptor
-)
-
-// aberrantLoadMessageDesc returns an MessageDescriptor derived from the Go type,
-// which must not implement protoreflect.ProtoMessage or messageV1.
-//
-// This is a best-effort derivation of the message descriptor using the protobuf
-// tags on the struct fields.
-func aberrantLoadMessageDesc(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
- aberrantMessageDescLock.Lock()
- defer aberrantMessageDescLock.Unlock()
- if aberrantMessageDescCache == nil {
- aberrantMessageDescCache = make(map[reflect.Type]protoreflect.MessageDescriptor)
- }
- return aberrantLoadMessageDescReentrant(t, name)
-}
-func aberrantLoadMessageDescReentrant(t reflect.Type, name protoreflect.FullName) protoreflect.MessageDescriptor {
- // Fast-path: check if an MessageDescriptor is cached for this concrete type.
- if md, ok := aberrantMessageDescCache[t]; ok {
- return md
- }
-
- // Slow-path: construct a descriptor from the Go struct type (best-effort).
- // Cache the MessageDescriptor early on so that we can resolve internal
- // cyclic references.
- md := &filedesc.Message{L2: new(filedesc.MessageL2)}
- md.L0.FullName = aberrantDeriveMessageName(t, name)
- md.L0.ParentFile = filedesc.SurrogateProto2
- aberrantMessageDescCache[t] = md
-
- if t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct {
- return md
- }
-
- // Try to determine if the message is using proto3 by checking scalars.
- for i := 0; i < t.Elem().NumField(); i++ {
- f := t.Elem().Field(i)
- if tag := f.Tag.Get("protobuf"); tag != "" {
- switch f.Type.Kind() {
- case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String:
- md.L0.ParentFile = filedesc.SurrogateProto3
- }
- for _, s := range strings.Split(tag, ",") {
- if s == "proto3" {
- md.L0.ParentFile = filedesc.SurrogateProto3
- }
- }
- }
- }
-
- // Obtain a list of oneof wrapper types.
- var oneofWrappers []reflect.Type
- methods := make([]reflect.Method, 0, 2)
- if m, ok := t.MethodByName("XXX_OneofFuncs"); ok {
- methods = append(methods, m)
- }
- if m, ok := t.MethodByName("XXX_OneofWrappers"); ok {
- methods = append(methods, m)
- }
- for _, fn := range methods {
- for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
- if vs, ok := v.Interface().([]interface{}); ok {
- for _, v := range vs {
- oneofWrappers = append(oneofWrappers, reflect.TypeOf(v))
- }
- }
- }
- }
-
- // Obtain a list of the extension ranges.
- if fn, ok := t.MethodByName("ExtensionRangeArray"); ok {
- vs := fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))})[0]
- for i := 0; i < vs.Len(); i++ {
- v := vs.Index(i)
- md.L2.ExtensionRanges.List = append(md.L2.ExtensionRanges.List, [2]protoreflect.FieldNumber{
- protoreflect.FieldNumber(v.FieldByName("Start").Int()),
- protoreflect.FieldNumber(v.FieldByName("End").Int() + 1),
- })
- md.L2.ExtensionRangeOptions = append(md.L2.ExtensionRangeOptions, nil)
- }
- }
-
- // Derive the message fields by inspecting the struct fields.
- for i := 0; i < t.Elem().NumField(); i++ {
- f := t.Elem().Field(i)
- if tag := f.Tag.Get("protobuf"); tag != "" {
- tagKey := f.Tag.Get("protobuf_key")
- tagVal := f.Tag.Get("protobuf_val")
- aberrantAppendField(md, f.Type, tag, tagKey, tagVal)
- }
- if tag := f.Tag.Get("protobuf_oneof"); tag != "" {
- n := len(md.L2.Oneofs.List)
- md.L2.Oneofs.List = append(md.L2.Oneofs.List, filedesc.Oneof{})
- od := &md.L2.Oneofs.List[n]
- od.L0.FullName = md.FullName().Append(protoreflect.Name(tag))
- od.L0.ParentFile = md.L0.ParentFile
- od.L0.Parent = md
- od.L0.Index = n
-
- for _, t := range oneofWrappers {
- if t.Implements(f.Type) {
- f := t.Elem().Field(0)
- if tag := f.Tag.Get("protobuf"); tag != "" {
- aberrantAppendField(md, f.Type, tag, "", "")
- fd := &md.L2.Fields.List[len(md.L2.Fields.List)-1]
- fd.L1.ContainingOneof = od
- od.L1.Fields.List = append(od.L1.Fields.List, fd)
- }
- }
- }
- }
- }
-
- return md
-}
-
-func aberrantDeriveMessageName(t reflect.Type, name protoreflect.FullName) protoreflect.FullName {
- if name.IsValid() {
- return name
- }
- func() {
- defer func() { recover() }() // swallow possible nil panics
- if m, ok := reflect.Zero(t).Interface().(interface{ XXX_MessageName() string }); ok {
- name = protoreflect.FullName(m.XXX_MessageName())
- }
- }()
- if name.IsValid() {
- return name
- }
- if t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- return AberrantDeriveFullName(t)
-}
-
-func aberrantAppendField(md *filedesc.Message, goType reflect.Type, tag, tagKey, tagVal string) {
- t := goType
- isOptional := t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct
- isRepeated := t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8
- if isOptional || isRepeated {
- t = t.Elem()
- }
- fd := ptag.Unmarshal(tag, t, placeholderEnumValues{}).(*filedesc.Field)
-
- // Append field descriptor to the message.
- n := len(md.L2.Fields.List)
- md.L2.Fields.List = append(md.L2.Fields.List, *fd)
- fd = &md.L2.Fields.List[n]
- fd.L0.FullName = md.FullName().Append(fd.Name())
- fd.L0.ParentFile = md.L0.ParentFile
- fd.L0.Parent = md
- fd.L0.Index = n
-
- if fd.L1.IsWeak || fd.L1.HasPacked {
- fd.L1.Options = func() protoreflect.ProtoMessage {
- opts := descopts.Field.ProtoReflect().New()
- if fd.L1.IsWeak {
- opts.Set(opts.Descriptor().Fields().ByName("weak"), protoreflect.ValueOfBool(true))
- }
- if fd.L1.HasPacked {
- opts.Set(opts.Descriptor().Fields().ByName("packed"), protoreflect.ValueOfBool(fd.L1.IsPacked))
- }
- return opts.Interface()
- }
- }
-
- // Populate Enum and Message.
- if fd.Enum() == nil && fd.Kind() == protoreflect.EnumKind {
- switch v := reflect.Zero(t).Interface().(type) {
- case protoreflect.Enum:
- fd.L1.Enum = v.Descriptor()
- default:
- fd.L1.Enum = LegacyLoadEnumDesc(t)
- }
- }
- if fd.Message() == nil && (fd.Kind() == protoreflect.MessageKind || fd.Kind() == protoreflect.GroupKind) {
- switch v := reflect.Zero(t).Interface().(type) {
- case protoreflect.ProtoMessage:
- fd.L1.Message = v.ProtoReflect().Descriptor()
- case messageV1:
- fd.L1.Message = LegacyLoadMessageDesc(t)
- default:
- if t.Kind() == reflect.Map {
- n := len(md.L1.Messages.List)
- md.L1.Messages.List = append(md.L1.Messages.List, filedesc.Message{L2: new(filedesc.MessageL2)})
- md2 := &md.L1.Messages.List[n]
- md2.L0.FullName = md.FullName().Append(protoreflect.Name(strs.MapEntryName(string(fd.Name()))))
- md2.L0.ParentFile = md.L0.ParentFile
- md2.L0.Parent = md
- md2.L0.Index = n
-
- md2.L1.IsMapEntry = true
- md2.L2.Options = func() protoreflect.ProtoMessage {
- opts := descopts.Message.ProtoReflect().New()
- opts.Set(opts.Descriptor().Fields().ByName("map_entry"), protoreflect.ValueOfBool(true))
- return opts.Interface()
- }
-
- aberrantAppendField(md2, t.Key(), tagKey, "", "")
- aberrantAppendField(md2, t.Elem(), tagVal, "", "")
-
- fd.L1.Message = md2
- break
- }
- fd.L1.Message = aberrantLoadMessageDescReentrant(t, "")
- }
- }
-}
-
-type placeholderEnumValues struct {
- protoreflect.EnumValueDescriptors
-}
-
-func (placeholderEnumValues) ByNumber(n protoreflect.EnumNumber) protoreflect.EnumValueDescriptor {
- return filedesc.PlaceholderEnumValue(protoreflect.FullName(fmt.Sprintf("UNKNOWN_%d", n)))
-}
-
-// legacyMarshaler is the proto.Marshaler interface superseded by protoiface.Methoder.
-type legacyMarshaler interface {
- Marshal() ([]byte, error)
-}
-
-// legacyUnmarshaler is the proto.Unmarshaler interface superseded by protoiface.Methoder.
-type legacyUnmarshaler interface {
- Unmarshal([]byte) error
-}
-
-// legacyMerger is the proto.Merger interface superseded by protoiface.Methoder.
-type legacyMerger interface {
- Merge(protoiface.MessageV1)
-}
-
-var aberrantProtoMethods = &protoiface.Methods{
- Marshal: legacyMarshal,
- Unmarshal: legacyUnmarshal,
- Merge: legacyMerge,
-
- // We have no way to tell whether the type's Marshal method
- // supports deterministic serialization or not, but this
- // preserves the v1 implementation's behavior of always
- // calling Marshal methods when present.
- Flags: protoiface.SupportMarshalDeterministic,
-}
-
-func legacyMarshal(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
- v := in.Message.(unwrapper).protoUnwrap()
- marshaler, ok := v.(legacyMarshaler)
- if !ok {
- return protoiface.MarshalOutput{}, errors.New("%T does not implement Marshal", v)
- }
- out, err := marshaler.Marshal()
- if in.Buf != nil {
- out = append(in.Buf, out...)
- }
- return protoiface.MarshalOutput{
- Buf: out,
- }, err
-}
-
-func legacyUnmarshal(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
- v := in.Message.(unwrapper).protoUnwrap()
- unmarshaler, ok := v.(legacyUnmarshaler)
- if !ok {
- return protoiface.UnmarshalOutput{}, errors.New("%T does not implement Unmarshal", v)
- }
- return protoiface.UnmarshalOutput{}, unmarshaler.Unmarshal(in.Buf)
-}
-
-func legacyMerge(in protoiface.MergeInput) protoiface.MergeOutput {
- // Check whether this supports the legacy merger.
- dstv := in.Destination.(unwrapper).protoUnwrap()
- merger, ok := dstv.(legacyMerger)
- if ok {
- merger.Merge(Export{}.ProtoMessageV1Of(in.Source))
- return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
- }
-
- // If legacy merger is unavailable, implement merge in terms of
- // a marshal and unmarshal operation.
- srcv := in.Source.(unwrapper).protoUnwrap()
- marshaler, ok := srcv.(legacyMarshaler)
- if !ok {
- return protoiface.MergeOutput{}
- }
- dstv = in.Destination.(unwrapper).protoUnwrap()
- unmarshaler, ok := dstv.(legacyUnmarshaler)
- if !ok {
- return protoiface.MergeOutput{}
- }
- if !in.Source.IsValid() {
- // Legacy Marshal methods may not function on nil messages.
- // Check for a typed nil source only after we confirm that
- // legacy Marshal/Unmarshal methods are present, for
- // consistency.
- return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
- }
- b, err := marshaler.Marshal()
- if err != nil {
- return protoiface.MergeOutput{}
- }
- err = unmarshaler.Unmarshal(b)
- if err != nil {
- return protoiface.MergeOutput{}
- }
- return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
-}
-
-// aberrantMessageType implements MessageType for all types other than pointer-to-struct.
-type aberrantMessageType struct {
- t reflect.Type
-}
-
-func (mt aberrantMessageType) New() protoreflect.Message {
- if mt.t.Kind() == reflect.Ptr {
- return aberrantMessage{reflect.New(mt.t.Elem())}
- }
- return aberrantMessage{reflect.Zero(mt.t)}
-}
-func (mt aberrantMessageType) Zero() protoreflect.Message {
- return aberrantMessage{reflect.Zero(mt.t)}
-}
-func (mt aberrantMessageType) GoType() reflect.Type {
- return mt.t
-}
-func (mt aberrantMessageType) Descriptor() protoreflect.MessageDescriptor {
- return LegacyLoadMessageDesc(mt.t)
-}
-
-// aberrantMessage implements Message for all types other than pointer-to-struct.
-//
-// When the underlying type implements legacyMarshaler or legacyUnmarshaler,
-// the aberrant Message can be marshaled or unmarshaled. Otherwise, there is
-// not much that can be done with values of this type.
-type aberrantMessage struct {
- v reflect.Value
-}
-
-// Reset implements the v1 proto.Message.Reset method.
-func (m aberrantMessage) Reset() {
- if mr, ok := m.v.Interface().(interface{ Reset() }); ok {
- mr.Reset()
- return
- }
- if m.v.Kind() == reflect.Ptr && !m.v.IsNil() {
- m.v.Elem().Set(reflect.Zero(m.v.Type().Elem()))
- }
-}
-
-func (m aberrantMessage) ProtoReflect() protoreflect.Message {
- return m
-}
-
-func (m aberrantMessage) Descriptor() protoreflect.MessageDescriptor {
- return LegacyLoadMessageDesc(m.v.Type())
-}
-func (m aberrantMessage) Type() protoreflect.MessageType {
- return aberrantMessageType{m.v.Type()}
-}
-func (m aberrantMessage) New() protoreflect.Message {
- if m.v.Type().Kind() == reflect.Ptr {
- return aberrantMessage{reflect.New(m.v.Type().Elem())}
- }
- return aberrantMessage{reflect.Zero(m.v.Type())}
-}
-func (m aberrantMessage) Interface() protoreflect.ProtoMessage {
- return m
-}
-func (m aberrantMessage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- return
-}
-func (m aberrantMessage) Has(protoreflect.FieldDescriptor) bool {
- return false
-}
-func (m aberrantMessage) Clear(protoreflect.FieldDescriptor) {
- panic("invalid Message.Clear on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- if fd.Default().IsValid() {
- return fd.Default()
- }
- panic("invalid Message.Get on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) Set(protoreflect.FieldDescriptor, protoreflect.Value) {
- panic("invalid Message.Set on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) Mutable(protoreflect.FieldDescriptor) protoreflect.Value {
- panic("invalid Message.Mutable on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) NewField(protoreflect.FieldDescriptor) protoreflect.Value {
- panic("invalid Message.NewField on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) WhichOneof(protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
- panic("invalid Message.WhichOneof descriptor on " + string(m.Descriptor().FullName()))
-}
-func (m aberrantMessage) GetUnknown() protoreflect.RawFields {
- return nil
-}
-func (m aberrantMessage) SetUnknown(protoreflect.RawFields) {
- // SetUnknown discards its input on messages which don't support unknown field storage.
-}
-func (m aberrantMessage) IsValid() bool {
- if m.v.Kind() == reflect.Ptr {
- return !m.v.IsNil()
- }
- return false
-}
-func (m aberrantMessage) ProtoMethods() *protoiface.Methods {
- return aberrantProtoMethods
-}
-func (m aberrantMessage) protoUnwrap() interface{} {
- return m.v.Interface()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge.go b/vendor/google.golang.org/protobuf/internal/impl/merge.go
deleted file mode 100644
index 7e65f64..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/merge.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2020 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/proto"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-type mergeOptions struct{}
-
-func (o mergeOptions) Merge(dst, src proto.Message) {
- proto.Merge(dst, src)
-}
-
-// merge is protoreflect.Methods.Merge.
-func (mi *MessageInfo) merge(in protoiface.MergeInput) protoiface.MergeOutput {
- dp, ok := mi.getPointer(in.Destination)
- if !ok {
- return protoiface.MergeOutput{}
- }
- sp, ok := mi.getPointer(in.Source)
- if !ok {
- return protoiface.MergeOutput{}
- }
- mi.mergePointer(dp, sp, mergeOptions{})
- return protoiface.MergeOutput{Flags: protoiface.MergeComplete}
-}
-
-func (mi *MessageInfo) mergePointer(dst, src pointer, opts mergeOptions) {
- mi.init()
- if dst.IsNil() {
- panic(fmt.Sprintf("invalid value: merging into nil message"))
- }
- if src.IsNil() {
- return
- }
- for _, f := range mi.orderedCoderFields {
- if f.funcs.merge == nil {
- continue
- }
- sfptr := src.Apply(f.offset)
- if f.isPointer && sfptr.Elem().IsNil() {
- continue
- }
- f.funcs.merge(dst.Apply(f.offset), sfptr, f, opts)
- }
- if mi.extensionOffset.IsValid() {
- sext := src.Apply(mi.extensionOffset).Extensions()
- dext := dst.Apply(mi.extensionOffset).Extensions()
- if *dext == nil {
- *dext = make(map[int32]ExtensionField)
- }
- for num, sx := range *sext {
- xt := sx.Type()
- xi := getExtensionFieldInfo(xt)
- if xi.funcs.merge == nil {
- continue
- }
- dx := (*dext)[num]
- var dv protoreflect.Value
- if dx.Type() == sx.Type() {
- dv = dx.Value()
- }
- if !dv.IsValid() && xi.unmarshalNeedsValue {
- dv = xt.New()
- }
- dv = xi.funcs.merge(dv, sx.Value(), opts)
- dx.Set(sx.Type(), dv)
- (*dext)[num] = dx
- }
- }
- if mi.unknownOffset.IsValid() {
- su := mi.getUnknownBytes(src)
- if su != nil && len(*su) > 0 {
- du := mi.mutableUnknownBytes(dst)
- *du = append(*du, *su...)
- }
- }
-}
-
-func mergeScalarValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- return src
-}
-
-func mergeBytesValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- return protoreflect.ValueOfBytes(append(emptyBuf[:], src.Bytes()...))
-}
-
-func mergeListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- dstl := dst.List()
- srcl := src.List()
- for i, llen := 0, srcl.Len(); i < llen; i++ {
- dstl.Append(srcl.Get(i))
- }
- return dst
-}
-
-func mergeBytesListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- dstl := dst.List()
- srcl := src.List()
- for i, llen := 0, srcl.Len(); i < llen; i++ {
- sb := srcl.Get(i).Bytes()
- db := append(emptyBuf[:], sb...)
- dstl.Append(protoreflect.ValueOfBytes(db))
- }
- return dst
-}
-
-func mergeMessageListValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- dstl := dst.List()
- srcl := src.List()
- for i, llen := 0, srcl.Len(); i < llen; i++ {
- sm := srcl.Get(i).Message()
- dm := proto.Clone(sm.Interface()).ProtoReflect()
- dstl.Append(protoreflect.ValueOfMessage(dm))
- }
- return dst
-}
-
-func mergeMessageValue(dst, src protoreflect.Value, opts mergeOptions) protoreflect.Value {
- opts.Merge(dst.Message().Interface(), src.Message().Interface())
- return dst
-}
-
-func mergeMessage(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- if f.mi != nil {
- if dst.Elem().IsNil() {
- dst.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))
- }
- f.mi.mergePointer(dst.Elem(), src.Elem(), opts)
- } else {
- dm := dst.AsValueOf(f.ft).Elem()
- sm := src.AsValueOf(f.ft).Elem()
- if dm.IsNil() {
- dm.Set(reflect.New(f.ft.Elem()))
- }
- opts.Merge(asMessage(dm), asMessage(sm))
- }
-}
-
-func mergeMessageSlice(dst, src pointer, f *coderFieldInfo, opts mergeOptions) {
- for _, sp := range src.PointerSlice() {
- dm := reflect.New(f.ft.Elem().Elem())
- if f.mi != nil {
- f.mi.mergePointer(pointerOfValue(dm), sp, opts)
- } else {
- opts.Merge(asMessage(dm), asMessage(sp.AsValueOf(f.ft.Elem().Elem())))
- }
- dst.AppendPointerSlice(pointerOfValue(dm))
- }
-}
-
-func mergeBytes(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Bytes() = append(emptyBuf[:], *src.Bytes()...)
-}
-
-func mergeBytesNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Bytes()
- if len(v) > 0 {
- *dst.Bytes() = append(emptyBuf[:], v...)
- }
-}
-
-func mergeBytesSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.BytesSlice()
- for _, v := range *src.BytesSlice() {
- *ds = append(*ds, append(emptyBuf[:], v...))
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go b/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go
deleted file mode 100644
index 8816c27..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package impl
-
-import ()
-
-func mergeBool(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Bool() = *src.Bool()
-}
-
-func mergeBoolNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Bool()
- if v != false {
- *dst.Bool() = v
- }
-}
-
-func mergeBoolPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.BoolPtr()
- if p != nil {
- v := *p
- *dst.BoolPtr() = &v
- }
-}
-
-func mergeBoolSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.BoolSlice()
- ss := src.BoolSlice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeInt32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Int32() = *src.Int32()
-}
-
-func mergeInt32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Int32()
- if v != 0 {
- *dst.Int32() = v
- }
-}
-
-func mergeInt32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Int32Ptr()
- if p != nil {
- v := *p
- *dst.Int32Ptr() = &v
- }
-}
-
-func mergeInt32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Int32Slice()
- ss := src.Int32Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeUint32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Uint32() = *src.Uint32()
-}
-
-func mergeUint32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Uint32()
- if v != 0 {
- *dst.Uint32() = v
- }
-}
-
-func mergeUint32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Uint32Ptr()
- if p != nil {
- v := *p
- *dst.Uint32Ptr() = &v
- }
-}
-
-func mergeUint32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Uint32Slice()
- ss := src.Uint32Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeInt64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Int64() = *src.Int64()
-}
-
-func mergeInt64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Int64()
- if v != 0 {
- *dst.Int64() = v
- }
-}
-
-func mergeInt64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Int64Ptr()
- if p != nil {
- v := *p
- *dst.Int64Ptr() = &v
- }
-}
-
-func mergeInt64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Int64Slice()
- ss := src.Int64Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeUint64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Uint64() = *src.Uint64()
-}
-
-func mergeUint64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Uint64()
- if v != 0 {
- *dst.Uint64() = v
- }
-}
-
-func mergeUint64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Uint64Ptr()
- if p != nil {
- v := *p
- *dst.Uint64Ptr() = &v
- }
-}
-
-func mergeUint64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Uint64Slice()
- ss := src.Uint64Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeFloat32(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Float32() = *src.Float32()
-}
-
-func mergeFloat32NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Float32()
- if v != 0 {
- *dst.Float32() = v
- }
-}
-
-func mergeFloat32Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Float32Ptr()
- if p != nil {
- v := *p
- *dst.Float32Ptr() = &v
- }
-}
-
-func mergeFloat32Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Float32Slice()
- ss := src.Float32Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeFloat64(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.Float64() = *src.Float64()
-}
-
-func mergeFloat64NoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.Float64()
- if v != 0 {
- *dst.Float64() = v
- }
-}
-
-func mergeFloat64Ptr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.Float64Ptr()
- if p != nil {
- v := *p
- *dst.Float64Ptr() = &v
- }
-}
-
-func mergeFloat64Slice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.Float64Slice()
- ss := src.Float64Slice()
- *ds = append(*ds, *ss...)
-}
-
-func mergeString(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- *dst.String() = *src.String()
-}
-
-func mergeStringNoZero(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- v := *src.String()
- if v != "" {
- *dst.String() = v
- }
-}
-
-func mergeStringPtr(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- p := *src.StringPtr()
- if p != nil {
- v := *p
- *dst.StringPtr() = &v
- }
-}
-
-func mergeStringSlice(dst, src pointer, _ *coderFieldInfo, _ mergeOptions) {
- ds := dst.StringSlice()
- ss := src.StringSlice()
- *ds = append(*ds, *ss...)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message.go b/vendor/google.golang.org/protobuf/internal/impl/message.go
deleted file mode 100644
index 629bacd..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/message.go
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "sync/atomic"
-
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// MessageInfo provides protobuf related functionality for a given Go type
-// that represents a message. A given instance of MessageInfo is tied to
-// exactly one Go type, which must be a pointer to a struct type.
-//
-// The exported fields must be populated before any methods are called
-// and cannot be mutated after set.
-type MessageInfo struct {
- // GoReflectType is the underlying message Go type and must be populated.
- GoReflectType reflect.Type // pointer to struct
-
- // Desc is the underlying message descriptor type and must be populated.
- Desc protoreflect.MessageDescriptor
-
- // Exporter must be provided in a purego environment in order to provide
- // access to unexported fields.
- Exporter exporter
-
- // OneofWrappers is list of pointers to oneof wrapper struct types.
- OneofWrappers []interface{}
-
- initMu sync.Mutex // protects all unexported fields
- initDone uint32
-
- reflectMessageInfo // for reflection implementation
- coderMessageInfo // for fast-path method implementations
-}
-
-// exporter is a function that returns a reference to the ith field of v,
-// where v is a pointer to a struct. It returns nil if it does not support
-// exporting the requested field (e.g., already exported).
-type exporter func(v interface{}, i int) interface{}
-
-// getMessageInfo returns the MessageInfo for any message type that
-// is generated by our implementation of protoc-gen-go (for v2 and on).
-// If it is unable to obtain a MessageInfo, it returns nil.
-func getMessageInfo(mt reflect.Type) *MessageInfo {
- m, ok := reflect.Zero(mt).Interface().(protoreflect.ProtoMessage)
- if !ok {
- return nil
- }
- mr, ok := m.ProtoReflect().(interface{ ProtoMessageInfo() *MessageInfo })
- if !ok {
- return nil
- }
- return mr.ProtoMessageInfo()
-}
-
-func (mi *MessageInfo) init() {
- // This function is called in the hot path. Inline the sync.Once logic,
- // since allocating a closure for Once.Do is expensive.
- // Keep init small to ensure that it can be inlined.
- if atomic.LoadUint32(&mi.initDone) == 0 {
- mi.initOnce()
- }
-}
-
-func (mi *MessageInfo) initOnce() {
- mi.initMu.Lock()
- defer mi.initMu.Unlock()
- if mi.initDone == 1 {
- return
- }
-
- t := mi.GoReflectType
- if t.Kind() != reflect.Ptr && t.Elem().Kind() != reflect.Struct {
- panic(fmt.Sprintf("got %v, want *struct kind", t))
- }
- t = t.Elem()
-
- si := mi.makeStructInfo(t)
- mi.makeReflectFuncs(t, si)
- mi.makeCoderMethods(t, si)
-
- atomic.StoreUint32(&mi.initDone, 1)
-}
-
-// getPointer returns the pointer for a message, which should be of
-// the type of the MessageInfo. If the message is of a different type,
-// it returns ok==false.
-func (mi *MessageInfo) getPointer(m protoreflect.Message) (p pointer, ok bool) {
- switch m := m.(type) {
- case *messageState:
- return m.pointer(), m.messageInfo() == mi
- case *messageReflectWrapper:
- return m.pointer(), m.messageInfo() == mi
- }
- return pointer{}, false
-}
-
-type (
- SizeCache = int32
- WeakFields = map[int32]protoreflect.ProtoMessage
- UnknownFields = unknownFieldsA // TODO: switch to unknownFieldsB
- unknownFieldsA = []byte
- unknownFieldsB = *[]byte
- ExtensionFields = map[int32]ExtensionField
-)
-
-var (
- sizecacheType = reflect.TypeOf(SizeCache(0))
- weakFieldsType = reflect.TypeOf(WeakFields(nil))
- unknownFieldsAType = reflect.TypeOf(unknownFieldsA(nil))
- unknownFieldsBType = reflect.TypeOf(unknownFieldsB(nil))
- extensionFieldsType = reflect.TypeOf(ExtensionFields(nil))
-)
-
-type structInfo struct {
- sizecacheOffset offset
- sizecacheType reflect.Type
- weakOffset offset
- weakType reflect.Type
- unknownOffset offset
- unknownType reflect.Type
- extensionOffset offset
- extensionType reflect.Type
-
- fieldsByNumber map[protoreflect.FieldNumber]reflect.StructField
- oneofsByName map[protoreflect.Name]reflect.StructField
- oneofWrappersByType map[reflect.Type]protoreflect.FieldNumber
- oneofWrappersByNumber map[protoreflect.FieldNumber]reflect.Type
-}
-
-func (mi *MessageInfo) makeStructInfo(t reflect.Type) structInfo {
- si := structInfo{
- sizecacheOffset: invalidOffset,
- weakOffset: invalidOffset,
- unknownOffset: invalidOffset,
- extensionOffset: invalidOffset,
-
- fieldsByNumber: map[protoreflect.FieldNumber]reflect.StructField{},
- oneofsByName: map[protoreflect.Name]reflect.StructField{},
- oneofWrappersByType: map[reflect.Type]protoreflect.FieldNumber{},
- oneofWrappersByNumber: map[protoreflect.FieldNumber]reflect.Type{},
- }
-
-fieldLoop:
- for i := 0; i < t.NumField(); i++ {
- switch f := t.Field(i); f.Name {
- case genid.SizeCache_goname, genid.SizeCacheA_goname:
- if f.Type == sizecacheType {
- si.sizecacheOffset = offsetOf(f, mi.Exporter)
- si.sizecacheType = f.Type
- }
- case genid.WeakFields_goname, genid.WeakFieldsA_goname:
- if f.Type == weakFieldsType {
- si.weakOffset = offsetOf(f, mi.Exporter)
- si.weakType = f.Type
- }
- case genid.UnknownFields_goname, genid.UnknownFieldsA_goname:
- if f.Type == unknownFieldsAType || f.Type == unknownFieldsBType {
- si.unknownOffset = offsetOf(f, mi.Exporter)
- si.unknownType = f.Type
- }
- case genid.ExtensionFields_goname, genid.ExtensionFieldsA_goname, genid.ExtensionFieldsB_goname:
- if f.Type == extensionFieldsType {
- si.extensionOffset = offsetOf(f, mi.Exporter)
- si.extensionType = f.Type
- }
- default:
- for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
- if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
- n, _ := strconv.ParseUint(s, 10, 64)
- si.fieldsByNumber[protoreflect.FieldNumber(n)] = f
- continue fieldLoop
- }
- }
- if s := f.Tag.Get("protobuf_oneof"); len(s) > 0 {
- si.oneofsByName[protoreflect.Name(s)] = f
- continue fieldLoop
- }
- }
- }
-
- // Derive a mapping of oneof wrappers to fields.
- oneofWrappers := mi.OneofWrappers
- methods := make([]reflect.Method, 0, 2)
- if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofFuncs"); ok {
- methods = append(methods, m)
- }
- if m, ok := reflect.PtrTo(t).MethodByName("XXX_OneofWrappers"); ok {
- methods = append(methods, m)
- }
- for _, fn := range methods {
- for _, v := range fn.Func.Call([]reflect.Value{reflect.Zero(fn.Type.In(0))}) {
- if vs, ok := v.Interface().([]interface{}); ok {
- oneofWrappers = vs
- }
- }
- }
- for _, v := range oneofWrappers {
- tf := reflect.TypeOf(v).Elem()
- f := tf.Field(0)
- for _, s := range strings.Split(f.Tag.Get("protobuf"), ",") {
- if len(s) > 0 && strings.Trim(s, "0123456789") == "" {
- n, _ := strconv.ParseUint(s, 10, 64)
- si.oneofWrappersByType[tf] = protoreflect.FieldNumber(n)
- si.oneofWrappersByNumber[protoreflect.FieldNumber(n)] = tf
- break
- }
- }
- }
-
- return si
-}
-
-func (mi *MessageInfo) New() protoreflect.Message {
- m := reflect.New(mi.GoReflectType.Elem()).Interface()
- if r, ok := m.(protoreflect.ProtoMessage); ok {
- return r.ProtoReflect()
- }
- return mi.MessageOf(m)
-}
-func (mi *MessageInfo) Zero() protoreflect.Message {
- return mi.MessageOf(reflect.Zero(mi.GoReflectType).Interface())
-}
-func (mi *MessageInfo) Descriptor() protoreflect.MessageDescriptor {
- return mi.Desc
-}
-func (mi *MessageInfo) Enum(i int) protoreflect.EnumType {
- mi.init()
- fd := mi.Desc.Fields().Get(i)
- return Export{}.EnumTypeOf(mi.fieldTypes[fd.Number()])
-}
-func (mi *MessageInfo) Message(i int) protoreflect.MessageType {
- mi.init()
- fd := mi.Desc.Fields().Get(i)
- switch {
- case fd.IsWeak():
- mt, _ := protoregistry.GlobalTypes.FindMessageByName(fd.Message().FullName())
- return mt
- case fd.IsMap():
- return mapEntryType{fd.Message(), mi.fieldTypes[fd.Number()]}
- default:
- return Export{}.MessageTypeOf(mi.fieldTypes[fd.Number()])
- }
-}
-
-type mapEntryType struct {
- desc protoreflect.MessageDescriptor
- valType interface{} // zero value of enum or message type
-}
-
-func (mt mapEntryType) New() protoreflect.Message {
- return nil
-}
-func (mt mapEntryType) Zero() protoreflect.Message {
- return nil
-}
-func (mt mapEntryType) Descriptor() protoreflect.MessageDescriptor {
- return mt.desc
-}
-func (mt mapEntryType) Enum(i int) protoreflect.EnumType {
- fd := mt.desc.Fields().Get(i)
- if fd.Enum() == nil {
- return nil
- }
- return Export{}.EnumTypeOf(mt.valType)
-}
-func (mt mapEntryType) Message(i int) protoreflect.MessageType {
- fd := mt.desc.Fields().Get(i)
- if fd.Message() == nil {
- return nil
- }
- return Export{}.MessageTypeOf(mt.valType)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
deleted file mode 100644
index d9ea010..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go
+++ /dev/null
@@ -1,463 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
- "reflect"
-
- "google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type reflectMessageInfo struct {
- fields map[protoreflect.FieldNumber]*fieldInfo
- oneofs map[protoreflect.Name]*oneofInfo
-
- // fieldTypes contains the zero value of an enum or message field.
- // For lists, it contains the element type.
- // For maps, it contains the entry value type.
- fieldTypes map[protoreflect.FieldNumber]interface{}
-
- // denseFields is a subset of fields where:
- // 0 < fieldDesc.Number() < len(denseFields)
- // It provides faster access to the fieldInfo, but may be incomplete.
- denseFields []*fieldInfo
-
- // rangeInfos is a list of all fields (not belonging to a oneof) and oneofs.
- rangeInfos []interface{} // either *fieldInfo or *oneofInfo
-
- getUnknown func(pointer) protoreflect.RawFields
- setUnknown func(pointer, protoreflect.RawFields)
- extensionMap func(pointer) *extensionMap
-
- nilMessage atomicNilMessage
-}
-
-// makeReflectFuncs generates the set of functions to support reflection.
-func (mi *MessageInfo) makeReflectFuncs(t reflect.Type, si structInfo) {
- mi.makeKnownFieldsFunc(si)
- mi.makeUnknownFieldsFunc(t, si)
- mi.makeExtensionFieldsFunc(t, si)
- mi.makeFieldTypes(si)
-}
-
-// makeKnownFieldsFunc generates functions for operations that can be performed
-// on each protobuf message field. It takes in a reflect.Type representing the
-// Go struct and matches message fields with struct fields.
-//
-// This code assumes that the struct is well-formed and panics if there are
-// any discrepancies.
-func (mi *MessageInfo) makeKnownFieldsFunc(si structInfo) {
- mi.fields = map[protoreflect.FieldNumber]*fieldInfo{}
- md := mi.Desc
- fds := md.Fields()
- for i := 0; i < fds.Len(); i++ {
- fd := fds.Get(i)
- fs := si.fieldsByNumber[fd.Number()]
- isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()
- if isOneof {
- fs = si.oneofsByName[fd.ContainingOneof().Name()]
- }
- var fi fieldInfo
- switch {
- case fs.Type == nil:
- fi = fieldInfoForMissing(fd) // never occurs for officially generated message types
- case isOneof:
- fi = fieldInfoForOneof(fd, fs, mi.Exporter, si.oneofWrappersByNumber[fd.Number()])
- case fd.IsMap():
- fi = fieldInfoForMap(fd, fs, mi.Exporter)
- case fd.IsList():
- fi = fieldInfoForList(fd, fs, mi.Exporter)
- case fd.IsWeak():
- fi = fieldInfoForWeakMessage(fd, si.weakOffset)
- case fd.Message() != nil:
- fi = fieldInfoForMessage(fd, fs, mi.Exporter)
- default:
- fi = fieldInfoForScalar(fd, fs, mi.Exporter)
- }
- mi.fields[fd.Number()] = &fi
- }
-
- mi.oneofs = map[protoreflect.Name]*oneofInfo{}
- for i := 0; i < md.Oneofs().Len(); i++ {
- od := md.Oneofs().Get(i)
- mi.oneofs[od.Name()] = makeOneofInfo(od, si, mi.Exporter)
- }
-
- mi.denseFields = make([]*fieldInfo, fds.Len()*2)
- for i := 0; i < fds.Len(); i++ {
- if fd := fds.Get(i); int(fd.Number()) < len(mi.denseFields) {
- mi.denseFields[fd.Number()] = mi.fields[fd.Number()]
- }
- }
-
- for i := 0; i < fds.Len(); {
- fd := fds.Get(i)
- if od := fd.ContainingOneof(); od != nil && !od.IsSynthetic() {
- mi.rangeInfos = append(mi.rangeInfos, mi.oneofs[od.Name()])
- i += od.Fields().Len()
- } else {
- mi.rangeInfos = append(mi.rangeInfos, mi.fields[fd.Number()])
- i++
- }
- }
-
- // Introduce instability to iteration order, but keep it deterministic.
- if len(mi.rangeInfos) > 1 && detrand.Bool() {
- i := detrand.Intn(len(mi.rangeInfos) - 1)
- mi.rangeInfos[i], mi.rangeInfos[i+1] = mi.rangeInfos[i+1], mi.rangeInfos[i]
- }
-}
-
-func (mi *MessageInfo) makeUnknownFieldsFunc(t reflect.Type, si structInfo) {
- switch {
- case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsAType:
- // Handle as []byte.
- mi.getUnknown = func(p pointer) protoreflect.RawFields {
- if p.IsNil() {
- return nil
- }
- return *p.Apply(mi.unknownOffset).Bytes()
- }
- mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
- if p.IsNil() {
- panic("invalid SetUnknown on nil Message")
- }
- *p.Apply(mi.unknownOffset).Bytes() = b
- }
- case si.unknownOffset.IsValid() && si.unknownType == unknownFieldsBType:
- // Handle as *[]byte.
- mi.getUnknown = func(p pointer) protoreflect.RawFields {
- if p.IsNil() {
- return nil
- }
- bp := p.Apply(mi.unknownOffset).BytesPtr()
- if *bp == nil {
- return nil
- }
- return **bp
- }
- mi.setUnknown = func(p pointer, b protoreflect.RawFields) {
- if p.IsNil() {
- panic("invalid SetUnknown on nil Message")
- }
- bp := p.Apply(mi.unknownOffset).BytesPtr()
- if *bp == nil {
- *bp = new([]byte)
- }
- **bp = b
- }
- default:
- mi.getUnknown = func(pointer) protoreflect.RawFields {
- return nil
- }
- mi.setUnknown = func(p pointer, _ protoreflect.RawFields) {
- if p.IsNil() {
- panic("invalid SetUnknown on nil Message")
- }
- }
- }
-}
-
-func (mi *MessageInfo) makeExtensionFieldsFunc(t reflect.Type, si structInfo) {
- if si.extensionOffset.IsValid() {
- mi.extensionMap = func(p pointer) *extensionMap {
- if p.IsNil() {
- return (*extensionMap)(nil)
- }
- v := p.Apply(si.extensionOffset).AsValueOf(extensionFieldsType)
- return (*extensionMap)(v.Interface().(*map[int32]ExtensionField))
- }
- } else {
- mi.extensionMap = func(pointer) *extensionMap {
- return (*extensionMap)(nil)
- }
- }
-}
-func (mi *MessageInfo) makeFieldTypes(si structInfo) {
- md := mi.Desc
- fds := md.Fields()
- for i := 0; i < fds.Len(); i++ {
- var ft reflect.Type
- fd := fds.Get(i)
- fs := si.fieldsByNumber[fd.Number()]
- isOneof := fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic()
- if isOneof {
- fs = si.oneofsByName[fd.ContainingOneof().Name()]
- }
- var isMessage bool
- switch {
- case fs.Type == nil:
- continue // never occurs for officially generated message types
- case isOneof:
- if fd.Enum() != nil || fd.Message() != nil {
- ft = si.oneofWrappersByNumber[fd.Number()].Field(0).Type
- }
- case fd.IsMap():
- if fd.MapValue().Enum() != nil || fd.MapValue().Message() != nil {
- ft = fs.Type.Elem()
- }
- isMessage = fd.MapValue().Message() != nil
- case fd.IsList():
- if fd.Enum() != nil || fd.Message() != nil {
- ft = fs.Type.Elem()
- }
- isMessage = fd.Message() != nil
- case fd.Enum() != nil:
- ft = fs.Type
- if fd.HasPresence() && ft.Kind() == reflect.Ptr {
- ft = ft.Elem()
- }
- case fd.Message() != nil:
- ft = fs.Type
- if fd.IsWeak() {
- ft = nil
- }
- isMessage = true
- }
- if isMessage && ft != nil && ft.Kind() != reflect.Ptr {
- ft = reflect.PtrTo(ft) // never occurs for officially generated message types
- }
- if ft != nil {
- if mi.fieldTypes == nil {
- mi.fieldTypes = make(map[protoreflect.FieldNumber]interface{})
- }
- mi.fieldTypes[fd.Number()] = reflect.Zero(ft).Interface()
- }
- }
-}
-
-type extensionMap map[int32]ExtensionField
-
-func (m *extensionMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- if m != nil {
- for _, x := range *m {
- xd := x.Type().TypeDescriptor()
- v := x.Value()
- if xd.IsList() && v.List().Len() == 0 {
- continue
- }
- if !f(xd, v) {
- return
- }
- }
- }
-}
-func (m *extensionMap) Has(xt protoreflect.ExtensionType) (ok bool) {
- if m == nil {
- return false
- }
- xd := xt.TypeDescriptor()
- x, ok := (*m)[int32(xd.Number())]
- if !ok {
- return false
- }
- switch {
- case xd.IsList():
- return x.Value().List().Len() > 0
- case xd.IsMap():
- return x.Value().Map().Len() > 0
- case xd.Message() != nil:
- return x.Value().Message().IsValid()
- }
- return true
-}
-func (m *extensionMap) Clear(xt protoreflect.ExtensionType) {
- delete(*m, int32(xt.TypeDescriptor().Number()))
-}
-func (m *extensionMap) Get(xt protoreflect.ExtensionType) protoreflect.Value {
- xd := xt.TypeDescriptor()
- if m != nil {
- if x, ok := (*m)[int32(xd.Number())]; ok {
- return x.Value()
- }
- }
- return xt.Zero()
-}
-func (m *extensionMap) Set(xt protoreflect.ExtensionType, v protoreflect.Value) {
- xd := xt.TypeDescriptor()
- isValid := true
- switch {
- case !xt.IsValidValue(v):
- isValid = false
- case xd.IsList():
- isValid = v.List().IsValid()
- case xd.IsMap():
- isValid = v.Map().IsValid()
- case xd.Message() != nil:
- isValid = v.Message().IsValid()
- }
- if !isValid {
- panic(fmt.Sprintf("%v: assigning invalid value", xt.TypeDescriptor().FullName()))
- }
-
- if *m == nil {
- *m = make(map[int32]ExtensionField)
- }
- var x ExtensionField
- x.Set(xt, v)
- (*m)[int32(xd.Number())] = x
-}
-func (m *extensionMap) Mutable(xt protoreflect.ExtensionType) protoreflect.Value {
- xd := xt.TypeDescriptor()
- if xd.Kind() != protoreflect.MessageKind && xd.Kind() != protoreflect.GroupKind && !xd.IsList() && !xd.IsMap() {
- panic("invalid Mutable on field with non-composite type")
- }
- if x, ok := (*m)[int32(xd.Number())]; ok {
- return x.Value()
- }
- v := xt.New()
- m.Set(xt, v)
- return v
-}
-
-// MessageState is a data structure that is nested as the first field in a
-// concrete message. It provides a way to implement the ProtoReflect method
-// in an allocation-free way without needing to have a shadow Go type generated
-// for every message type. This technique only works using unsafe.
-//
-// Example generated code:
-//
-// type M struct {
-// state protoimpl.MessageState
-//
-// Field1 int32
-// Field2 string
-// Field3 *BarMessage
-// ...
-// }
-//
-// func (m *M) ProtoReflect() protoreflect.Message {
-// mi := &file_fizz_buzz_proto_msgInfos[5]
-// if protoimpl.UnsafeEnabled && m != nil {
-// ms := protoimpl.X.MessageStateOf(Pointer(m))
-// if ms.LoadMessageInfo() == nil {
-// ms.StoreMessageInfo(mi)
-// }
-// return ms
-// }
-// return mi.MessageOf(m)
-// }
-//
-// The MessageState type holds a *MessageInfo, which must be atomically set to
-// the message info associated with a given message instance.
-// By unsafely converting a *M into a *MessageState, the MessageState object
-// has access to all the information needed to implement protobuf reflection.
-// It has access to the message info as its first field, and a pointer to the
-// MessageState is identical to a pointer to the concrete message value.
-//
-// Requirements:
-// - The type M must implement protoreflect.ProtoMessage.
-// - The address of m must not be nil.
-// - The address of m and the address of m.state must be equal,
-// even though they are different Go types.
-type MessageState struct {
- pragma.NoUnkeyedLiterals
- pragma.DoNotCompare
- pragma.DoNotCopy
-
- atomicMessageInfo *MessageInfo
-}
-
-type messageState MessageState
-
-var (
- _ protoreflect.Message = (*messageState)(nil)
- _ unwrapper = (*messageState)(nil)
-)
-
-// messageDataType is a tuple of a pointer to the message data and
-// a pointer to the message type. It is a generalized way of providing a
-// reflective view over a message instance. The disadvantage of this approach
-// is the need to allocate this tuple of 16B.
-type messageDataType struct {
- p pointer
- mi *MessageInfo
-}
-
-type (
- messageReflectWrapper messageDataType
- messageIfaceWrapper messageDataType
-)
-
-var (
- _ protoreflect.Message = (*messageReflectWrapper)(nil)
- _ unwrapper = (*messageReflectWrapper)(nil)
- _ protoreflect.ProtoMessage = (*messageIfaceWrapper)(nil)
- _ unwrapper = (*messageIfaceWrapper)(nil)
-)
-
-// MessageOf returns a reflective view over a message. The input must be a
-// pointer to a named Go struct. If the provided type has a ProtoReflect method,
-// it must be implemented by calling this method.
-func (mi *MessageInfo) MessageOf(m interface{}) protoreflect.Message {
- if reflect.TypeOf(m) != mi.GoReflectType {
- panic(fmt.Sprintf("type mismatch: got %T, want %v", m, mi.GoReflectType))
- }
- p := pointerOfIface(m)
- if p.IsNil() {
- return mi.nilMessage.Init(mi)
- }
- return &messageReflectWrapper{p, mi}
-}
-
-func (m *messageReflectWrapper) pointer() pointer { return m.p }
-func (m *messageReflectWrapper) messageInfo() *MessageInfo { return m.mi }
-
-// Reset implements the v1 proto.Message.Reset method.
-func (m *messageIfaceWrapper) Reset() {
- if mr, ok := m.protoUnwrap().(interface{ Reset() }); ok {
- mr.Reset()
- return
- }
- rv := reflect.ValueOf(m.protoUnwrap())
- if rv.Kind() == reflect.Ptr && !rv.IsNil() {
- rv.Elem().Set(reflect.Zero(rv.Type().Elem()))
- }
-}
-func (m *messageIfaceWrapper) ProtoReflect() protoreflect.Message {
- return (*messageReflectWrapper)(m)
-}
-func (m *messageIfaceWrapper) protoUnwrap() interface{} {
- return m.p.AsIfaceOf(m.mi.GoReflectType.Elem())
-}
-
-// checkField verifies that the provided field descriptor is valid.
-// Exactly one of the returned values is populated.
-func (mi *MessageInfo) checkField(fd protoreflect.FieldDescriptor) (*fieldInfo, protoreflect.ExtensionType) {
- var fi *fieldInfo
- if n := fd.Number(); 0 < n && int(n) < len(mi.denseFields) {
- fi = mi.denseFields[n]
- } else {
- fi = mi.fields[n]
- }
- if fi != nil {
- if fi.fieldDesc != fd {
- if got, want := fd.FullName(), fi.fieldDesc.FullName(); got != want {
- panic(fmt.Sprintf("mismatching field: got %v, want %v", got, want))
- }
- panic(fmt.Sprintf("mismatching field: %v", fd.FullName()))
- }
- return fi, nil
- }
-
- if fd.IsExtension() {
- if got, want := fd.ContainingMessage().FullName(), mi.Desc.FullName(); got != want {
- // TODO: Should this be exact containing message descriptor match?
- panic(fmt.Sprintf("extension %v has mismatching containing message: got %v, want %v", fd.FullName(), got, want))
- }
- if !mi.Desc.ExtensionRanges().Has(fd.Number()) {
- panic(fmt.Sprintf("extension %v extends %v outside the extension range", fd.FullName(), mi.Desc.FullName()))
- }
- xtd, ok := fd.(protoreflect.ExtensionTypeDescriptor)
- if !ok {
- panic(fmt.Sprintf("extension %v does not implement protoreflect.ExtensionTypeDescriptor", fd.FullName()))
- }
- return nil, xtd.Type()
- }
- panic(fmt.Sprintf("field %v is invalid", fd.FullName()))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
deleted file mode 100644
index 5e736c6..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go
+++ /dev/null
@@ -1,543 +0,0 @@
-// Copyright 2018 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.
-
-package impl
-
-import (
- "fmt"
- "math"
- "reflect"
- "sync"
-
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-type fieldInfo struct {
- fieldDesc protoreflect.FieldDescriptor
-
- // These fields are used for protobuf reflection support.
- has func(pointer) bool
- clear func(pointer)
- get func(pointer) protoreflect.Value
- set func(pointer, protoreflect.Value)
- mutable func(pointer) protoreflect.Value
- newMessage func() protoreflect.Message
- newField func() protoreflect.Value
-}
-
-func fieldInfoForMissing(fd protoreflect.FieldDescriptor) fieldInfo {
- // This never occurs for generated message types.
- // It implies that a hand-crafted type has missing Go fields
- // for specific protobuf message fields.
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- return false
- },
- clear: func(p pointer) {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- get: func(p pointer) protoreflect.Value {
- return fd.Default()
- },
- set: func(p pointer, v protoreflect.Value) {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- mutable: func(p pointer) protoreflect.Value {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- newMessage: func() protoreflect.Message {
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- newField: func() protoreflect.Value {
- if v := fd.Default(); v.IsValid() {
- return v
- }
- panic("missing Go struct field for " + string(fd.FullName()))
- },
- }
-}
-
-func fieldInfoForOneof(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter, ot reflect.Type) fieldInfo {
- ft := fs.Type
- if ft.Kind() != reflect.Interface {
- panic(fmt.Sprintf("field %v has invalid type: got %v, want interface kind", fd.FullName(), ft))
- }
- if ot.Kind() != reflect.Struct {
- panic(fmt.Sprintf("field %v has invalid type: got %v, want struct kind", fd.FullName(), ot))
- }
- if !reflect.PtrTo(ot).Implements(ft) {
- panic(fmt.Sprintf("field %v has invalid type: %v does not implement %v", fd.FullName(), ot, ft))
- }
- conv := NewConverter(ot.Field(0).Type, fd)
- isMessage := fd.Message() != nil
-
- // TODO: Implement unsafe fast path?
- fieldOffset := offsetOf(fs, x)
- return fieldInfo{
- // NOTE: The logic below intentionally assumes that oneof fields are
- // well-formatted. That is, the oneof interface never contains a
- // typed nil pointer to one of the wrapper structs.
-
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
- return false
- }
- return true
- },
- clear: func(p pointer) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() || rv.Elem().Type().Elem() != ot {
- // NOTE: We intentionally don't check for rv.Elem().IsNil()
- // so that (*OneofWrapperType)(nil) gets cleared to nil.
- return
- }
- rv.Set(reflect.Zero(rv.Type()))
- },
- get: func(p pointer) protoreflect.Value {
- if p.IsNil() {
- return conv.Zero()
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
- return conv.Zero()
- }
- rv = rv.Elem().Elem().Field(0)
- return conv.PBValueOf(rv)
- },
- set: func(p pointer, v protoreflect.Value) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
- rv.Set(reflect.New(ot))
- }
- rv = rv.Elem().Elem().Field(0)
- rv.Set(conv.GoValueOf(v))
- },
- mutable: func(p pointer) protoreflect.Value {
- if !isMessage {
- panic(fmt.Sprintf("field %v with invalid Mutable call on field with non-composite type", fd.FullName()))
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() || rv.Elem().Type().Elem() != ot || rv.Elem().IsNil() {
- rv.Set(reflect.New(ot))
- }
- rv = rv.Elem().Elem().Field(0)
- if rv.Kind() == reflect.Ptr && rv.IsNil() {
- rv.Set(conv.GoValueOf(protoreflect.ValueOfMessage(conv.New().Message())))
- }
- return conv.PBValueOf(rv)
- },
- newMessage: func() protoreflect.Message {
- return conv.New().Message()
- },
- newField: func() protoreflect.Value {
- return conv.New()
- },
- }
-}
-
-func fieldInfoForMap(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
- ft := fs.Type
- if ft.Kind() != reflect.Map {
- panic(fmt.Sprintf("field %v has invalid type: got %v, want map kind", fd.FullName(), ft))
- }
- conv := NewConverter(ft, fd)
-
- // TODO: Implement unsafe fast path?
- fieldOffset := offsetOf(fs, x)
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- return rv.Len() > 0
- },
- clear: func(p pointer) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- rv.Set(reflect.Zero(rv.Type()))
- },
- get: func(p pointer) protoreflect.Value {
- if p.IsNil() {
- return conv.Zero()
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.Len() == 0 {
- return conv.Zero()
- }
- return conv.PBValueOf(rv)
- },
- set: func(p pointer, v protoreflect.Value) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- pv := conv.GoValueOf(v)
- if pv.IsNil() {
- panic(fmt.Sprintf("map field %v cannot be set with read-only value", fd.FullName()))
- }
- rv.Set(pv)
- },
- mutable: func(p pointer) protoreflect.Value {
- v := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if v.IsNil() {
- v.Set(reflect.MakeMap(fs.Type))
- }
- return conv.PBValueOf(v)
- },
- newField: func() protoreflect.Value {
- return conv.New()
- },
- }
-}
-
-func fieldInfoForList(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
- ft := fs.Type
- if ft.Kind() != reflect.Slice {
- panic(fmt.Sprintf("field %v has invalid type: got %v, want slice kind", fd.FullName(), ft))
- }
- conv := NewConverter(reflect.PtrTo(ft), fd)
-
- // TODO: Implement unsafe fast path?
- fieldOffset := offsetOf(fs, x)
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- return rv.Len() > 0
- },
- clear: func(p pointer) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- rv.Set(reflect.Zero(rv.Type()))
- },
- get: func(p pointer) protoreflect.Value {
- if p.IsNil() {
- return conv.Zero()
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type)
- if rv.Elem().Len() == 0 {
- return conv.Zero()
- }
- return conv.PBValueOf(rv)
- },
- set: func(p pointer, v protoreflect.Value) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- pv := conv.GoValueOf(v)
- if pv.IsNil() {
- panic(fmt.Sprintf("list field %v cannot be set with read-only value", fd.FullName()))
- }
- rv.Set(pv.Elem())
- },
- mutable: func(p pointer) protoreflect.Value {
- v := p.Apply(fieldOffset).AsValueOf(fs.Type)
- return conv.PBValueOf(v)
- },
- newField: func() protoreflect.Value {
- return conv.New()
- },
- }
-}
-
-var (
- nilBytes = reflect.ValueOf([]byte(nil))
- emptyBytes = reflect.ValueOf([]byte{})
-)
-
-func fieldInfoForScalar(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
- ft := fs.Type
- nullable := fd.HasPresence()
- isBytes := ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Uint8
- if nullable {
- if ft.Kind() != reflect.Ptr && ft.Kind() != reflect.Slice {
- // This never occurs for generated message types.
- // Despite the protobuf type system specifying presence,
- // the Go field type cannot represent it.
- nullable = false
- }
- if ft.Kind() == reflect.Ptr {
- ft = ft.Elem()
- }
- }
- conv := NewConverter(ft, fd)
-
- // TODO: Implement unsafe fast path?
- fieldOffset := offsetOf(fs, x)
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if nullable {
- return !rv.IsNil()
- }
- switch rv.Kind() {
- case reflect.Bool:
- return rv.Bool()
- case reflect.Int32, reflect.Int64:
- return rv.Int() != 0
- case reflect.Uint32, reflect.Uint64:
- return rv.Uint() != 0
- case reflect.Float32, reflect.Float64:
- return rv.Float() != 0 || math.Signbit(rv.Float())
- case reflect.String, reflect.Slice:
- return rv.Len() > 0
- default:
- panic(fmt.Sprintf("field %v has invalid type: %v", fd.FullName(), rv.Type())) // should never happen
- }
- },
- clear: func(p pointer) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- rv.Set(reflect.Zero(rv.Type()))
- },
- get: func(p pointer) protoreflect.Value {
- if p.IsNil() {
- return conv.Zero()
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if nullable {
- if rv.IsNil() {
- return conv.Zero()
- }
- if rv.Kind() == reflect.Ptr {
- rv = rv.Elem()
- }
- }
- return conv.PBValueOf(rv)
- },
- set: func(p pointer, v protoreflect.Value) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if nullable && rv.Kind() == reflect.Ptr {
- if rv.IsNil() {
- rv.Set(reflect.New(ft))
- }
- rv = rv.Elem()
- }
- rv.Set(conv.GoValueOf(v))
- if isBytes && rv.Len() == 0 {
- if nullable {
- rv.Set(emptyBytes) // preserve presence
- } else {
- rv.Set(nilBytes) // do not preserve presence
- }
- }
- },
- newField: func() protoreflect.Value {
- return conv.New()
- },
- }
-}
-
-func fieldInfoForWeakMessage(fd protoreflect.FieldDescriptor, weakOffset offset) fieldInfo {
- if !flags.ProtoLegacy {
- panic("no support for proto1 weak fields")
- }
-
- var once sync.Once
- var messageType protoreflect.MessageType
- lazyInit := func() {
- once.Do(func() {
- messageName := fd.Message().FullName()
- messageType, _ = protoregistry.GlobalTypes.FindMessageByName(messageName)
- if messageType == nil {
- panic(fmt.Sprintf("weak message %v for field %v is not linked in", messageName, fd.FullName()))
- }
- })
- }
-
- num := fd.Number()
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- _, ok := p.Apply(weakOffset).WeakFields().get(num)
- return ok
- },
- clear: func(p pointer) {
- p.Apply(weakOffset).WeakFields().clear(num)
- },
- get: func(p pointer) protoreflect.Value {
- lazyInit()
- if p.IsNil() {
- return protoreflect.ValueOfMessage(messageType.Zero())
- }
- m, ok := p.Apply(weakOffset).WeakFields().get(num)
- if !ok {
- return protoreflect.ValueOfMessage(messageType.Zero())
- }
- return protoreflect.ValueOfMessage(m.ProtoReflect())
- },
- set: func(p pointer, v protoreflect.Value) {
- lazyInit()
- m := v.Message()
- if m.Descriptor() != messageType.Descriptor() {
- if got, want := m.Descriptor().FullName(), messageType.Descriptor().FullName(); got != want {
- panic(fmt.Sprintf("field %v has mismatching message descriptor: got %v, want %v", fd.FullName(), got, want))
- }
- panic(fmt.Sprintf("field %v has mismatching message descriptor: %v", fd.FullName(), m.Descriptor().FullName()))
- }
- p.Apply(weakOffset).WeakFields().set(num, m.Interface())
- },
- mutable: func(p pointer) protoreflect.Value {
- lazyInit()
- fs := p.Apply(weakOffset).WeakFields()
- m, ok := fs.get(num)
- if !ok {
- m = messageType.New().Interface()
- fs.set(num, m)
- }
- return protoreflect.ValueOfMessage(m.ProtoReflect())
- },
- newMessage: func() protoreflect.Message {
- lazyInit()
- return messageType.New()
- },
- newField: func() protoreflect.Value {
- lazyInit()
- return protoreflect.ValueOfMessage(messageType.New())
- },
- }
-}
-
-func fieldInfoForMessage(fd protoreflect.FieldDescriptor, fs reflect.StructField, x exporter) fieldInfo {
- ft := fs.Type
- conv := NewConverter(ft, fd)
-
- // TODO: Implement unsafe fast path?
- fieldOffset := offsetOf(fs, x)
- return fieldInfo{
- fieldDesc: fd,
- has: func(p pointer) bool {
- if p.IsNil() {
- return false
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if fs.Type.Kind() != reflect.Ptr {
- return !isZero(rv)
- }
- return !rv.IsNil()
- },
- clear: func(p pointer) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- rv.Set(reflect.Zero(rv.Type()))
- },
- get: func(p pointer) protoreflect.Value {
- if p.IsNil() {
- return conv.Zero()
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- return conv.PBValueOf(rv)
- },
- set: func(p pointer, v protoreflect.Value) {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- rv.Set(conv.GoValueOf(v))
- if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
- panic(fmt.Sprintf("field %v has invalid nil pointer", fd.FullName()))
- }
- },
- mutable: func(p pointer) protoreflect.Value {
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if fs.Type.Kind() == reflect.Ptr && rv.IsNil() {
- rv.Set(conv.GoValueOf(conv.New()))
- }
- return conv.PBValueOf(rv)
- },
- newMessage: func() protoreflect.Message {
- return conv.New().Message()
- },
- newField: func() protoreflect.Value {
- return conv.New()
- },
- }
-}
-
-type oneofInfo struct {
- oneofDesc protoreflect.OneofDescriptor
- which func(pointer) protoreflect.FieldNumber
-}
-
-func makeOneofInfo(od protoreflect.OneofDescriptor, si structInfo, x exporter) *oneofInfo {
- oi := &oneofInfo{oneofDesc: od}
- if od.IsSynthetic() {
- fs := si.fieldsByNumber[od.Fields().Get(0).Number()]
- fieldOffset := offsetOf(fs, x)
- oi.which = func(p pointer) protoreflect.FieldNumber {
- if p.IsNil() {
- return 0
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() { // valid on either *T or []byte
- return 0
- }
- return od.Fields().Get(0).Number()
- }
- } else {
- fs := si.oneofsByName[od.Name()]
- fieldOffset := offsetOf(fs, x)
- oi.which = func(p pointer) protoreflect.FieldNumber {
- if p.IsNil() {
- return 0
- }
- rv := p.Apply(fieldOffset).AsValueOf(fs.Type).Elem()
- if rv.IsNil() {
- return 0
- }
- rv = rv.Elem()
- if rv.IsNil() {
- return 0
- }
- return si.oneofWrappersByType[rv.Type().Elem()]
- }
- }
- return oi
-}
-
-// isZero is identical to reflect.Value.IsZero.
-// TODO: Remove this when Go1.13 is the minimally supported Go version.
-func isZero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return math.Float64bits(v.Float()) == 0
- case reflect.Complex64, reflect.Complex128:
- c := v.Complex()
- return math.Float64bits(real(c)) == 0 && math.Float64bits(imag(c)) == 0
- case reflect.Array:
- for i := 0; i < v.Len(); i++ {
- if !isZero(v.Index(i)) {
- return false
- }
- }
- return true
- case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
- return v.IsNil()
- case reflect.String:
- return v.Len() == 0
- case reflect.Struct:
- for i := 0; i < v.NumField(); i++ {
- if !isZero(v.Field(i)) {
- return false
- }
- }
- return true
- default:
- panic(&reflect.ValueError{"reflect.Value.IsZero", v.Kind()})
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go b/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
deleted file mode 100644
index 741d6e5..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package impl
-
-import (
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-func (m *messageState) Descriptor() protoreflect.MessageDescriptor {
- return m.messageInfo().Desc
-}
-func (m *messageState) Type() protoreflect.MessageType {
- return m.messageInfo()
-}
-func (m *messageState) New() protoreflect.Message {
- return m.messageInfo().New()
-}
-func (m *messageState) Interface() protoreflect.ProtoMessage {
- return m.protoUnwrap().(protoreflect.ProtoMessage)
-}
-func (m *messageState) protoUnwrap() interface{} {
- return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
-}
-func (m *messageState) ProtoMethods() *protoiface.Methods {
- m.messageInfo().init()
- return &m.messageInfo().methods
-}
-
-// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
-// to be able to retrieve a v2 MessageInfo struct.
-//
-// WARNING: This method is exempt from the compatibility promise and
-// may be removed in the future without warning.
-func (m *messageState) ProtoMessageInfo() *MessageInfo {
- return m.messageInfo()
-}
-
-func (m *messageState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- m.messageInfo().init()
- for _, ri := range m.messageInfo().rangeInfos {
- switch ri := ri.(type) {
- case *fieldInfo:
- if ri.has(m.pointer()) {
- if !f(ri.fieldDesc, ri.get(m.pointer())) {
- return
- }
- }
- case *oneofInfo:
- if n := ri.which(m.pointer()); n > 0 {
- fi := m.messageInfo().fields[n]
- if !f(fi.fieldDesc, fi.get(m.pointer())) {
- return
- }
- }
- }
- }
- m.messageInfo().extensionMap(m.pointer()).Range(f)
-}
-func (m *messageState) Has(fd protoreflect.FieldDescriptor) bool {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.has(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Has(xt)
- }
-}
-func (m *messageState) Clear(fd protoreflect.FieldDescriptor) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- fi.clear(m.pointer())
- } else {
- m.messageInfo().extensionMap(m.pointer()).Clear(xt)
- }
-}
-func (m *messageState) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.get(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Get(xt)
- }
-}
-func (m *messageState) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- fi.set(m.pointer(), v)
- } else {
- m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
- }
-}
-func (m *messageState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.mutable(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
- }
-}
-func (m *messageState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.newField()
- } else {
- return xt.New()
- }
-}
-func (m *messageState) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
- m.messageInfo().init()
- if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
- return od.Fields().ByNumber(oi.which(m.pointer()))
- }
- panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
-}
-func (m *messageState) GetUnknown() protoreflect.RawFields {
- m.messageInfo().init()
- return m.messageInfo().getUnknown(m.pointer())
-}
-func (m *messageState) SetUnknown(b protoreflect.RawFields) {
- m.messageInfo().init()
- m.messageInfo().setUnknown(m.pointer(), b)
-}
-func (m *messageState) IsValid() bool {
- return !m.pointer().IsNil()
-}
-
-func (m *messageReflectWrapper) Descriptor() protoreflect.MessageDescriptor {
- return m.messageInfo().Desc
-}
-func (m *messageReflectWrapper) Type() protoreflect.MessageType {
- return m.messageInfo()
-}
-func (m *messageReflectWrapper) New() protoreflect.Message {
- return m.messageInfo().New()
-}
-func (m *messageReflectWrapper) Interface() protoreflect.ProtoMessage {
- if m, ok := m.protoUnwrap().(protoreflect.ProtoMessage); ok {
- return m
- }
- return (*messageIfaceWrapper)(m)
-}
-func (m *messageReflectWrapper) protoUnwrap() interface{} {
- return m.pointer().AsIfaceOf(m.messageInfo().GoReflectType.Elem())
-}
-func (m *messageReflectWrapper) ProtoMethods() *protoiface.Methods {
- m.messageInfo().init()
- return &m.messageInfo().methods
-}
-
-// ProtoMessageInfo is a pseudo-internal API for allowing the v1 code
-// to be able to retrieve a v2 MessageInfo struct.
-//
-// WARNING: This method is exempt from the compatibility promise and
-// may be removed in the future without warning.
-func (m *messageReflectWrapper) ProtoMessageInfo() *MessageInfo {
- return m.messageInfo()
-}
-
-func (m *messageReflectWrapper) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
- m.messageInfo().init()
- for _, ri := range m.messageInfo().rangeInfos {
- switch ri := ri.(type) {
- case *fieldInfo:
- if ri.has(m.pointer()) {
- if !f(ri.fieldDesc, ri.get(m.pointer())) {
- return
- }
- }
- case *oneofInfo:
- if n := ri.which(m.pointer()); n > 0 {
- fi := m.messageInfo().fields[n]
- if !f(fi.fieldDesc, fi.get(m.pointer())) {
- return
- }
- }
- }
- }
- m.messageInfo().extensionMap(m.pointer()).Range(f)
-}
-func (m *messageReflectWrapper) Has(fd protoreflect.FieldDescriptor) bool {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.has(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Has(xt)
- }
-}
-func (m *messageReflectWrapper) Clear(fd protoreflect.FieldDescriptor) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- fi.clear(m.pointer())
- } else {
- m.messageInfo().extensionMap(m.pointer()).Clear(xt)
- }
-}
-func (m *messageReflectWrapper) Get(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.get(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Get(xt)
- }
-}
-func (m *messageReflectWrapper) Set(fd protoreflect.FieldDescriptor, v protoreflect.Value) {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- fi.set(m.pointer(), v)
- } else {
- m.messageInfo().extensionMap(m.pointer()).Set(xt, v)
- }
-}
-func (m *messageReflectWrapper) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.mutable(m.pointer())
- } else {
- return m.messageInfo().extensionMap(m.pointer()).Mutable(xt)
- }
-}
-func (m *messageReflectWrapper) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
- m.messageInfo().init()
- if fi, xt := m.messageInfo().checkField(fd); fi != nil {
- return fi.newField()
- } else {
- return xt.New()
- }
-}
-func (m *messageReflectWrapper) WhichOneof(od protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
- m.messageInfo().init()
- if oi := m.messageInfo().oneofs[od.Name()]; oi != nil && oi.oneofDesc == od {
- return od.Fields().ByNumber(oi.which(m.pointer()))
- }
- panic("invalid oneof descriptor " + string(od.FullName()) + " for message " + string(m.Descriptor().FullName()))
-}
-func (m *messageReflectWrapper) GetUnknown() protoreflect.RawFields {
- m.messageInfo().init()
- return m.messageInfo().getUnknown(m.pointer())
-}
-func (m *messageReflectWrapper) SetUnknown(b protoreflect.RawFields) {
- m.messageInfo().init()
- m.messageInfo().setUnknown(m.pointer(), b)
-}
-func (m *messageReflectWrapper) IsValid() bool {
- return !m.pointer().IsNil()
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
deleted file mode 100644
index 517e944..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2018 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.
-
-//go:build purego || appengine
-// +build purego appengine
-
-package impl
-
-import (
- "fmt"
- "reflect"
- "sync"
-)
-
-const UnsafeEnabled = false
-
-// Pointer is an opaque pointer type.
-type Pointer interface{}
-
-// offset represents the offset to a struct field, accessible from a pointer.
-// The offset is the field index into a struct.
-type offset struct {
- index int
- export exporter
-}
-
-// offsetOf returns a field offset for the struct field.
-func offsetOf(f reflect.StructField, x exporter) offset {
- if len(f.Index) != 1 {
- panic("embedded structs are not supported")
- }
- if f.PkgPath == "" {
- return offset{index: f.Index[0]} // field is already exported
- }
- if x == nil {
- panic("exporter must be provided for unexported field")
- }
- return offset{index: f.Index[0], export: x}
-}
-
-// IsValid reports whether the offset is valid.
-func (f offset) IsValid() bool { return f.index >= 0 }
-
-// invalidOffset is an invalid field offset.
-var invalidOffset = offset{index: -1}
-
-// zeroOffset is a noop when calling pointer.Apply.
-var zeroOffset = offset{index: 0}
-
-// pointer is an abstract representation of a pointer to a struct or field.
-type pointer struct{ v reflect.Value }
-
-// pointerOf returns p as a pointer.
-func pointerOf(p Pointer) pointer {
- return pointerOfIface(p)
-}
-
-// pointerOfValue returns v as a pointer.
-func pointerOfValue(v reflect.Value) pointer {
- return pointer{v: v}
-}
-
-// pointerOfIface returns the pointer portion of an interface.
-func pointerOfIface(v interface{}) pointer {
- return pointer{v: reflect.ValueOf(v)}
-}
-
-// IsNil reports whether the pointer is nil.
-func (p pointer) IsNil() bool {
- return p.v.IsNil()
-}
-
-// Apply adds an offset to the pointer to derive a new pointer
-// to a specified field. The current pointer must be pointing at a struct.
-func (p pointer) Apply(f offset) pointer {
- if f.export != nil {
- if v := reflect.ValueOf(f.export(p.v.Interface(), f.index)); v.IsValid() {
- return pointer{v: v}
- }
- }
- return pointer{v: p.v.Elem().Field(f.index).Addr()}
-}
-
-// AsValueOf treats p as a pointer to an object of type t and returns the value.
-// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))
-func (p pointer) AsValueOf(t reflect.Type) reflect.Value {
- if got := p.v.Type().Elem(); got != t {
- panic(fmt.Sprintf("invalid type: got %v, want %v", got, t))
- }
- return p.v
-}
-
-// AsIfaceOf treats p as a pointer to an object of type t and returns the value.
-// It is equivalent to p.AsValueOf(t).Interface()
-func (p pointer) AsIfaceOf(t reflect.Type) interface{} {
- return p.AsValueOf(t).Interface()
-}
-
-func (p pointer) Bool() *bool { return p.v.Interface().(*bool) }
-func (p pointer) BoolPtr() **bool { return p.v.Interface().(**bool) }
-func (p pointer) BoolSlice() *[]bool { return p.v.Interface().(*[]bool) }
-func (p pointer) Int32() *int32 { return p.v.Interface().(*int32) }
-func (p pointer) Int32Ptr() **int32 { return p.v.Interface().(**int32) }
-func (p pointer) Int32Slice() *[]int32 { return p.v.Interface().(*[]int32) }
-func (p pointer) Int64() *int64 { return p.v.Interface().(*int64) }
-func (p pointer) Int64Ptr() **int64 { return p.v.Interface().(**int64) }
-func (p pointer) Int64Slice() *[]int64 { return p.v.Interface().(*[]int64) }
-func (p pointer) Uint32() *uint32 { return p.v.Interface().(*uint32) }
-func (p pointer) Uint32Ptr() **uint32 { return p.v.Interface().(**uint32) }
-func (p pointer) Uint32Slice() *[]uint32 { return p.v.Interface().(*[]uint32) }
-func (p pointer) Uint64() *uint64 { return p.v.Interface().(*uint64) }
-func (p pointer) Uint64Ptr() **uint64 { return p.v.Interface().(**uint64) }
-func (p pointer) Uint64Slice() *[]uint64 { return p.v.Interface().(*[]uint64) }
-func (p pointer) Float32() *float32 { return p.v.Interface().(*float32) }
-func (p pointer) Float32Ptr() **float32 { return p.v.Interface().(**float32) }
-func (p pointer) Float32Slice() *[]float32 { return p.v.Interface().(*[]float32) }
-func (p pointer) Float64() *float64 { return p.v.Interface().(*float64) }
-func (p pointer) Float64Ptr() **float64 { return p.v.Interface().(**float64) }
-func (p pointer) Float64Slice() *[]float64 { return p.v.Interface().(*[]float64) }
-func (p pointer) String() *string { return p.v.Interface().(*string) }
-func (p pointer) StringPtr() **string { return p.v.Interface().(**string) }
-func (p pointer) StringSlice() *[]string { return p.v.Interface().(*[]string) }
-func (p pointer) Bytes() *[]byte { return p.v.Interface().(*[]byte) }
-func (p pointer) BytesPtr() **[]byte { return p.v.Interface().(**[]byte) }
-func (p pointer) BytesSlice() *[][]byte { return p.v.Interface().(*[][]byte) }
-func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.v.Interface().(*WeakFields)) }
-func (p pointer) Extensions() *map[int32]ExtensionField {
- return p.v.Interface().(*map[int32]ExtensionField)
-}
-
-func (p pointer) Elem() pointer {
- return pointer{v: p.v.Elem()}
-}
-
-// PointerSlice copies []*T from p as a new []pointer.
-// This behavior differs from the implementation in pointer_unsafe.go.
-func (p pointer) PointerSlice() []pointer {
- // TODO: reconsider this
- if p.v.IsNil() {
- return nil
- }
- n := p.v.Elem().Len()
- s := make([]pointer, n)
- for i := 0; i < n; i++ {
- s[i] = pointer{v: p.v.Elem().Index(i)}
- }
- return s
-}
-
-// AppendPointerSlice appends v to p, which must be a []*T.
-func (p pointer) AppendPointerSlice(v pointer) {
- sp := p.v.Elem()
- sp.Set(reflect.Append(sp, v.v))
-}
-
-// SetPointer sets *p to v.
-func (p pointer) SetPointer(v pointer) {
- p.v.Elem().Set(v.v)
-}
-
-func growSlice(p pointer, addCap int) {
- // TODO: Once we only support Go 1.20 and newer, use reflect.Grow.
- in := p.v.Elem()
- out := reflect.MakeSlice(in.Type(), in.Len(), in.Len()+addCap)
- reflect.Copy(out, in)
- p.v.Elem().Set(out)
-}
-
-func (p pointer) growBoolSlice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growInt32Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growUint32Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growInt64Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growUint64Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growFloat64Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (p pointer) growFloat32Slice(addCap int) {
- growSlice(p, addCap)
-}
-
-func (Export) MessageStateOf(p Pointer) *messageState { panic("not supported") }
-func (ms *messageState) pointer() pointer { panic("not supported") }
-func (ms *messageState) messageInfo() *MessageInfo { panic("not supported") }
-func (ms *messageState) LoadMessageInfo() *MessageInfo { panic("not supported") }
-func (ms *messageState) StoreMessageInfo(mi *MessageInfo) { panic("not supported") }
-
-type atomicNilMessage struct {
- once sync.Once
- m messageReflectWrapper
-}
-
-func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {
- m.once.Do(func() {
- m.m.p = pointerOfIface(reflect.Zero(mi.GoReflectType).Interface())
- m.m.mi = mi
- })
- return &m.m
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go b/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
deleted file mode 100644
index 4b020e3..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go
+++ /dev/null
@@ -1,215 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !purego && !appengine
-// +build !purego,!appengine
-
-package impl
-
-import (
- "reflect"
- "sync/atomic"
- "unsafe"
-)
-
-const UnsafeEnabled = true
-
-// Pointer is an opaque pointer type.
-type Pointer unsafe.Pointer
-
-// offset represents the offset to a struct field, accessible from a pointer.
-// The offset is the byte offset to the field from the start of the struct.
-type offset uintptr
-
-// offsetOf returns a field offset for the struct field.
-func offsetOf(f reflect.StructField, x exporter) offset {
- return offset(f.Offset)
-}
-
-// IsValid reports whether the offset is valid.
-func (f offset) IsValid() bool { return f != invalidOffset }
-
-// invalidOffset is an invalid field offset.
-var invalidOffset = ^offset(0)
-
-// zeroOffset is a noop when calling pointer.Apply.
-var zeroOffset = offset(0)
-
-// pointer is a pointer to a message struct or field.
-type pointer struct{ p unsafe.Pointer }
-
-// pointerOf returns p as a pointer.
-func pointerOf(p Pointer) pointer {
- return pointer{p: unsafe.Pointer(p)}
-}
-
-// pointerOfValue returns v as a pointer.
-func pointerOfValue(v reflect.Value) pointer {
- return pointer{p: unsafe.Pointer(v.Pointer())}
-}
-
-// pointerOfIface returns the pointer portion of an interface.
-func pointerOfIface(v interface{}) pointer {
- type ifaceHeader struct {
- Type unsafe.Pointer
- Data unsafe.Pointer
- }
- return pointer{p: (*ifaceHeader)(unsafe.Pointer(&v)).Data}
-}
-
-// IsNil reports whether the pointer is nil.
-func (p pointer) IsNil() bool {
- return p.p == nil
-}
-
-// Apply adds an offset to the pointer to derive a new pointer
-// to a specified field. The pointer must be valid and pointing at a struct.
-func (p pointer) Apply(f offset) pointer {
- if p.IsNil() {
- panic("invalid nil pointer")
- }
- return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))}
-}
-
-// AsValueOf treats p as a pointer to an object of type t and returns the value.
-// It is equivalent to reflect.ValueOf(p.AsIfaceOf(t))
-func (p pointer) AsValueOf(t reflect.Type) reflect.Value {
- return reflect.NewAt(t, p.p)
-}
-
-// AsIfaceOf treats p as a pointer to an object of type t and returns the value.
-// It is equivalent to p.AsValueOf(t).Interface()
-func (p pointer) AsIfaceOf(t reflect.Type) interface{} {
- // TODO: Use tricky unsafe magic to directly create ifaceHeader.
- return p.AsValueOf(t).Interface()
-}
-
-func (p pointer) Bool() *bool { return (*bool)(p.p) }
-func (p pointer) BoolPtr() **bool { return (**bool)(p.p) }
-func (p pointer) BoolSlice() *[]bool { return (*[]bool)(p.p) }
-func (p pointer) Int32() *int32 { return (*int32)(p.p) }
-func (p pointer) Int32Ptr() **int32 { return (**int32)(p.p) }
-func (p pointer) Int32Slice() *[]int32 { return (*[]int32)(p.p) }
-func (p pointer) Int64() *int64 { return (*int64)(p.p) }
-func (p pointer) Int64Ptr() **int64 { return (**int64)(p.p) }
-func (p pointer) Int64Slice() *[]int64 { return (*[]int64)(p.p) }
-func (p pointer) Uint32() *uint32 { return (*uint32)(p.p) }
-func (p pointer) Uint32Ptr() **uint32 { return (**uint32)(p.p) }
-func (p pointer) Uint32Slice() *[]uint32 { return (*[]uint32)(p.p) }
-func (p pointer) Uint64() *uint64 { return (*uint64)(p.p) }
-func (p pointer) Uint64Ptr() **uint64 { return (**uint64)(p.p) }
-func (p pointer) Uint64Slice() *[]uint64 { return (*[]uint64)(p.p) }
-func (p pointer) Float32() *float32 { return (*float32)(p.p) }
-func (p pointer) Float32Ptr() **float32 { return (**float32)(p.p) }
-func (p pointer) Float32Slice() *[]float32 { return (*[]float32)(p.p) }
-func (p pointer) Float64() *float64 { return (*float64)(p.p) }
-func (p pointer) Float64Ptr() **float64 { return (**float64)(p.p) }
-func (p pointer) Float64Slice() *[]float64 { return (*[]float64)(p.p) }
-func (p pointer) String() *string { return (*string)(p.p) }
-func (p pointer) StringPtr() **string { return (**string)(p.p) }
-func (p pointer) StringSlice() *[]string { return (*[]string)(p.p) }
-func (p pointer) Bytes() *[]byte { return (*[]byte)(p.p) }
-func (p pointer) BytesPtr() **[]byte { return (**[]byte)(p.p) }
-func (p pointer) BytesSlice() *[][]byte { return (*[][]byte)(p.p) }
-func (p pointer) WeakFields() *weakFields { return (*weakFields)(p.p) }
-func (p pointer) Extensions() *map[int32]ExtensionField { return (*map[int32]ExtensionField)(p.p) }
-
-func (p pointer) Elem() pointer {
- return pointer{p: *(*unsafe.Pointer)(p.p)}
-}
-
-// PointerSlice loads []*T from p as a []pointer.
-// The value returned is aliased with the original slice.
-// This behavior differs from the implementation in pointer_reflect.go.
-func (p pointer) PointerSlice() []pointer {
- // Super-tricky - p should point to a []*T where T is a
- // message type. We load it as []pointer.
- return *(*[]pointer)(p.p)
-}
-
-// AppendPointerSlice appends v to p, which must be a []*T.
-func (p pointer) AppendPointerSlice(v pointer) {
- *(*[]pointer)(p.p) = append(*(*[]pointer)(p.p), v)
-}
-
-// SetPointer sets *p to v.
-func (p pointer) SetPointer(v pointer) {
- *(*unsafe.Pointer)(p.p) = (unsafe.Pointer)(v.p)
-}
-
-func (p pointer) growBoolSlice(addCap int) {
- sp := p.BoolSlice()
- s := make([]bool, 0, addCap+len(*sp))
- s = s[:len(*sp)]
- copy(s, *sp)
- *sp = s
-}
-
-func (p pointer) growInt32Slice(addCap int) {
- sp := p.Int32Slice()
- s := make([]int32, 0, addCap+len(*sp))
- s = s[:len(*sp)]
- copy(s, *sp)
- *sp = s
-}
-
-func (p pointer) growUint32Slice(addCap int) {
- p.growInt32Slice(addCap)
-}
-
-func (p pointer) growFloat32Slice(addCap int) {
- p.growInt32Slice(addCap)
-}
-
-func (p pointer) growInt64Slice(addCap int) {
- sp := p.Int64Slice()
- s := make([]int64, 0, addCap+len(*sp))
- s = s[:len(*sp)]
- copy(s, *sp)
- *sp = s
-}
-
-func (p pointer) growUint64Slice(addCap int) {
- p.growInt64Slice(addCap)
-}
-
-func (p pointer) growFloat64Slice(addCap int) {
- p.growInt64Slice(addCap)
-}
-
-// Static check that MessageState does not exceed the size of a pointer.
-const _ = uint(unsafe.Sizeof(unsafe.Pointer(nil)) - unsafe.Sizeof(MessageState{}))
-
-func (Export) MessageStateOf(p Pointer) *messageState {
- // Super-tricky - see documentation on MessageState.
- return (*messageState)(unsafe.Pointer(p))
-}
-func (ms *messageState) pointer() pointer {
- // Super-tricky - see documentation on MessageState.
- return pointer{p: unsafe.Pointer(ms)}
-}
-func (ms *messageState) messageInfo() *MessageInfo {
- mi := ms.LoadMessageInfo()
- if mi == nil {
- panic("invalid nil message info; this suggests memory corruption due to a race or shallow copy on the message struct")
- }
- return mi
-}
-func (ms *messageState) LoadMessageInfo() *MessageInfo {
- return (*MessageInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo))))
-}
-func (ms *messageState) StoreMessageInfo(mi *MessageInfo) {
- atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&ms.atomicMessageInfo)), unsafe.Pointer(mi))
-}
-
-type atomicNilMessage struct{ p unsafe.Pointer } // p is a *messageReflectWrapper
-
-func (m *atomicNilMessage) Init(mi *MessageInfo) *messageReflectWrapper {
- if p := atomic.LoadPointer(&m.p); p != nil {
- return (*messageReflectWrapper)(p)
- }
- w := &messageReflectWrapper{mi: mi}
- atomic.CompareAndSwapPointer(&m.p, nil, (unsafe.Pointer)(w))
- return (*messageReflectWrapper)(atomic.LoadPointer(&m.p))
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/validate.go b/vendor/google.golang.org/protobuf/internal/impl/validate.go
deleted file mode 100644
index a24e6bb..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/validate.go
+++ /dev/null
@@ -1,576 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
- "math"
- "math/bits"
- "reflect"
- "unicode/utf8"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// ValidationStatus is the result of validating the wire-format encoding of a message.
-type ValidationStatus int
-
-const (
- // ValidationUnknown indicates that unmarshaling the message might succeed or fail.
- // The validator was unable to render a judgement.
- //
- // The only causes of this status are an aberrant message type appearing somewhere
- // in the message or a failure in the extension resolver.
- ValidationUnknown ValidationStatus = iota + 1
-
- // ValidationInvalid indicates that unmarshaling the message will fail.
- ValidationInvalid
-
- // ValidationValid indicates that unmarshaling the message will succeed.
- ValidationValid
-)
-
-func (v ValidationStatus) String() string {
- switch v {
- case ValidationUnknown:
- return "ValidationUnknown"
- case ValidationInvalid:
- return "ValidationInvalid"
- case ValidationValid:
- return "ValidationValid"
- default:
- return fmt.Sprintf("ValidationStatus(%d)", int(v))
- }
-}
-
-// Validate determines whether the contents of the buffer are a valid wire encoding
-// of the message type.
-//
-// This function is exposed for testing.
-func Validate(mt protoreflect.MessageType, in protoiface.UnmarshalInput) (out protoiface.UnmarshalOutput, _ ValidationStatus) {
- mi, ok := mt.(*MessageInfo)
- if !ok {
- return out, ValidationUnknown
- }
- if in.Resolver == nil {
- in.Resolver = protoregistry.GlobalTypes
- }
- o, st := mi.validate(in.Buf, 0, unmarshalOptions{
- flags: in.Flags,
- resolver: in.Resolver,
- })
- if o.initialized {
- out.Flags |= protoiface.UnmarshalInitialized
- }
- return out, st
-}
-
-type validationInfo struct {
- mi *MessageInfo
- typ validationType
- keyType, valType validationType
-
- // For non-required fields, requiredBit is 0.
- //
- // For required fields, requiredBit's nth bit is set, where n is a
- // unique index in the range [0, MessageInfo.numRequiredFields).
- //
- // If there are more than 64 required fields, requiredBit is 0.
- requiredBit uint64
-}
-
-type validationType uint8
-
-const (
- validationTypeOther validationType = iota
- validationTypeMessage
- validationTypeGroup
- validationTypeMap
- validationTypeRepeatedVarint
- validationTypeRepeatedFixed32
- validationTypeRepeatedFixed64
- validationTypeVarint
- validationTypeFixed32
- validationTypeFixed64
- validationTypeBytes
- validationTypeUTF8String
- validationTypeMessageSetItem
-)
-
-func newFieldValidationInfo(mi *MessageInfo, si structInfo, fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
- var vi validationInfo
- switch {
- case fd.ContainingOneof() != nil && !fd.ContainingOneof().IsSynthetic():
- switch fd.Kind() {
- case protoreflect.MessageKind:
- vi.typ = validationTypeMessage
- if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
- vi.mi = getMessageInfo(ot.Field(0).Type)
- }
- case protoreflect.GroupKind:
- vi.typ = validationTypeGroup
- if ot, ok := si.oneofWrappersByNumber[fd.Number()]; ok {
- vi.mi = getMessageInfo(ot.Field(0).Type)
- }
- case protoreflect.StringKind:
- if strs.EnforceUTF8(fd) {
- vi.typ = validationTypeUTF8String
- }
- }
- default:
- vi = newValidationInfo(fd, ft)
- }
- if fd.Cardinality() == protoreflect.Required {
- // Avoid overflow. The required field check is done with a 64-bit mask, with
- // any message containing more than 64 required fields always reported as
- // potentially uninitialized, so it is not important to get a precise count
- // of the required fields past 64.
- if mi.numRequiredFields < math.MaxUint8 {
- mi.numRequiredFields++
- vi.requiredBit = 1 << (mi.numRequiredFields - 1)
- }
- }
- return vi
-}
-
-func newValidationInfo(fd protoreflect.FieldDescriptor, ft reflect.Type) validationInfo {
- var vi validationInfo
- switch {
- case fd.IsList():
- switch fd.Kind() {
- case protoreflect.MessageKind:
- vi.typ = validationTypeMessage
- if ft.Kind() == reflect.Slice {
- vi.mi = getMessageInfo(ft.Elem())
- }
- case protoreflect.GroupKind:
- vi.typ = validationTypeGroup
- if ft.Kind() == reflect.Slice {
- vi.mi = getMessageInfo(ft.Elem())
- }
- case protoreflect.StringKind:
- vi.typ = validationTypeBytes
- if strs.EnforceUTF8(fd) {
- vi.typ = validationTypeUTF8String
- }
- default:
- switch wireTypes[fd.Kind()] {
- case protowire.VarintType:
- vi.typ = validationTypeRepeatedVarint
- case protowire.Fixed32Type:
- vi.typ = validationTypeRepeatedFixed32
- case protowire.Fixed64Type:
- vi.typ = validationTypeRepeatedFixed64
- }
- }
- case fd.IsMap():
- vi.typ = validationTypeMap
- switch fd.MapKey().Kind() {
- case protoreflect.StringKind:
- if strs.EnforceUTF8(fd) {
- vi.keyType = validationTypeUTF8String
- }
- }
- switch fd.MapValue().Kind() {
- case protoreflect.MessageKind:
- vi.valType = validationTypeMessage
- if ft.Kind() == reflect.Map {
- vi.mi = getMessageInfo(ft.Elem())
- }
- case protoreflect.StringKind:
- if strs.EnforceUTF8(fd) {
- vi.valType = validationTypeUTF8String
- }
- }
- default:
- switch fd.Kind() {
- case protoreflect.MessageKind:
- vi.typ = validationTypeMessage
- if !fd.IsWeak() {
- vi.mi = getMessageInfo(ft)
- }
- case protoreflect.GroupKind:
- vi.typ = validationTypeGroup
- vi.mi = getMessageInfo(ft)
- case protoreflect.StringKind:
- vi.typ = validationTypeBytes
- if strs.EnforceUTF8(fd) {
- vi.typ = validationTypeUTF8String
- }
- default:
- switch wireTypes[fd.Kind()] {
- case protowire.VarintType:
- vi.typ = validationTypeVarint
- case protowire.Fixed32Type:
- vi.typ = validationTypeFixed32
- case protowire.Fixed64Type:
- vi.typ = validationTypeFixed64
- case protowire.BytesType:
- vi.typ = validationTypeBytes
- }
- }
- }
- return vi
-}
-
-func (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) {
- mi.init()
- type validationState struct {
- typ validationType
- keyType, valType validationType
- endGroup protowire.Number
- mi *MessageInfo
- tail []byte
- requiredMask uint64
- }
-
- // Pre-allocate some slots to avoid repeated slice reallocation.
- states := make([]validationState, 0, 16)
- states = append(states, validationState{
- typ: validationTypeMessage,
- mi: mi,
- })
- if groupTag > 0 {
- states[0].typ = validationTypeGroup
- states[0].endGroup = groupTag
- }
- initialized := true
- start := len(b)
-State:
- for len(states) > 0 {
- st := &states[len(states)-1]
- for len(b) > 0 {
- // Parse the tag (field number and wire type).
- var tag uint64
- if b[0] < 0x80 {
- tag = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- tag = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- tag, n = protowire.ConsumeVarint(b)
- if n < 0 {
- return out, ValidationInvalid
- }
- b = b[n:]
- }
- var num protowire.Number
- if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {
- return out, ValidationInvalid
- } else {
- num = protowire.Number(n)
- }
- wtyp := protowire.Type(tag & 7)
-
- if wtyp == protowire.EndGroupType {
- if st.endGroup == num {
- goto PopState
- }
- return out, ValidationInvalid
- }
- var vi validationInfo
- switch {
- case st.typ == validationTypeMap:
- switch num {
- case genid.MapEntry_Key_field_number:
- vi.typ = st.keyType
- case genid.MapEntry_Value_field_number:
- vi.typ = st.valType
- vi.mi = st.mi
- vi.requiredBit = 1
- }
- case flags.ProtoLegacy && st.mi.isMessageSet:
- switch num {
- case messageset.FieldItem:
- vi.typ = validationTypeMessageSetItem
- }
- default:
- var f *coderFieldInfo
- if int(num) < len(st.mi.denseCoderFields) {
- f = st.mi.denseCoderFields[num]
- } else {
- f = st.mi.coderFields[num]
- }
- if f != nil {
- vi = f.validation
- if vi.typ == validationTypeMessage && vi.mi == nil {
- // Probable weak field.
- //
- // TODO: Consider storing the results of this lookup somewhere
- // rather than recomputing it on every validation.
- fd := st.mi.Desc.Fields().ByNumber(num)
- if fd == nil || !fd.IsWeak() {
- break
- }
- messageName := fd.Message().FullName()
- messageType, err := protoregistry.GlobalTypes.FindMessageByName(messageName)
- switch err {
- case nil:
- vi.mi, _ = messageType.(*MessageInfo)
- case protoregistry.NotFound:
- vi.typ = validationTypeBytes
- default:
- return out, ValidationUnknown
- }
- }
- break
- }
- // Possible extension field.
- //
- // TODO: We should return ValidationUnknown when:
- // 1. The resolver is not frozen. (More extensions may be added to it.)
- // 2. The resolver returns preg.NotFound.
- // In this case, a type added to the resolver in the future could cause
- // unmarshaling to begin failing. Supporting this requires some way to
- // determine if the resolver is frozen.
- xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), num)
- if err != nil && err != protoregistry.NotFound {
- return out, ValidationUnknown
- }
- if err == nil {
- vi = getExtensionFieldInfo(xt).validation
- }
- }
- if vi.requiredBit != 0 {
- // Check that the field has a compatible wire type.
- // We only need to consider non-repeated field types,
- // since repeated fields (and maps) can never be required.
- ok := false
- switch vi.typ {
- case validationTypeVarint:
- ok = wtyp == protowire.VarintType
- case validationTypeFixed32:
- ok = wtyp == protowire.Fixed32Type
- case validationTypeFixed64:
- ok = wtyp == protowire.Fixed64Type
- case validationTypeBytes, validationTypeUTF8String, validationTypeMessage:
- ok = wtyp == protowire.BytesType
- case validationTypeGroup:
- ok = wtyp == protowire.StartGroupType
- }
- if ok {
- st.requiredMask |= vi.requiredBit
- }
- }
-
- switch wtyp {
- case protowire.VarintType:
- if len(b) >= 10 {
- switch {
- case b[0] < 0x80:
- b = b[1:]
- case b[1] < 0x80:
- b = b[2:]
- case b[2] < 0x80:
- b = b[3:]
- case b[3] < 0x80:
- b = b[4:]
- case b[4] < 0x80:
- b = b[5:]
- case b[5] < 0x80:
- b = b[6:]
- case b[6] < 0x80:
- b = b[7:]
- case b[7] < 0x80:
- b = b[8:]
- case b[8] < 0x80:
- b = b[9:]
- case b[9] < 0x80 && b[9] < 2:
- b = b[10:]
- default:
- return out, ValidationInvalid
- }
- } else {
- switch {
- case len(b) > 0 && b[0] < 0x80:
- b = b[1:]
- case len(b) > 1 && b[1] < 0x80:
- b = b[2:]
- case len(b) > 2 && b[2] < 0x80:
- b = b[3:]
- case len(b) > 3 && b[3] < 0x80:
- b = b[4:]
- case len(b) > 4 && b[4] < 0x80:
- b = b[5:]
- case len(b) > 5 && b[5] < 0x80:
- b = b[6:]
- case len(b) > 6 && b[6] < 0x80:
- b = b[7:]
- case len(b) > 7 && b[7] < 0x80:
- b = b[8:]
- case len(b) > 8 && b[8] < 0x80:
- b = b[9:]
- case len(b) > 9 && b[9] < 2:
- b = b[10:]
- default:
- return out, ValidationInvalid
- }
- }
- continue State
- case protowire.BytesType:
- var size uint64
- if len(b) >= 1 && b[0] < 0x80 {
- size = uint64(b[0])
- b = b[1:]
- } else if len(b) >= 2 && b[1] < 128 {
- size = uint64(b[0]&0x7f) + uint64(b[1])<<7
- b = b[2:]
- } else {
- var n int
- size, n = protowire.ConsumeVarint(b)
- if n < 0 {
- return out, ValidationInvalid
- }
- b = b[n:]
- }
- if size > uint64(len(b)) {
- return out, ValidationInvalid
- }
- v := b[:size]
- b = b[size:]
- switch vi.typ {
- case validationTypeMessage:
- if vi.mi == nil {
- return out, ValidationUnknown
- }
- vi.mi.init()
- fallthrough
- case validationTypeMap:
- if vi.mi != nil {
- vi.mi.init()
- }
- states = append(states, validationState{
- typ: vi.typ,
- keyType: vi.keyType,
- valType: vi.valType,
- mi: vi.mi,
- tail: b,
- })
- b = v
- continue State
- case validationTypeRepeatedVarint:
- // Packed field.
- for len(v) > 0 {
- _, n := protowire.ConsumeVarint(v)
- if n < 0 {
- return out, ValidationInvalid
- }
- v = v[n:]
- }
- case validationTypeRepeatedFixed32:
- // Packed field.
- if len(v)%4 != 0 {
- return out, ValidationInvalid
- }
- case validationTypeRepeatedFixed64:
- // Packed field.
- if len(v)%8 != 0 {
- return out, ValidationInvalid
- }
- case validationTypeUTF8String:
- if !utf8.Valid(v) {
- return out, ValidationInvalid
- }
- }
- case protowire.Fixed32Type:
- if len(b) < 4 {
- return out, ValidationInvalid
- }
- b = b[4:]
- case protowire.Fixed64Type:
- if len(b) < 8 {
- return out, ValidationInvalid
- }
- b = b[8:]
- case protowire.StartGroupType:
- switch {
- case vi.typ == validationTypeGroup:
- if vi.mi == nil {
- return out, ValidationUnknown
- }
- vi.mi.init()
- states = append(states, validationState{
- typ: validationTypeGroup,
- mi: vi.mi,
- endGroup: num,
- })
- continue State
- case flags.ProtoLegacy && vi.typ == validationTypeMessageSetItem:
- typeid, v, n, err := messageset.ConsumeFieldValue(b, false)
- if err != nil {
- return out, ValidationInvalid
- }
- xt, err := opts.resolver.FindExtensionByNumber(st.mi.Desc.FullName(), typeid)
- switch {
- case err == protoregistry.NotFound:
- b = b[n:]
- case err != nil:
- return out, ValidationUnknown
- default:
- xvi := getExtensionFieldInfo(xt).validation
- if xvi.mi != nil {
- xvi.mi.init()
- }
- states = append(states, validationState{
- typ: xvi.typ,
- mi: xvi.mi,
- tail: b[n:],
- })
- b = v
- continue State
- }
- default:
- n := protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return out, ValidationInvalid
- }
- b = b[n:]
- }
- default:
- return out, ValidationInvalid
- }
- }
- if st.endGroup != 0 {
- return out, ValidationInvalid
- }
- if len(b) != 0 {
- return out, ValidationInvalid
- }
- b = st.tail
- PopState:
- numRequiredFields := 0
- switch st.typ {
- case validationTypeMessage, validationTypeGroup:
- numRequiredFields = int(st.mi.numRequiredFields)
- case validationTypeMap:
- // If this is a map field with a message value that contains
- // required fields, require that the value be present.
- if st.mi != nil && st.mi.numRequiredFields > 0 {
- numRequiredFields = 1
- }
- }
- // If there are more than 64 required fields, this check will
- // always fail and we will report that the message is potentially
- // uninitialized.
- if numRequiredFields > 0 && bits.OnesCount64(st.requiredMask) != numRequiredFields {
- initialized = false
- }
- states = states[:len(states)-1]
- }
- out.n = start - len(b)
- if initialized {
- out.initialized = true
- }
- return out, ValidationValid
-}
diff --git a/vendor/google.golang.org/protobuf/internal/impl/weak.go b/vendor/google.golang.org/protobuf/internal/impl/weak.go
deleted file mode 100644
index eb79a7b..0000000
--- a/vendor/google.golang.org/protobuf/internal/impl/weak.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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.
-
-package impl
-
-import (
- "fmt"
-
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-// weakFields adds methods to the exported WeakFields type for internal use.
-//
-// The exported type is an alias to an unnamed type, so methods can't be
-// defined directly on it.
-type weakFields WeakFields
-
-func (w weakFields) get(num protoreflect.FieldNumber) (protoreflect.ProtoMessage, bool) {
- m, ok := w[int32(num)]
- return m, ok
-}
-
-func (w *weakFields) set(num protoreflect.FieldNumber, m protoreflect.ProtoMessage) {
- if *w == nil {
- *w = make(weakFields)
- }
- (*w)[int32(num)] = m
-}
-
-func (w *weakFields) clear(num protoreflect.FieldNumber) {
- delete(*w, int32(num))
-}
-
-func (Export) HasWeak(w WeakFields, num protoreflect.FieldNumber) bool {
- _, ok := w[int32(num)]
- return ok
-}
-
-func (Export) ClearWeak(w *WeakFields, num protoreflect.FieldNumber) {
- delete(*w, int32(num))
-}
-
-func (Export) GetWeak(w WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName) protoreflect.ProtoMessage {
- if m, ok := w[int32(num)]; ok {
- return m
- }
- mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
- if mt == nil {
- panic(fmt.Sprintf("message %v for weak field is not linked in", name))
- }
- return mt.Zero().Interface()
-}
-
-func (Export) SetWeak(w *WeakFields, num protoreflect.FieldNumber, name protoreflect.FullName, m protoreflect.ProtoMessage) {
- if m != nil {
- mt, _ := protoregistry.GlobalTypes.FindMessageByName(name)
- if mt == nil {
- panic(fmt.Sprintf("message %v for weak field is not linked in", name))
- }
- if mt != m.ProtoReflect().Type() {
- panic(fmt.Sprintf("invalid message type for weak field: got %T, want %T", m, mt.Zero().Interface()))
- }
- }
- if m == nil || !m.ProtoReflect().IsValid() {
- delete(*w, int32(num))
- return
- }
- if *w == nil {
- *w = make(weakFields)
- }
- (*w)[int32(num)] = m
-}
diff --git a/vendor/google.golang.org/protobuf/internal/order/order.go b/vendor/google.golang.org/protobuf/internal/order/order.go
deleted file mode 100644
index dea522e..0000000
--- a/vendor/google.golang.org/protobuf/internal/order/order.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2020 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.
-
-package order
-
-import (
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// FieldOrder specifies the ordering to visit message fields.
-// It is a function that reports whether x is ordered before y.
-type FieldOrder func(x, y protoreflect.FieldDescriptor) bool
-
-var (
- // AnyFieldOrder specifies no specific field ordering.
- AnyFieldOrder FieldOrder = nil
-
- // LegacyFieldOrder sorts fields in the same ordering as emitted by
- // wire serialization in the github.com/golang/protobuf implementation.
- LegacyFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
- ox, oy := x.ContainingOneof(), y.ContainingOneof()
- inOneof := func(od protoreflect.OneofDescriptor) bool {
- return od != nil && !od.IsSynthetic()
- }
-
- // Extension fields sort before non-extension fields.
- if x.IsExtension() != y.IsExtension() {
- return x.IsExtension() && !y.IsExtension()
- }
- // Fields not within a oneof sort before those within a oneof.
- if inOneof(ox) != inOneof(oy) {
- return !inOneof(ox) && inOneof(oy)
- }
- // Fields in disjoint oneof sets are sorted by declaration index.
- if inOneof(ox) && inOneof(oy) && ox != oy {
- return ox.Index() < oy.Index()
- }
- // Fields sorted by field number.
- return x.Number() < y.Number()
- }
-
- // NumberFieldOrder sorts fields by their field number.
- NumberFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
- return x.Number() < y.Number()
- }
-
- // IndexNameFieldOrder sorts non-extension fields before extension fields.
- // Non-extensions are sorted according to their declaration index.
- // Extensions are sorted according to their full name.
- IndexNameFieldOrder FieldOrder = func(x, y protoreflect.FieldDescriptor) bool {
- // Non-extension fields sort before extension fields.
- if x.IsExtension() != y.IsExtension() {
- return !x.IsExtension() && y.IsExtension()
- }
- // Extensions sorted by fullname.
- if x.IsExtension() && y.IsExtension() {
- return x.FullName() < y.FullName()
- }
- // Non-extensions sorted by declaration index.
- return x.Index() < y.Index()
- }
-)
-
-// KeyOrder specifies the ordering to visit map entries.
-// It is a function that reports whether x is ordered before y.
-type KeyOrder func(x, y protoreflect.MapKey) bool
-
-var (
- // AnyKeyOrder specifies no specific key ordering.
- AnyKeyOrder KeyOrder = nil
-
- // GenericKeyOrder sorts false before true, numeric keys in ascending order,
- // and strings in lexicographical ordering according to UTF-8 codepoints.
- GenericKeyOrder KeyOrder = func(x, y protoreflect.MapKey) bool {
- switch x.Interface().(type) {
- case bool:
- return !x.Bool() && y.Bool()
- case int32, int64:
- return x.Int() < y.Int()
- case uint32, uint64:
- return x.Uint() < y.Uint()
- case string:
- return x.String() < y.String()
- default:
- panic("invalid map key type")
- }
- }
-)
diff --git a/vendor/google.golang.org/protobuf/internal/order/range.go b/vendor/google.golang.org/protobuf/internal/order/range.go
deleted file mode 100644
index 1665a68..0000000
--- a/vendor/google.golang.org/protobuf/internal/order/range.go
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2020 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.
-
-// Package order provides ordered access to messages and maps.
-package order
-
-import (
- "sort"
- "sync"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type messageField struct {
- fd protoreflect.FieldDescriptor
- v protoreflect.Value
-}
-
-var messageFieldPool = sync.Pool{
- New: func() interface{} { return new([]messageField) },
-}
-
-type (
- // FieldRnger is an interface for visiting all fields in a message.
- // The protoreflect.Message type implements this interface.
- FieldRanger interface{ Range(VisitField) }
- // VisitField is called every time a message field is visited.
- VisitField = func(protoreflect.FieldDescriptor, protoreflect.Value) bool
-)
-
-// RangeFields iterates over the fields of fs according to the specified order.
-func RangeFields(fs FieldRanger, less FieldOrder, fn VisitField) {
- if less == nil {
- fs.Range(fn)
- return
- }
-
- // Obtain a pre-allocated scratch buffer.
- p := messageFieldPool.Get().(*[]messageField)
- fields := (*p)[:0]
- defer func() {
- if cap(fields) < 1024 {
- *p = fields
- messageFieldPool.Put(p)
- }
- }()
-
- // Collect all fields in the message and sort them.
- fs.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- fields = append(fields, messageField{fd, v})
- return true
- })
- sort.Slice(fields, func(i, j int) bool {
- return less(fields[i].fd, fields[j].fd)
- })
-
- // Visit the fields in the specified ordering.
- for _, f := range fields {
- if !fn(f.fd, f.v) {
- return
- }
- }
-}
-
-type mapEntry struct {
- k protoreflect.MapKey
- v protoreflect.Value
-}
-
-var mapEntryPool = sync.Pool{
- New: func() interface{} { return new([]mapEntry) },
-}
-
-type (
- // EntryRanger is an interface for visiting all fields in a message.
- // The protoreflect.Map type implements this interface.
- EntryRanger interface{ Range(VisitEntry) }
- // VisitEntry is called every time a map entry is visited.
- VisitEntry = func(protoreflect.MapKey, protoreflect.Value) bool
-)
-
-// RangeEntries iterates over the entries of es according to the specified order.
-func RangeEntries(es EntryRanger, less KeyOrder, fn VisitEntry) {
- if less == nil {
- es.Range(fn)
- return
- }
-
- // Obtain a pre-allocated scratch buffer.
- p := mapEntryPool.Get().(*[]mapEntry)
- entries := (*p)[:0]
- defer func() {
- if cap(entries) < 1024 {
- *p = entries
- mapEntryPool.Put(p)
- }
- }()
-
- // Collect all entries in the map and sort them.
- es.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
- entries = append(entries, mapEntry{k, v})
- return true
- })
- sort.Slice(entries, func(i, j int) bool {
- return less(entries[i].k, entries[j].k)
- })
-
- // Visit the entries in the specified ordering.
- for _, e := range entries {
- if !fn(e.k, e.v) {
- return
- }
- }
-}
diff --git a/vendor/google.golang.org/protobuf/internal/pragma/pragma.go b/vendor/google.golang.org/protobuf/internal/pragma/pragma.go
deleted file mode 100644
index 49dc4fc..0000000
--- a/vendor/google.golang.org/protobuf/internal/pragma/pragma.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2018 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.
-
-// Package pragma provides types that can be embedded into a struct to
-// statically enforce or prevent certain language properties.
-package pragma
-
-import "sync"
-
-// NoUnkeyedLiterals can be embedded in a struct to prevent unkeyed literals.
-type NoUnkeyedLiterals struct{}
-
-// DoNotImplement can be embedded in an interface to prevent trivial
-// implementations of the interface.
-//
-// This is useful to prevent unauthorized implementations of an interface
-// so that it can be extended in the future for any protobuf language changes.
-type DoNotImplement interface{ ProtoInternal(DoNotImplement) }
-
-// DoNotCompare can be embedded in a struct to prevent comparability.
-type DoNotCompare [0]func()
-
-// DoNotCopy can be embedded in a struct to help prevent shallow copies.
-// This does not rely on a Go language feature, but rather a special case
-// within the vet checker.
-//
-// See https://golang.org/issues/8005.
-type DoNotCopy [0]sync.Mutex
diff --git a/vendor/google.golang.org/protobuf/internal/set/ints.go b/vendor/google.golang.org/protobuf/internal/set/ints.go
deleted file mode 100644
index d3d7f89..0000000
--- a/vendor/google.golang.org/protobuf/internal/set/ints.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2018 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.
-
-// Package set provides simple set data structures for uint64s.
-package set
-
-import "math/bits"
-
-// int64s represents a set of integers within the range of 0..63.
-type int64s uint64
-
-func (bs *int64s) Len() int {
- return bits.OnesCount64(uint64(*bs))
-}
-func (bs *int64s) Has(n uint64) bool {
- return uint64(*bs)&(uint64(1)< 0
-}
-func (bs *int64s) Set(n uint64) {
- *(*uint64)(bs) |= uint64(1) << n
-}
-func (bs *int64s) Clear(n uint64) {
- *(*uint64)(bs) &^= uint64(1) << n
-}
-
-// Ints represents a set of integers within the range of 0..math.MaxUint64.
-type Ints struct {
- lo int64s
- hi map[uint64]struct{}
-}
-
-func (bs *Ints) Len() int {
- return bs.lo.Len() + len(bs.hi)
-}
-func (bs *Ints) Has(n uint64) bool {
- if n < 64 {
- return bs.lo.Has(n)
- }
- _, ok := bs.hi[n]
- return ok
-}
-func (bs *Ints) Set(n uint64) {
- if n < 64 {
- bs.lo.Set(n)
- return
- }
- if bs.hi == nil {
- bs.hi = make(map[uint64]struct{})
- }
- bs.hi[n] = struct{}{}
-}
-func (bs *Ints) Clear(n uint64) {
- if n < 64 {
- bs.lo.Clear(n)
- return
- }
- delete(bs.hi, n)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings.go b/vendor/google.golang.org/protobuf/internal/strs/strings.go
deleted file mode 100644
index 0b74e76..0000000
--- a/vendor/google.golang.org/protobuf/internal/strs/strings.go
+++ /dev/null
@@ -1,196 +0,0 @@
-// 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.
-
-// Package strs provides string manipulation functionality specific to protobuf.
-package strs
-
-import (
- "go/token"
- "strings"
- "unicode"
- "unicode/utf8"
-
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// EnforceUTF8 reports whether to enforce strict UTF-8 validation.
-func EnforceUTF8(fd protoreflect.FieldDescriptor) bool {
- if flags.ProtoLegacy {
- if fd, ok := fd.(interface{ EnforceUTF8() bool }); ok {
- return fd.EnforceUTF8()
- }
- }
- return fd.Syntax() == protoreflect.Proto3
-}
-
-// GoCamelCase camel-cases a protobuf name for use as a Go identifier.
-//
-// If there is an interior underscore followed by a lower case letter,
-// drop the underscore and convert the letter to upper case.
-func GoCamelCase(s string) string {
- // Invariant: if the next letter is lower case, it must be converted
- // to upper case.
- // That is, we process a word at a time, where words are marked by _ or
- // upper case letter. Digits are treated as words.
- var b []byte
- for i := 0; i < len(s); i++ {
- c := s[i]
- switch {
- case c == '.' && i+1 < len(s) && isASCIILower(s[i+1]):
- // Skip over '.' in ".{{lowercase}}".
- case c == '.':
- b = append(b, '_') // convert '.' to '_'
- case c == '_' && (i == 0 || s[i-1] == '.'):
- // Convert initial '_' to ensure we start with a capital letter.
- // Do the same for '_' after '.' to match historic behavior.
- b = append(b, 'X') // convert '_' to 'X'
- case c == '_' && i+1 < len(s) && isASCIILower(s[i+1]):
- // Skip over '_' in "_{{lowercase}}".
- case isASCIIDigit(c):
- b = append(b, c)
- default:
- // Assume we have a letter now - if not, it's a bogus identifier.
- // The next word is a sequence of characters that must start upper case.
- if isASCIILower(c) {
- c -= 'a' - 'A' // convert lowercase to uppercase
- }
- b = append(b, c)
-
- // Accept lower case sequence that follows.
- for ; i+1 < len(s) && isASCIILower(s[i+1]); i++ {
- b = append(b, s[i+1])
- }
- }
- }
- return string(b)
-}
-
-// GoSanitized converts a string to a valid Go identifier.
-func GoSanitized(s string) string {
- // Sanitize the input to the set of valid characters,
- // which must be '_' or be in the Unicode L or N categories.
- s = strings.Map(func(r rune) rune {
- if unicode.IsLetter(r) || unicode.IsDigit(r) {
- return r
- }
- return '_'
- }, s)
-
- // Prepend '_' in the event of a Go keyword conflict or if
- // the identifier is invalid (does not start in the Unicode L category).
- r, _ := utf8.DecodeRuneInString(s)
- if token.Lookup(s).IsKeyword() || !unicode.IsLetter(r) {
- return "_" + s
- }
- return s
-}
-
-// JSONCamelCase converts a snake_case identifier to a camelCase identifier,
-// according to the protobuf JSON specification.
-func JSONCamelCase(s string) string {
- var b []byte
- var wasUnderscore bool
- for i := 0; i < len(s); i++ { // proto identifiers are always ASCII
- c := s[i]
- if c != '_' {
- if wasUnderscore && isASCIILower(c) {
- c -= 'a' - 'A' // convert to uppercase
- }
- b = append(b, c)
- }
- wasUnderscore = c == '_'
- }
- return string(b)
-}
-
-// JSONSnakeCase converts a camelCase identifier to a snake_case identifier,
-// according to the protobuf JSON specification.
-func JSONSnakeCase(s string) string {
- var b []byte
- for i := 0; i < len(s); i++ { // proto identifiers are always ASCII
- c := s[i]
- if isASCIIUpper(c) {
- b = append(b, '_')
- c += 'a' - 'A' // convert to lowercase
- }
- b = append(b, c)
- }
- return string(b)
-}
-
-// MapEntryName derives the name of the map entry message given the field name.
-// See protoc v3.8.0: src/google/protobuf/descriptor.cc:254-276,6057
-func MapEntryName(s string) string {
- var b []byte
- upperNext := true
- for _, c := range s {
- switch {
- case c == '_':
- upperNext = true
- case upperNext:
- b = append(b, byte(unicode.ToUpper(c)))
- upperNext = false
- default:
- b = append(b, byte(c))
- }
- }
- b = append(b, "Entry"...)
- return string(b)
-}
-
-// EnumValueName derives the camel-cased enum value name.
-// See protoc v3.8.0: src/google/protobuf/descriptor.cc:297-313
-func EnumValueName(s string) string {
- var b []byte
- upperNext := true
- for _, c := range s {
- switch {
- case c == '_':
- upperNext = true
- case upperNext:
- b = append(b, byte(unicode.ToUpper(c)))
- upperNext = false
- default:
- b = append(b, byte(unicode.ToLower(c)))
- upperNext = false
- }
- }
- return string(b)
-}
-
-// TrimEnumPrefix trims the enum name prefix from an enum value name,
-// where the prefix is all lowercase without underscores.
-// See protoc v3.8.0: src/google/protobuf/descriptor.cc:330-375
-func TrimEnumPrefix(s, prefix string) string {
- s0 := s // original input
- for len(s) > 0 && len(prefix) > 0 {
- if s[0] == '_' {
- s = s[1:]
- continue
- }
- if unicode.ToLower(rune(s[0])) != rune(prefix[0]) {
- return s0 // no prefix match
- }
- s, prefix = s[1:], prefix[1:]
- }
- if len(prefix) > 0 {
- return s0 // no prefix match
- }
- s = strings.TrimLeft(s, "_")
- if len(s) == 0 {
- return s0 // avoid returning empty string
- }
- return s
-}
-
-func isASCIILower(c byte) bool {
- return 'a' <= c && c <= 'z'
-}
-func isASCIIUpper(c byte) bool {
- return 'A' <= c && c <= 'Z'
-}
-func isASCIIDigit(c byte) bool {
- return '0' <= c && c <= '9'
-}
diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go b/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
deleted file mode 100644
index a1f6f33..0000000
--- a/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2018 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.
-
-//go:build purego || appengine
-// +build purego appengine
-
-package strs
-
-import pref "google.golang.org/protobuf/reflect/protoreflect"
-
-func UnsafeString(b []byte) string {
- return string(b)
-}
-
-func UnsafeBytes(s string) []byte {
- return []byte(s)
-}
-
-type Builder struct{}
-
-func (*Builder) AppendFullName(prefix pref.FullName, name pref.Name) pref.FullName {
- return prefix.Append(name)
-}
-
-func (*Builder) MakeString(b []byte) string {
- return string(b)
-}
diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go
deleted file mode 100644
index a008acd..0000000
--- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !purego && !appengine && !go1.21
-// +build !purego,!appengine,!go1.21
-
-package strs
-
-import (
- "unsafe"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-type (
- stringHeader struct {
- Data unsafe.Pointer
- Len int
- }
- sliceHeader struct {
- Data unsafe.Pointer
- Len int
- Cap int
- }
-)
-
-// UnsafeString returns an unsafe string reference of b.
-// The caller must treat the input slice as immutable.
-//
-// WARNING: Use carefully. The returned result must not leak to the end user
-// unless the input slice is provably immutable.
-func UnsafeString(b []byte) (s string) {
- src := (*sliceHeader)(unsafe.Pointer(&b))
- dst := (*stringHeader)(unsafe.Pointer(&s))
- dst.Data = src.Data
- dst.Len = src.Len
- return s
-}
-
-// UnsafeBytes returns an unsafe bytes slice reference of s.
-// The caller must treat returned slice as immutable.
-//
-// WARNING: Use carefully. The returned result must not leak to the end user.
-func UnsafeBytes(s string) (b []byte) {
- src := (*stringHeader)(unsafe.Pointer(&s))
- dst := (*sliceHeader)(unsafe.Pointer(&b))
- dst.Data = src.Data
- dst.Len = src.Len
- dst.Cap = src.Len
- return b
-}
-
-// Builder builds a set of strings with shared lifetime.
-// This differs from strings.Builder, which is for building a single string.
-type Builder struct {
- buf []byte
-}
-
-// AppendFullName is equivalent to protoreflect.FullName.Append,
-// but optimized for large batches where each name has a shared lifetime.
-func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
- n := len(prefix) + len(".") + len(name)
- if len(prefix) == 0 {
- n -= len(".")
- }
- sb.grow(n)
- sb.buf = append(sb.buf, prefix...)
- sb.buf = append(sb.buf, '.')
- sb.buf = append(sb.buf, name...)
- return protoreflect.FullName(sb.last(n))
-}
-
-// MakeString is equivalent to string(b), but optimized for large batches
-// with a shared lifetime.
-func (sb *Builder) MakeString(b []byte) string {
- sb.grow(len(b))
- sb.buf = append(sb.buf, b...)
- return sb.last(len(b))
-}
-
-func (sb *Builder) grow(n int) {
- if cap(sb.buf)-len(sb.buf) >= n {
- return
- }
-
- // Unlike strings.Builder, we do not need to copy over the contents
- // of the old buffer since our builder provides no API for
- // retrieving previously created strings.
- sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n))
-}
-
-func (sb *Builder) last(n int) string {
- return UnsafeString(sb.buf[len(sb.buf)-n:])
-}
diff --git a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go b/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
deleted file mode 100644
index 60166f2..0000000
--- a/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go121.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !purego && !appengine && go1.21
-// +build !purego,!appengine,go1.21
-
-package strs
-
-import (
- "unsafe"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// UnsafeString returns an unsafe string reference of b.
-// The caller must treat the input slice as immutable.
-//
-// WARNING: Use carefully. The returned result must not leak to the end user
-// unless the input slice is provably immutable.
-func UnsafeString(b []byte) string {
- return unsafe.String(unsafe.SliceData(b), len(b))
-}
-
-// UnsafeBytes returns an unsafe bytes slice reference of s.
-// The caller must treat returned slice as immutable.
-//
-// WARNING: Use carefully. The returned result must not leak to the end user.
-func UnsafeBytes(s string) []byte {
- return unsafe.Slice(unsafe.StringData(s), len(s))
-}
-
-// Builder builds a set of strings with shared lifetime.
-// This differs from strings.Builder, which is for building a single string.
-type Builder struct {
- buf []byte
-}
-
-// AppendFullName is equivalent to protoreflect.FullName.Append,
-// but optimized for large batches where each name has a shared lifetime.
-func (sb *Builder) AppendFullName(prefix protoreflect.FullName, name protoreflect.Name) protoreflect.FullName {
- n := len(prefix) + len(".") + len(name)
- if len(prefix) == 0 {
- n -= len(".")
- }
- sb.grow(n)
- sb.buf = append(sb.buf, prefix...)
- sb.buf = append(sb.buf, '.')
- sb.buf = append(sb.buf, name...)
- return protoreflect.FullName(sb.last(n))
-}
-
-// MakeString is equivalent to string(b), but optimized for large batches
-// with a shared lifetime.
-func (sb *Builder) MakeString(b []byte) string {
- sb.grow(len(b))
- sb.buf = append(sb.buf, b...)
- return sb.last(len(b))
-}
-
-func (sb *Builder) grow(n int) {
- if cap(sb.buf)-len(sb.buf) >= n {
- return
- }
-
- // Unlike strings.Builder, we do not need to copy over the contents
- // of the old buffer since our builder provides no API for
- // retrieving previously created strings.
- sb.buf = make([]byte, 0, 2*(cap(sb.buf)+n))
-}
-
-func (sb *Builder) last(n int) string {
- return UnsafeString(sb.buf[len(sb.buf)-n:])
-}
diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go
deleted file mode 100644
index d8f48fa..0000000
--- a/vendor/google.golang.org/protobuf/internal/version/version.go
+++ /dev/null
@@ -1,79 +0,0 @@
-// 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.
-
-// Package version records versioning information about this module.
-package version
-
-import (
- "fmt"
- "strings"
-)
-
-// These constants determine the current version of this module.
-//
-// For our release process, we enforce the following rules:
-// - Tagged releases use a tag that is identical to String.
-// - Tagged releases never reference a commit where the String
-// contains "devel".
-// - The set of all commits in this repository where String
-// does not contain "devel" must have a unique String.
-//
-// Steps for tagging a new release:
-//
-// 1. Create a new CL.
-//
-// 2. Update Minor, Patch, and/or PreRelease as necessary.
-// PreRelease must not contain the string "devel".
-//
-// 3. Since the last released minor version, have there been any changes to
-// generator that relies on new functionality in the runtime?
-// If yes, then increment RequiredGenerated.
-//
-// 4. Since the last released minor version, have there been any changes to
-// the runtime that removes support for old .pb.go source code?
-// If yes, then increment SupportMinimum.
-//
-// 5. Send out the CL for review and submit it.
-// Note that the next CL in step 8 must be submitted after this CL
-// without any other CLs in-between.
-//
-// 6. Tag a new version, where the tag is is the current String.
-//
-// 7. Write release notes for all notable changes
-// between this release and the last release.
-//
-// 8. Create a new CL.
-//
-// 9. Update PreRelease to include the string "devel".
-// For example: "" -> "devel" or "rc.1" -> "rc.1.devel"
-//
-// 10. Send out the CL for review and submit it.
-const (
- Major = 1
- Minor = 32
- Patch = 0
- PreRelease = ""
-)
-
-// String formats the version string for this module in semver format.
-//
-// Examples:
-//
-// v1.20.1
-// v1.21.0-rc.1
-func String() string {
- v := fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
- if PreRelease != "" {
- v += "-" + PreRelease
-
- // TODO: Add metadata about the commit or build hash.
- // See https://golang.org/issue/29814
- // See https://golang.org/issue/33533
- var metadata string
- if strings.Contains(PreRelease, "devel") && metadata != "" {
- v += "+" + metadata
- }
- }
- return v
-}
diff --git a/vendor/google.golang.org/protobuf/proto/checkinit.go b/vendor/google.golang.org/protobuf/proto/checkinit.go
deleted file mode 100644
index 3e9a6a2..0000000
--- a/vendor/google.golang.org/protobuf/proto/checkinit.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// CheckInitialized returns an error if any required fields in m are not set.
-func CheckInitialized(m Message) error {
- // Treat a nil message interface as an "untyped" empty message,
- // which we assume to have no required fields.
- if m == nil {
- return nil
- }
-
- return checkInitialized(m.ProtoReflect())
-}
-
-// CheckInitialized returns an error if any required fields in m are not set.
-func checkInitialized(m protoreflect.Message) error {
- if methods := protoMethods(m); methods != nil && methods.CheckInitialized != nil {
- _, err := methods.CheckInitialized(protoiface.CheckInitializedInput{
- Message: m,
- })
- return err
- }
- return checkInitializedSlow(m)
-}
-
-func checkInitializedSlow(m protoreflect.Message) error {
- md := m.Descriptor()
- fds := md.Fields()
- for i, nums := 0, md.RequiredNumbers(); i < nums.Len(); i++ {
- fd := fds.ByNumber(nums.Get(i))
- if !m.Has(fd) {
- return errors.RequiredNotSet(string(fd.FullName()))
- }
- }
- var err error
- m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- switch {
- case fd.IsList():
- if fd.Message() == nil {
- return true
- }
- for i, list := 0, v.List(); i < list.Len() && err == nil; i++ {
- err = checkInitialized(list.Get(i).Message())
- }
- case fd.IsMap():
- if fd.MapValue().Message() == nil {
- return true
- }
- v.Map().Range(func(key protoreflect.MapKey, v protoreflect.Value) bool {
- err = checkInitialized(v.Message())
- return err == nil
- })
- default:
- if fd.Message() == nil {
- return true
- }
- err = checkInitialized(v.Message())
- }
- return err == nil
- })
- return err
-}
diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go
deleted file mode 100644
index e5b03b5..0000000
--- a/vendor/google.golang.org/protobuf/proto/decode.go
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2018 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/internal/genid"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// UnmarshalOptions configures the unmarshaler.
-//
-// Example usage:
-//
-// err := UnmarshalOptions{DiscardUnknown: true}.Unmarshal(b, m)
-type UnmarshalOptions struct {
- pragma.NoUnkeyedLiterals
-
- // Merge merges the input into the destination message.
- // The default behavior is to always reset the message before unmarshaling,
- // unless Merge is specified.
- Merge bool
-
- // AllowPartial accepts input for messages that will result in missing
- // required fields. If AllowPartial is false (the default), Unmarshal will
- // return an error if there are any missing required fields.
- AllowPartial bool
-
- // If DiscardUnknown is set, unknown fields are ignored.
- DiscardUnknown bool
-
- // Resolver is used for looking up types when unmarshaling extension fields.
- // If nil, this defaults to using protoregistry.GlobalTypes.
- Resolver interface {
- FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- }
-
- // RecursionLimit limits how deeply messages may be nested.
- // If zero, a default limit is applied.
- RecursionLimit int
-}
-
-// Unmarshal parses the wire-format message in b and places the result in m.
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-func Unmarshal(b []byte, m Message) error {
- _, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())
- return err
-}
-
-// Unmarshal parses the wire-format message in b and places the result in m.
-// The provided message must be mutable (e.g., a non-nil pointer to a message).
-func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
- if o.RecursionLimit == 0 {
- o.RecursionLimit = protowire.DefaultRecursionLimit
- }
- _, err := o.unmarshal(b, m.ProtoReflect())
- return err
-}
-
-// UnmarshalState parses a wire-format message and places the result in m.
-//
-// This method permits fine-grained control over the unmarshaler.
-// Most users should use [Unmarshal] instead.
-func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
- if o.RecursionLimit == 0 {
- o.RecursionLimit = protowire.DefaultRecursionLimit
- }
- return o.unmarshal(in.Buf, in.Message)
-}
-
-// unmarshal is a centralized function that all unmarshal operations go through.
-// For profiling purposes, avoid changing the name of this function or
-// introducing other code paths for unmarshal that do not go through this.
-func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out protoiface.UnmarshalOutput, err error) {
- if o.Resolver == nil {
- o.Resolver = protoregistry.GlobalTypes
- }
- if !o.Merge {
- Reset(m.Interface())
- }
- allowPartial := o.AllowPartial
- o.Merge = true
- o.AllowPartial = true
- methods := protoMethods(m)
- if methods != nil && methods.Unmarshal != nil &&
- !(o.DiscardUnknown && methods.Flags&protoiface.SupportUnmarshalDiscardUnknown == 0) {
- in := protoiface.UnmarshalInput{
- Message: m,
- Buf: b,
- Resolver: o.Resolver,
- Depth: o.RecursionLimit,
- }
- if o.DiscardUnknown {
- in.Flags |= protoiface.UnmarshalDiscardUnknown
- }
- out, err = methods.Unmarshal(in)
- } else {
- o.RecursionLimit--
- if o.RecursionLimit < 0 {
- return out, errors.New("exceeded max recursion depth")
- }
- err = o.unmarshalMessageSlow(b, m)
- }
- if err != nil {
- return out, err
- }
- if allowPartial || (out.Flags&protoiface.UnmarshalInitialized != 0) {
- return out, nil
- }
- return out, checkInitialized(m)
-}
-
-func (o UnmarshalOptions) unmarshalMessage(b []byte, m protoreflect.Message) error {
- _, err := o.unmarshal(b, m)
- return err
-}
-
-func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message) error {
- md := m.Descriptor()
- if messageset.IsMessageSet(md) {
- return o.unmarshalMessageSet(b, m)
- }
- fields := md.Fields()
- for len(b) > 0 {
- // Parse the tag (field number and wire type).
- num, wtyp, tagLen := protowire.ConsumeTag(b)
- if tagLen < 0 {
- return errDecode
- }
- if num > protowire.MaxValidNumber {
- return errDecode
- }
-
- // Find the field descriptor for this field number.
- fd := fields.ByNumber(num)
- if fd == nil && md.ExtensionRanges().Has(num) {
- extType, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)
- if err != nil && err != protoregistry.NotFound {
- return errors.New("%v: unable to resolve extension %v: %v", md.FullName(), num, err)
- }
- if extType != nil {
- fd = extType.TypeDescriptor()
- }
- }
- var err error
- if fd == nil {
- err = errUnknown
- } else if flags.ProtoLegacy {
- if fd.IsWeak() && fd.Message().IsPlaceholder() {
- err = errUnknown // weak referent is not linked in
- }
- }
-
- // Parse the field value.
- var valLen int
- switch {
- case err != nil:
- case fd.IsList():
- valLen, err = o.unmarshalList(b[tagLen:], wtyp, m.Mutable(fd).List(), fd)
- case fd.IsMap():
- valLen, err = o.unmarshalMap(b[tagLen:], wtyp, m.Mutable(fd).Map(), fd)
- default:
- valLen, err = o.unmarshalSingular(b[tagLen:], wtyp, m, fd)
- }
- if err != nil {
- if err != errUnknown {
- return err
- }
- valLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:])
- if valLen < 0 {
- return errDecode
- }
- if !o.DiscardUnknown {
- m.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...))
- }
- }
- b = b[tagLen+valLen:]
- }
- return nil
-}
-
-func (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) {
- v, n, err := o.unmarshalScalar(b, wtyp, fd)
- if err != nil {
- return 0, err
- }
- switch fd.Kind() {
- case protoreflect.GroupKind, protoreflect.MessageKind:
- m2 := m.Mutable(fd).Message()
- if err := o.unmarshalMessage(v.Bytes(), m2); err != nil {
- return n, err
- }
- default:
- // Non-message scalars replace the previous value.
- m.Set(fd, v)
- }
- return n, nil
-}
-
-func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) {
- if wtyp != protowire.BytesType {
- return 0, errUnknown
- }
- b, n = protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- var (
- keyField = fd.MapKey()
- valField = fd.MapValue()
- key protoreflect.Value
- val protoreflect.Value
- haveKey bool
- haveVal bool
- )
- switch valField.Kind() {
- case protoreflect.GroupKind, protoreflect.MessageKind:
- val = mapv.NewValue()
- }
- // Map entries are represented as a two-element message with fields
- // containing the key and value.
- for len(b) > 0 {
- num, wtyp, n := protowire.ConsumeTag(b)
- if n < 0 {
- return 0, errDecode
- }
- if num > protowire.MaxValidNumber {
- return 0, errDecode
- }
- b = b[n:]
- err = errUnknown
- switch num {
- case genid.MapEntry_Key_field_number:
- key, n, err = o.unmarshalScalar(b, wtyp, keyField)
- if err != nil {
- break
- }
- haveKey = true
- case genid.MapEntry_Value_field_number:
- var v protoreflect.Value
- v, n, err = o.unmarshalScalar(b, wtyp, valField)
- if err != nil {
- break
- }
- switch valField.Kind() {
- case protoreflect.GroupKind, protoreflect.MessageKind:
- if err := o.unmarshalMessage(v.Bytes(), val.Message()); err != nil {
- return 0, err
- }
- default:
- val = v
- }
- haveVal = true
- }
- if err == errUnknown {
- n = protowire.ConsumeFieldValue(num, wtyp, b)
- if n < 0 {
- return 0, errDecode
- }
- } else if err != nil {
- return 0, err
- }
- b = b[n:]
- }
- // Every map entry should have entries for key and value, but this is not strictly required.
- if !haveKey {
- key = keyField.Default()
- }
- if !haveVal {
- switch valField.Kind() {
- case protoreflect.GroupKind, protoreflect.MessageKind:
- default:
- val = valField.Default()
- }
- }
- mapv.Set(key.MapKey(), val)
- return n, nil
-}
-
-// errUnknown is used internally to indicate fields which should be added
-// to the unknown field set of a message. It is never returned from an exported
-// function.
-var errUnknown = errors.New("BUG: internal error (unknown)")
-
-var errDecode = errors.New("cannot parse invalid wire-format data")
diff --git a/vendor/google.golang.org/protobuf/proto/decode_gen.go b/vendor/google.golang.org/protobuf/proto/decode_gen.go
deleted file mode 100644
index 301eeb2..0000000
--- a/vendor/google.golang.org/protobuf/proto/decode_gen.go
+++ /dev/null
@@ -1,603 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package proto
-
-import (
- "math"
- "unicode/utf8"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// unmarshalScalar decodes a value of the given kind.
-//
-// Message values are decoded into a []byte which aliases the input data.
-func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil
- case protoreflect.EnumKind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil
- case protoreflect.Int32Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt32(int32(v)), n, nil
- case protoreflect.Sint32Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil
- case protoreflect.Uint32Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfUint32(uint32(v)), n, nil
- case protoreflect.Int64Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt64(int64(v)), n, nil
- case protoreflect.Sint64Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil
- case protoreflect.Uint64Kind:
- if wtyp != protowire.VarintType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfUint64(v), n, nil
- case protoreflect.Sfixed32Kind:
- if wtyp != protowire.Fixed32Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt32(int32(v)), n, nil
- case protoreflect.Fixed32Kind:
- if wtyp != protowire.Fixed32Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfUint32(uint32(v)), n, nil
- case protoreflect.FloatKind:
- if wtyp != protowire.Fixed32Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil
- case protoreflect.Sfixed64Kind:
- if wtyp != protowire.Fixed64Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfInt64(int64(v)), n, nil
- case protoreflect.Fixed64Kind:
- if wtyp != protowire.Fixed64Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfUint64(v), n, nil
- case protoreflect.DoubleKind:
- if wtyp != protowire.Fixed64Type {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil
- case protoreflect.StringKind:
- if wtyp != protowire.BytesType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return val, 0, errDecode
- }
- if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
- return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))
- }
- return protoreflect.ValueOfString(string(v)), n, nil
- case protoreflect.BytesKind:
- if wtyp != protowire.BytesType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil
- case protoreflect.MessageKind:
- if wtyp != protowire.BytesType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfBytes(v), n, nil
- case protoreflect.GroupKind:
- if wtyp != protowire.StartGroupType {
- return val, 0, errUnknown
- }
- v, n := protowire.ConsumeGroup(fd.Number(), b)
- if n < 0 {
- return val, 0, errDecode
- }
- return protoreflect.ValueOfBytes(v), n, nil
- default:
- return val, 0, errUnknown
- }
-}
-
-func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {
- switch fd.Kind() {
- case protoreflect.BoolKind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
- return n, nil
- case protoreflect.EnumKind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
- return n, nil
- case protoreflect.Int32Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- return n, nil
- case protoreflect.Sint32Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
- return n, nil
- case protoreflect.Uint32Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- return n, nil
- case protoreflect.Int64Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- return n, nil
- case protoreflect.Sint64Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
- return n, nil
- case protoreflect.Uint64Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeVarint(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfUint64(v))
- }
- return n, nil
- }
- if wtyp != protowire.VarintType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeVarint(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- return n, nil
- case protoreflect.Sfixed32Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed32(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed32Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt32(int32(v)))
- return n, nil
- case protoreflect.Fixed32Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed32(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed32Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfUint32(uint32(v)))
- return n, nil
- case protoreflect.FloatKind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed32(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed32Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed32(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
- return n, nil
- case protoreflect.Sfixed64Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed64(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed64Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfInt64(int64(v)))
- return n, nil
- case protoreflect.Fixed64Kind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed64(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfUint64(v))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed64Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfUint64(v))
- return n, nil
- case protoreflect.DoubleKind:
- if wtyp == protowire.BytesType {
- buf, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- for len(buf) > 0 {
- v, n := protowire.ConsumeFixed64(buf)
- if n < 0 {
- return 0, errDecode
- }
- buf = buf[n:]
- list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
- }
- return n, nil
- }
- if wtyp != protowire.Fixed64Type {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeFixed64(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
- return n, nil
- case protoreflect.StringKind:
- if wtyp != protowire.BytesType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
- return 0, errors.InvalidUTF8(string(fd.FullName()))
- }
- list.Append(protoreflect.ValueOfString(string(v)))
- return n, nil
- case protoreflect.BytesKind:
- if wtyp != protowire.BytesType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
- return n, nil
- case protoreflect.MessageKind:
- if wtyp != protowire.BytesType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeBytes(b)
- if n < 0 {
- return 0, errDecode
- }
- m := list.NewElement()
- if err := o.unmarshalMessage(v, m.Message()); err != nil {
- return 0, err
- }
- list.Append(m)
- return n, nil
- case protoreflect.GroupKind:
- if wtyp != protowire.StartGroupType {
- return 0, errUnknown
- }
- v, n := protowire.ConsumeGroup(fd.Number(), b)
- if n < 0 {
- return 0, errDecode
- }
- m := list.NewElement()
- if err := o.unmarshalMessage(v, m.Message()); err != nil {
- return 0, err
- }
- list.Append(m)
- return n, nil
- default:
- return 0, errUnknown
- }
-}
-
-// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.
-var emptyBuf [0]byte
diff --git a/vendor/google.golang.org/protobuf/proto/doc.go b/vendor/google.golang.org/protobuf/proto/doc.go
deleted file mode 100644
index 80ed16a..0000000
--- a/vendor/google.golang.org/protobuf/proto/doc.go
+++ /dev/null
@@ -1,86 +0,0 @@
-// 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.
-
-// Package proto provides functions operating on protocol buffer messages.
-//
-// For documentation on protocol buffers in general, see:
-// https://protobuf.dev.
-//
-// For a tutorial on using protocol buffers with Go, see:
-// https://protobuf.dev/getting-started/gotutorial.
-//
-// For a guide to generated Go protocol buffer code, see:
-// https://protobuf.dev/reference/go/go-generated.
-//
-// # Binary serialization
-//
-// This package contains functions to convert to and from the wire format,
-// an efficient binary serialization of protocol buffers.
-//
-// - [Size] reports the size of a message in the wire format.
-//
-// - [Marshal] converts a message to the wire format.
-// The [MarshalOptions] type provides more control over wire marshaling.
-//
-// - [Unmarshal] converts a message from the wire format.
-// The [UnmarshalOptions] type provides more control over wire unmarshaling.
-//
-// # Basic message operations
-//
-// - [Clone] makes a deep copy of a message.
-//
-// - [Merge] merges the content of a message into another.
-//
-// - [Equal] compares two messages. For more control over comparisons
-// and detailed reporting of differences, see package
-// [google.golang.org/protobuf/testing/protocmp].
-//
-// - [Reset] clears the content of a message.
-//
-// - [CheckInitialized] reports whether all required fields in a message are set.
-//
-// # Optional scalar constructors
-//
-// The API for some generated messages represents optional scalar fields
-// as pointers to a value. For example, an optional string field has the
-// Go type *string.
-//
-// - [Bool], [Int32], [Int64], [Uint32], [Uint64], [Float32], [Float64], and [String]
-// take a value and return a pointer to a new instance of it,
-// to simplify construction of optional field values.
-//
-// Generated enum types usually have an Enum method which performs the
-// same operation.
-//
-// Optional scalar fields are only supported in proto2.
-//
-// # Extension accessors
-//
-// - [HasExtension], [GetExtension], [SetExtension], and [ClearExtension]
-// access extension field values in a protocol buffer message.
-//
-// Extension fields are only supported in proto2.
-//
-// # Related packages
-//
-// - Package [google.golang.org/protobuf/encoding/protojson] converts messages to
-// and from JSON.
-//
-// - Package [google.golang.org/protobuf/encoding/prototext] converts messages to
-// and from the text format.
-//
-// - Package [google.golang.org/protobuf/reflect/protoreflect] provides a
-// reflection interface for protocol buffer data types.
-//
-// - Package [google.golang.org/protobuf/testing/protocmp] provides features
-// to compare protocol buffer messages with the [github.com/google/go-cmp/cmp]
-// package.
-//
-// - Package [google.golang.org/protobuf/types/dynamicpb] provides a dynamic
-// message type, suitable for working with messages where the protocol buffer
-// type is only known at runtime.
-//
-// This module contains additional packages for more specialized use cases.
-// Consult the individual package documentation for details.
-package proto
diff --git a/vendor/google.golang.org/protobuf/proto/encode.go b/vendor/google.golang.org/protobuf/proto/encode.go
deleted file mode 100644
index 4fed202..0000000
--- a/vendor/google.golang.org/protobuf/proto/encode.go
+++ /dev/null
@@ -1,322 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/order"
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// MarshalOptions configures the marshaler.
-//
-// Example usage:
-//
-// b, err := MarshalOptions{Deterministic: true}.Marshal(m)
-type MarshalOptions struct {
- pragma.NoUnkeyedLiterals
-
- // AllowPartial allows messages that have missing required fields to marshal
- // without returning an error. If AllowPartial is false (the default),
- // Marshal will return an error if there are any missing required fields.
- AllowPartial bool
-
- // Deterministic controls whether the same message will always be
- // serialized to the same bytes within the same binary.
- //
- // Setting this option guarantees that repeated serialization of
- // the same message will return the same bytes, and that different
- // processes of the same binary (which may be executing on different
- // machines) will serialize equal messages to the same bytes.
- // It has no effect on the resulting size of the encoded message compared
- // to a non-deterministic marshal.
- //
- // Note that the deterministic serialization is NOT canonical across
- // languages. It is not guaranteed to remain stable over time. It is
- // unstable across different builds with schema changes due to unknown
- // fields. Users who need canonical serialization (e.g., persistent
- // storage in a canonical form, fingerprinting, etc.) must define
- // their own canonicalization specification and implement their own
- // serializer rather than relying on this API.
- //
- // If deterministic serialization is requested, map entries will be
- // sorted by keys in lexographical order. This is an implementation
- // detail and subject to change.
- Deterministic bool
-
- // UseCachedSize indicates that the result of a previous Size call
- // may be reused.
- //
- // Setting this option asserts that:
- //
- // 1. Size has previously been called on this message with identical
- // options (except for UseCachedSize itself).
- //
- // 2. The message and all its submessages have not changed in any
- // way since the Size call.
- //
- // If either of these invariants is violated,
- // the results are undefined and may include panics or corrupted output.
- //
- // Implementations MAY take this option into account to provide
- // better performance, but there is no guarantee that they will do so.
- // There is absolutely no guarantee that Size followed by Marshal with
- // UseCachedSize set will perform equivalently to Marshal alone.
- UseCachedSize bool
-}
-
-// Marshal returns the wire-format encoding of m.
-func Marshal(m Message) ([]byte, error) {
- // Treat nil message interface as an empty message; nothing to output.
- if m == nil {
- return nil, nil
- }
-
- out, err := MarshalOptions{}.marshal(nil, m.ProtoReflect())
- if len(out.Buf) == 0 && err == nil {
- out.Buf = emptyBytesForMessage(m)
- }
- return out.Buf, err
-}
-
-// Marshal returns the wire-format encoding of m.
-func (o MarshalOptions) Marshal(m Message) ([]byte, error) {
- // Treat nil message interface as an empty message; nothing to output.
- if m == nil {
- return nil, nil
- }
-
- out, err := o.marshal(nil, m.ProtoReflect())
- if len(out.Buf) == 0 && err == nil {
- out.Buf = emptyBytesForMessage(m)
- }
- return out.Buf, err
-}
-
-// emptyBytesForMessage returns a nil buffer if and only if m is invalid,
-// otherwise it returns a non-nil empty buffer.
-//
-// This is to assist the edge-case where user-code does the following:
-//
-// m1.OptionalBytes, _ = proto.Marshal(m2)
-//
-// where they expect the proto2 "optional_bytes" field to be populated
-// if any only if m2 is a valid message.
-func emptyBytesForMessage(m Message) []byte {
- if m == nil || !m.ProtoReflect().IsValid() {
- return nil
- }
- return emptyBuf[:]
-}
-
-// MarshalAppend appends the wire-format encoding of m to b,
-// returning the result.
-func (o MarshalOptions) MarshalAppend(b []byte, m Message) ([]byte, error) {
- // Treat nil message interface as an empty message; nothing to append.
- if m == nil {
- return b, nil
- }
-
- out, err := o.marshal(b, m.ProtoReflect())
- return out.Buf, err
-}
-
-// MarshalState returns the wire-format encoding of a message.
-//
-// This method permits fine-grained control over the marshaler.
-// Most users should use [Marshal] instead.
-func (o MarshalOptions) MarshalState(in protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
- return o.marshal(in.Buf, in.Message)
-}
-
-// marshal is a centralized function that all marshal operations go through.
-// For profiling purposes, avoid changing the name of this function or
-// introducing other code paths for marshal that do not go through this.
-func (o MarshalOptions) marshal(b []byte, m protoreflect.Message) (out protoiface.MarshalOutput, err error) {
- allowPartial := o.AllowPartial
- o.AllowPartial = true
- if methods := protoMethods(m); methods != nil && methods.Marshal != nil &&
- !(o.Deterministic && methods.Flags&protoiface.SupportMarshalDeterministic == 0) {
- in := protoiface.MarshalInput{
- Message: m,
- Buf: b,
- }
- if o.Deterministic {
- in.Flags |= protoiface.MarshalDeterministic
- }
- if o.UseCachedSize {
- in.Flags |= protoiface.MarshalUseCachedSize
- }
- if methods.Size != nil {
- sout := methods.Size(protoiface.SizeInput{
- Message: m,
- Flags: in.Flags,
- })
- if cap(b) < len(b)+sout.Size {
- in.Buf = make([]byte, len(b), growcap(cap(b), len(b)+sout.Size))
- copy(in.Buf, b)
- }
- in.Flags |= protoiface.MarshalUseCachedSize
- }
- out, err = methods.Marshal(in)
- } else {
- out.Buf, err = o.marshalMessageSlow(b, m)
- }
- if err != nil {
- return out, err
- }
- if allowPartial {
- return out, nil
- }
- return out, checkInitialized(m)
-}
-
-func (o MarshalOptions) marshalMessage(b []byte, m protoreflect.Message) ([]byte, error) {
- out, err := o.marshal(b, m)
- return out.Buf, err
-}
-
-// growcap scales up the capacity of a slice.
-//
-// Given a slice with a current capacity of oldcap and a desired
-// capacity of wantcap, growcap returns a new capacity >= wantcap.
-//
-// The algorithm is mostly identical to the one used by append as of Go 1.14.
-func growcap(oldcap, wantcap int) (newcap int) {
- if wantcap > oldcap*2 {
- newcap = wantcap
- } else if oldcap < 1024 {
- // The Go 1.14 runtime takes this case when len(s) < 1024,
- // not when cap(s) < 1024. The difference doesn't seem
- // significant here.
- newcap = oldcap * 2
- } else {
- newcap = oldcap
- for 0 < newcap && newcap < wantcap {
- newcap += newcap / 4
- }
- if newcap <= 0 {
- newcap = wantcap
- }
- }
- return newcap
-}
-
-func (o MarshalOptions) marshalMessageSlow(b []byte, m protoreflect.Message) ([]byte, error) {
- if messageset.IsMessageSet(m.Descriptor()) {
- return o.marshalMessageSet(b, m)
- }
- fieldOrder := order.AnyFieldOrder
- if o.Deterministic {
- // TODO: This should use a more natural ordering like NumberFieldOrder,
- // but doing so breaks golden tests that make invalid assumption about
- // output stability of this implementation.
- fieldOrder = order.LegacyFieldOrder
- }
- var err error
- order.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- b, err = o.marshalField(b, fd, v)
- return err == nil
- })
- if err != nil {
- return b, err
- }
- b = append(b, m.GetUnknown()...)
- return b, nil
-}
-
-func (o MarshalOptions) marshalField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
- switch {
- case fd.IsList():
- return o.marshalList(b, fd, value.List())
- case fd.IsMap():
- return o.marshalMap(b, fd, value.Map())
- default:
- b = protowire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()])
- return o.marshalSingular(b, fd, value)
- }
-}
-
-func (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, list protoreflect.List) ([]byte, error) {
- if fd.IsPacked() && list.Len() > 0 {
- b = protowire.AppendTag(b, fd.Number(), protowire.BytesType)
- b, pos := appendSpeculativeLength(b)
- for i, llen := 0, list.Len(); i < llen; i++ {
- var err error
- b, err = o.marshalSingular(b, fd, list.Get(i))
- if err != nil {
- return b, err
- }
- }
- b = finishSpeculativeLength(b, pos)
- return b, nil
- }
-
- kind := fd.Kind()
- for i, llen := 0, list.Len(); i < llen; i++ {
- var err error
- b = protowire.AppendTag(b, fd.Number(), wireTypes[kind])
- b, err = o.marshalSingular(b, fd, list.Get(i))
- if err != nil {
- return b, err
- }
- }
- return b, nil
-}
-
-func (o MarshalOptions) marshalMap(b []byte, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) ([]byte, error) {
- keyf := fd.MapKey()
- valf := fd.MapValue()
- keyOrder := order.AnyKeyOrder
- if o.Deterministic {
- keyOrder = order.GenericKeyOrder
- }
- var err error
- order.RangeEntries(mapv, keyOrder, func(key protoreflect.MapKey, value protoreflect.Value) bool {
- b = protowire.AppendTag(b, fd.Number(), protowire.BytesType)
- var pos int
- b, pos = appendSpeculativeLength(b)
-
- b, err = o.marshalField(b, keyf, key.Value())
- if err != nil {
- return false
- }
- b, err = o.marshalField(b, valf, value)
- if err != nil {
- return false
- }
- b = finishSpeculativeLength(b, pos)
- return true
- })
- return b, err
-}
-
-// When encoding length-prefixed fields, we speculatively set aside some number of bytes
-// for the length, encode the data, and then encode the length (shifting the data if necessary
-// to make room).
-const speculativeLength = 1
-
-func appendSpeculativeLength(b []byte) ([]byte, int) {
- pos := len(b)
- b = append(b, "\x00\x00\x00\x00"[:speculativeLength]...)
- return b, pos
-}
-
-func finishSpeculativeLength(b []byte, pos int) []byte {
- mlen := len(b) - pos - speculativeLength
- msiz := protowire.SizeVarint(uint64(mlen))
- if msiz != speculativeLength {
- for i := 0; i < msiz-speculativeLength; i++ {
- b = append(b, 0)
- }
- copy(b[pos+msiz:], b[pos+speculativeLength:])
- b = b[:pos+msiz+mlen]
- }
- protowire.AppendVarint(b[:pos], uint64(mlen))
- return b
-}
diff --git a/vendor/google.golang.org/protobuf/proto/encode_gen.go b/vendor/google.golang.org/protobuf/proto/encode_gen.go
deleted file mode 100644
index 185dacf..0000000
--- a/vendor/google.golang.org/protobuf/proto/encode_gen.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package proto
-
-import (
- "math"
- "unicode/utf8"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/strs"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-var wireTypes = map[protoreflect.Kind]protowire.Type{
- protoreflect.BoolKind: protowire.VarintType,
- protoreflect.EnumKind: protowire.VarintType,
- protoreflect.Int32Kind: protowire.VarintType,
- protoreflect.Sint32Kind: protowire.VarintType,
- protoreflect.Uint32Kind: protowire.VarintType,
- protoreflect.Int64Kind: protowire.VarintType,
- protoreflect.Sint64Kind: protowire.VarintType,
- protoreflect.Uint64Kind: protowire.VarintType,
- protoreflect.Sfixed32Kind: protowire.Fixed32Type,
- protoreflect.Fixed32Kind: protowire.Fixed32Type,
- protoreflect.FloatKind: protowire.Fixed32Type,
- protoreflect.Sfixed64Kind: protowire.Fixed64Type,
- protoreflect.Fixed64Kind: protowire.Fixed64Type,
- protoreflect.DoubleKind: protowire.Fixed64Type,
- protoreflect.StringKind: protowire.BytesType,
- protoreflect.BytesKind: protowire.BytesType,
- protoreflect.MessageKind: protowire.BytesType,
- protoreflect.GroupKind: protowire.StartGroupType,
-}
-
-func (o MarshalOptions) marshalSingular(b []byte, fd protoreflect.FieldDescriptor, v protoreflect.Value) ([]byte, error) {
- switch fd.Kind() {
- case protoreflect.BoolKind:
- b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
- case protoreflect.EnumKind:
- b = protowire.AppendVarint(b, uint64(v.Enum()))
- case protoreflect.Int32Kind:
- b = protowire.AppendVarint(b, uint64(int32(v.Int())))
- case protoreflect.Sint32Kind:
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
- case protoreflect.Uint32Kind:
- b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
- case protoreflect.Int64Kind:
- b = protowire.AppendVarint(b, uint64(v.Int()))
- case protoreflect.Sint64Kind:
- b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
- case protoreflect.Uint64Kind:
- b = protowire.AppendVarint(b, v.Uint())
- case protoreflect.Sfixed32Kind:
- b = protowire.AppendFixed32(b, uint32(v.Int()))
- case protoreflect.Fixed32Kind:
- b = protowire.AppendFixed32(b, uint32(v.Uint()))
- case protoreflect.FloatKind:
- b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
- case protoreflect.Sfixed64Kind:
- b = protowire.AppendFixed64(b, uint64(v.Int()))
- case protoreflect.Fixed64Kind:
- b = protowire.AppendFixed64(b, v.Uint())
- case protoreflect.DoubleKind:
- b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
- case protoreflect.StringKind:
- if strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) {
- return b, errors.InvalidUTF8(string(fd.FullName()))
- }
- b = protowire.AppendString(b, v.String())
- case protoreflect.BytesKind:
- b = protowire.AppendBytes(b, v.Bytes())
- case protoreflect.MessageKind:
- var pos int
- var err error
- b, pos = appendSpeculativeLength(b)
- b, err = o.marshalMessage(b, v.Message())
- if err != nil {
- return b, err
- }
- b = finishSpeculativeLength(b, pos)
- case protoreflect.GroupKind:
- var err error
- b, err = o.marshalMessage(b, v.Message())
- if err != nil {
- return b, err
- }
- b = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType))
- default:
- return b, errors.New("invalid kind %v", fd.Kind())
- }
- return b, nil
-}
diff --git a/vendor/google.golang.org/protobuf/proto/equal.go b/vendor/google.golang.org/protobuf/proto/equal.go
deleted file mode 100644
index 1a0be1b..0000000
--- a/vendor/google.golang.org/protobuf/proto/equal.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "reflect"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// Equal reports whether two messages are equal,
-// by recursively comparing the fields of the message.
-//
-// - Bytes fields are equal if they contain identical bytes.
-// Empty bytes (regardless of nil-ness) are considered equal.
-//
-// - Floating-point fields are equal if they contain the same value.
-// Unlike the == operator, a NaN is equal to another NaN.
-//
-// - Other scalar fields are equal if they contain the same value.
-//
-// - Message fields are equal if they have
-// the same set of populated known and extension field values, and
-// the same set of unknown fields values.
-//
-// - Lists are equal if they are the same length and
-// each corresponding element is equal.
-//
-// - Maps are equal if they have the same set of keys and
-// the corresponding value for each key is equal.
-//
-// An invalid message is not equal to a valid message.
-// An invalid message is only equal to another invalid message of the
-// same type. An invalid message often corresponds to a nil pointer
-// of the concrete message type. For example, (*pb.M)(nil) is not equal
-// to &pb.M{}.
-// If two valid messages marshal to the same bytes under deterministic
-// serialization, then Equal is guaranteed to report true.
-func Equal(x, y Message) bool {
- if x == nil || y == nil {
- return x == nil && y == nil
- }
- if reflect.TypeOf(x).Kind() == reflect.Ptr && x == y {
- // Avoid an expensive comparison if both inputs are identical pointers.
- return true
- }
- mx := x.ProtoReflect()
- my := y.ProtoReflect()
- if mx.IsValid() != my.IsValid() {
- return false
- }
- vx := protoreflect.ValueOfMessage(mx)
- vy := protoreflect.ValueOfMessage(my)
- return vx.Equal(vy)
-}
diff --git a/vendor/google.golang.org/protobuf/proto/extension.go b/vendor/google.golang.org/protobuf/proto/extension.go
deleted file mode 100644
index 17899a3..0000000
--- a/vendor/google.golang.org/protobuf/proto/extension.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// HasExtension reports whether an extension field is populated.
-// It returns false if m is invalid or if xt does not extend m.
-func HasExtension(m Message, xt protoreflect.ExtensionType) bool {
- // Treat nil message interface as an empty message; no populated fields.
- if m == nil {
- return false
- }
-
- // As a special-case, we reports invalid or mismatching descriptors
- // as always not being populated (since they aren't).
- if xt == nil || m.ProtoReflect().Descriptor() != xt.TypeDescriptor().ContainingMessage() {
- return false
- }
-
- return m.ProtoReflect().Has(xt.TypeDescriptor())
-}
-
-// ClearExtension clears an extension field such that subsequent
-// [HasExtension] calls return false.
-// It panics if m is invalid or if xt does not extend m.
-func ClearExtension(m Message, xt protoreflect.ExtensionType) {
- m.ProtoReflect().Clear(xt.TypeDescriptor())
-}
-
-// GetExtension retrieves the value for an extension field.
-// If the field is unpopulated, it returns the default value for
-// scalars and an immutable, empty value for lists or messages.
-// It panics if xt does not extend m.
-func GetExtension(m Message, xt protoreflect.ExtensionType) interface{} {
- // Treat nil message interface as an empty message; return the default.
- if m == nil {
- return xt.InterfaceOf(xt.Zero())
- }
-
- return xt.InterfaceOf(m.ProtoReflect().Get(xt.TypeDescriptor()))
-}
-
-// SetExtension stores the value of an extension field.
-// It panics if m is invalid, xt does not extend m, or if type of v
-// is invalid for the specified extension field.
-func SetExtension(m Message, xt protoreflect.ExtensionType, v interface{}) {
- xd := xt.TypeDescriptor()
- pv := xt.ValueOf(v)
-
- // Specially treat an invalid list, map, or message as clear.
- isValid := true
- switch {
- case xd.IsList():
- isValid = pv.List().IsValid()
- case xd.IsMap():
- isValid = pv.Map().IsValid()
- case xd.Message() != nil:
- isValid = pv.Message().IsValid()
- }
- if !isValid {
- m.ProtoReflect().Clear(xd)
- return
- }
-
- m.ProtoReflect().Set(xd, pv)
-}
-
-// RangeExtensions iterates over every populated extension field in m in an
-// undefined order, calling f for each extension type and value encountered.
-// It returns immediately if f returns false.
-// While iterating, mutating operations may only be performed
-// on the current extension field.
-func RangeExtensions(m Message, f func(protoreflect.ExtensionType, interface{}) bool) {
- // Treat nil message interface as an empty message; nothing to range over.
- if m == nil {
- return
- }
-
- m.ProtoReflect().Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- if fd.IsExtension() {
- xt := fd.(protoreflect.ExtensionTypeDescriptor).Type()
- vi := xt.InterfaceOf(v)
- return f(xt, vi)
- }
- return true
- })
-}
diff --git a/vendor/google.golang.org/protobuf/proto/merge.go b/vendor/google.golang.org/protobuf/proto/merge.go
deleted file mode 100644
index 3c6fe57..0000000
--- a/vendor/google.golang.org/protobuf/proto/merge.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "fmt"
-
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// Merge merges src into dst, which must be a message with the same descriptor.
-//
-// Populated scalar fields in src are copied to dst, while populated
-// singular messages in src are merged into dst by recursively calling Merge.
-// The elements of every list field in src is appended to the corresponded
-// list fields in dst. The entries of every map field in src is copied into
-// the corresponding map field in dst, possibly replacing existing entries.
-// The unknown fields of src are appended to the unknown fields of dst.
-//
-// It is semantically equivalent to unmarshaling the encoded form of src
-// into dst with the [UnmarshalOptions.Merge] option specified.
-func Merge(dst, src Message) {
- // TODO: Should nil src be treated as semantically equivalent to a
- // untyped, read-only, empty message? What about a nil dst?
-
- dstMsg, srcMsg := dst.ProtoReflect(), src.ProtoReflect()
- if dstMsg.Descriptor() != srcMsg.Descriptor() {
- if got, want := dstMsg.Descriptor().FullName(), srcMsg.Descriptor().FullName(); got != want {
- panic(fmt.Sprintf("descriptor mismatch: %v != %v", got, want))
- }
- panic("descriptor mismatch")
- }
- mergeOptions{}.mergeMessage(dstMsg, srcMsg)
-}
-
-// Clone returns a deep copy of m.
-// If the top-level message is invalid, it returns an invalid message as well.
-func Clone(m Message) Message {
- // NOTE: Most usages of Clone assume the following properties:
- // t := reflect.TypeOf(m)
- // t == reflect.TypeOf(m.ProtoReflect().New().Interface())
- // t == reflect.TypeOf(m.ProtoReflect().Type().Zero().Interface())
- //
- // Embedding protobuf messages breaks this since the parent type will have
- // a forwarded ProtoReflect method, but the Interface method will return
- // the underlying embedded message type.
- if m == nil {
- return nil
- }
- src := m.ProtoReflect()
- if !src.IsValid() {
- return src.Type().Zero().Interface()
- }
- dst := src.New()
- mergeOptions{}.mergeMessage(dst, src)
- return dst.Interface()
-}
-
-// mergeOptions provides a namespace for merge functions, and can be
-// exported in the future if we add user-visible merge options.
-type mergeOptions struct{}
-
-func (o mergeOptions) mergeMessage(dst, src protoreflect.Message) {
- methods := protoMethods(dst)
- if methods != nil && methods.Merge != nil {
- in := protoiface.MergeInput{
- Destination: dst,
- Source: src,
- }
- out := methods.Merge(in)
- if out.Flags&protoiface.MergeComplete != 0 {
- return
- }
- }
-
- if !dst.IsValid() {
- panic(fmt.Sprintf("cannot merge into invalid %v message", dst.Descriptor().FullName()))
- }
-
- src.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- switch {
- case fd.IsList():
- o.mergeList(dst.Mutable(fd).List(), v.List(), fd)
- case fd.IsMap():
- o.mergeMap(dst.Mutable(fd).Map(), v.Map(), fd.MapValue())
- case fd.Message() != nil:
- o.mergeMessage(dst.Mutable(fd).Message(), v.Message())
- case fd.Kind() == protoreflect.BytesKind:
- dst.Set(fd, o.cloneBytes(v))
- default:
- dst.Set(fd, v)
- }
- return true
- })
-
- if len(src.GetUnknown()) > 0 {
- dst.SetUnknown(append(dst.GetUnknown(), src.GetUnknown()...))
- }
-}
-
-func (o mergeOptions) mergeList(dst, src protoreflect.List, fd protoreflect.FieldDescriptor) {
- // Merge semantics appends to the end of the existing list.
- for i, n := 0, src.Len(); i < n; i++ {
- switch v := src.Get(i); {
- case fd.Message() != nil:
- dstv := dst.NewElement()
- o.mergeMessage(dstv.Message(), v.Message())
- dst.Append(dstv)
- case fd.Kind() == protoreflect.BytesKind:
- dst.Append(o.cloneBytes(v))
- default:
- dst.Append(v)
- }
- }
-}
-
-func (o mergeOptions) mergeMap(dst, src protoreflect.Map, fd protoreflect.FieldDescriptor) {
- // Merge semantics replaces, rather than merges into existing entries.
- src.Range(func(k protoreflect.MapKey, v protoreflect.Value) bool {
- switch {
- case fd.Message() != nil:
- dstv := dst.NewValue()
- o.mergeMessage(dstv.Message(), v.Message())
- dst.Set(k, dstv)
- case fd.Kind() == protoreflect.BytesKind:
- dst.Set(k, o.cloneBytes(v))
- default:
- dst.Set(k, v)
- }
- return true
- })
-}
-
-func (o mergeOptions) cloneBytes(v protoreflect.Value) protoreflect.Value {
- return protoreflect.ValueOfBytes(append([]byte{}, v.Bytes()...))
-}
diff --git a/vendor/google.golang.org/protobuf/proto/messageset.go b/vendor/google.golang.org/protobuf/proto/messageset.go
deleted file mode 100644
index 312d5d4..0000000
--- a/vendor/google.golang.org/protobuf/proto/messageset.go
+++ /dev/null
@@ -1,93 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/internal/flags"
- "google.golang.org/protobuf/internal/order"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/reflect/protoregistry"
-)
-
-func (o MarshalOptions) sizeMessageSet(m protoreflect.Message) (size int) {
- m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- size += messageset.SizeField(fd.Number())
- size += protowire.SizeTag(messageset.FieldMessage)
- size += protowire.SizeBytes(o.size(v.Message()))
- return true
- })
- size += messageset.SizeUnknown(m.GetUnknown())
- return size
-}
-
-func (o MarshalOptions) marshalMessageSet(b []byte, m protoreflect.Message) ([]byte, error) {
- if !flags.ProtoLegacy {
- return b, errors.New("no support for message_set_wire_format")
- }
- fieldOrder := order.AnyFieldOrder
- if o.Deterministic {
- fieldOrder = order.NumberFieldOrder
- }
- var err error
- order.RangeFields(m, fieldOrder, func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- b, err = o.marshalMessageSetField(b, fd, v)
- return err == nil
- })
- if err != nil {
- return b, err
- }
- return messageset.AppendUnknown(b, m.GetUnknown())
-}
-
-func (o MarshalOptions) marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value) ([]byte, error) {
- b = messageset.AppendFieldStart(b, fd.Number())
- b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
- b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
- b, err := o.marshalMessage(b, value.Message())
- if err != nil {
- return b, err
- }
- b = messageset.AppendFieldEnd(b)
- return b, nil
-}
-
-func (o UnmarshalOptions) unmarshalMessageSet(b []byte, m protoreflect.Message) error {
- if !flags.ProtoLegacy {
- return errors.New("no support for message_set_wire_format")
- }
- return messageset.Unmarshal(b, false, func(num protowire.Number, v []byte) error {
- err := o.unmarshalMessageSetField(m, num, v)
- if err == errUnknown {
- unknown := m.GetUnknown()
- unknown = protowire.AppendTag(unknown, num, protowire.BytesType)
- unknown = protowire.AppendBytes(unknown, v)
- m.SetUnknown(unknown)
- return nil
- }
- return err
- })
-}
-
-func (o UnmarshalOptions) unmarshalMessageSetField(m protoreflect.Message, num protowire.Number, v []byte) error {
- md := m.Descriptor()
- if !md.ExtensionRanges().Has(num) {
- return errUnknown
- }
- xt, err := o.Resolver.FindExtensionByNumber(md.FullName(), num)
- if err == protoregistry.NotFound {
- return errUnknown
- }
- if err != nil {
- return errors.New("%v: unable to resolve extension %v: %v", md.FullName(), num, err)
- }
- xd := xt.TypeDescriptor()
- if err := o.unmarshalMessage(v, m.Mutable(xd).Message()); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/google.golang.org/protobuf/proto/proto.go b/vendor/google.golang.org/protobuf/proto/proto.go
deleted file mode 100644
index 7543ee6..0000000
--- a/vendor/google.golang.org/protobuf/proto/proto.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2018 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/internal/errors"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// Message is the top-level interface that all messages must implement.
-// It provides access to a reflective view of a message.
-// Any implementation of this interface may be used with all functions in the
-// protobuf module that accept a Message, except where otherwise specified.
-//
-// This is the v2 interface definition for protobuf messages.
-// The v1 interface definition is [github.com/golang/protobuf/proto.Message].
-//
-// - To convert a v1 message to a v2 message,
-// use [google.golang.org/protobuf/protoadapt.MessageV2Of].
-// - To convert a v2 message to a v1 message,
-// use [google.golang.org/protobuf/protoadapt.MessageV1Of].
-type Message = protoreflect.ProtoMessage
-
-// Error matches all errors produced by packages in the protobuf module
-// according to [errors.Is].
-//
-// Example usage:
-//
-// if errors.Is(err, proto.Error) { ... }
-var Error error
-
-func init() {
- Error = errors.Error
-}
-
-// MessageName returns the full name of m.
-// If m is nil, it returns an empty string.
-func MessageName(m Message) protoreflect.FullName {
- if m == nil {
- return ""
- }
- return m.ProtoReflect().Descriptor().FullName()
-}
diff --git a/vendor/google.golang.org/protobuf/proto/proto_methods.go b/vendor/google.golang.org/protobuf/proto/proto_methods.go
deleted file mode 100644
index 465e057..0000000
--- a/vendor/google.golang.org/protobuf/proto/proto_methods.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// The protoreflect build tag disables use of fast-path methods.
-//go:build !protoreflect
-// +build !protoreflect
-
-package proto
-
-import (
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-const hasProtoMethods = true
-
-func protoMethods(m protoreflect.Message) *protoiface.Methods {
- return m.ProtoMethods()
-}
diff --git a/vendor/google.golang.org/protobuf/proto/proto_reflect.go b/vendor/google.golang.org/protobuf/proto/proto_reflect.go
deleted file mode 100644
index 494d6ce..0000000
--- a/vendor/google.golang.org/protobuf/proto/proto_reflect.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// The protoreflect build tag disables use of fast-path methods.
-//go:build protoreflect
-// +build protoreflect
-
-package proto
-
-import (
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-const hasProtoMethods = false
-
-func protoMethods(m protoreflect.Message) *protoiface.Methods {
- return nil
-}
diff --git a/vendor/google.golang.org/protobuf/proto/reset.go b/vendor/google.golang.org/protobuf/proto/reset.go
deleted file mode 100644
index 3d7f894..0000000
--- a/vendor/google.golang.org/protobuf/proto/reset.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "fmt"
-
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// Reset clears every field in the message.
-// The resulting message shares no observable memory with its previous state
-// other than the memory for the message itself.
-func Reset(m Message) {
- if mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods {
- mr.Reset()
- return
- }
- resetMessage(m.ProtoReflect())
-}
-
-func resetMessage(m protoreflect.Message) {
- if !m.IsValid() {
- panic(fmt.Sprintf("cannot reset invalid %v message", m.Descriptor().FullName()))
- }
-
- // Clear all known fields.
- fds := m.Descriptor().Fields()
- for i := 0; i < fds.Len(); i++ {
- m.Clear(fds.Get(i))
- }
-
- // Clear extension fields.
- m.Range(func(fd protoreflect.FieldDescriptor, _ protoreflect.Value) bool {
- m.Clear(fd)
- return true
- })
-
- // Clear unknown fields.
- m.SetUnknown(nil)
-}
diff --git a/vendor/google.golang.org/protobuf/proto/size.go b/vendor/google.golang.org/protobuf/proto/size.go
deleted file mode 100644
index f1692b4..0000000
--- a/vendor/google.golang.org/protobuf/proto/size.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// 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.
-
-package proto
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/reflect/protoreflect"
- "google.golang.org/protobuf/runtime/protoiface"
-)
-
-// Size returns the size in bytes of the wire-format encoding of m.
-func Size(m Message) int {
- return MarshalOptions{}.Size(m)
-}
-
-// Size returns the size in bytes of the wire-format encoding of m.
-func (o MarshalOptions) Size(m Message) int {
- // Treat a nil message interface as an empty message; nothing to output.
- if m == nil {
- return 0
- }
-
- return o.size(m.ProtoReflect())
-}
-
-// size is a centralized function that all size operations go through.
-// For profiling purposes, avoid changing the name of this function or
-// introducing other code paths for size that do not go through this.
-func (o MarshalOptions) size(m protoreflect.Message) (size int) {
- methods := protoMethods(m)
- if methods != nil && methods.Size != nil {
- out := methods.Size(protoiface.SizeInput{
- Message: m,
- })
- return out.Size
- }
- if methods != nil && methods.Marshal != nil {
- // This is not efficient, but we don't have any choice.
- // This case is mainly used for legacy types with a Marshal method.
- out, _ := methods.Marshal(protoiface.MarshalInput{
- Message: m,
- })
- return len(out.Buf)
- }
- return o.sizeMessageSlow(m)
-}
-
-func (o MarshalOptions) sizeMessageSlow(m protoreflect.Message) (size int) {
- if messageset.IsMessageSet(m.Descriptor()) {
- return o.sizeMessageSet(m)
- }
- m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
- size += o.sizeField(fd, v)
- return true
- })
- size += len(m.GetUnknown())
- return size
-}
-
-func (o MarshalOptions) sizeField(fd protoreflect.FieldDescriptor, value protoreflect.Value) (size int) {
- num := fd.Number()
- switch {
- case fd.IsList():
- return o.sizeList(num, fd, value.List())
- case fd.IsMap():
- return o.sizeMap(num, fd, value.Map())
- default:
- return protowire.SizeTag(num) + o.sizeSingular(num, fd.Kind(), value)
- }
-}
-
-func (o MarshalOptions) sizeList(num protowire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) {
- sizeTag := protowire.SizeTag(num)
-
- if fd.IsPacked() && list.Len() > 0 {
- content := 0
- for i, llen := 0, list.Len(); i < llen; i++ {
- content += o.sizeSingular(num, fd.Kind(), list.Get(i))
- }
- return sizeTag + protowire.SizeBytes(content)
- }
-
- for i, llen := 0, list.Len(); i < llen; i++ {
- size += sizeTag + o.sizeSingular(num, fd.Kind(), list.Get(i))
- }
- return size
-}
-
-func (o MarshalOptions) sizeMap(num protowire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) {
- sizeTag := protowire.SizeTag(num)
-
- mapv.Range(func(key protoreflect.MapKey, value protoreflect.Value) bool {
- size += sizeTag
- size += protowire.SizeBytes(o.sizeField(fd.MapKey(), key.Value()) + o.sizeField(fd.MapValue(), value))
- return true
- })
- return size
-}
diff --git a/vendor/google.golang.org/protobuf/proto/size_gen.go b/vendor/google.golang.org/protobuf/proto/size_gen.go
deleted file mode 100644
index 3cf61a8..0000000
--- a/vendor/google.golang.org/protobuf/proto/size_gen.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2018 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-types. DO NOT EDIT.
-
-package proto
-
-import (
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-func (o MarshalOptions) sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int {
- switch kind {
- case protoreflect.BoolKind:
- return protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
- case protoreflect.EnumKind:
- return protowire.SizeVarint(uint64(v.Enum()))
- case protoreflect.Int32Kind:
- return protowire.SizeVarint(uint64(int32(v.Int())))
- case protoreflect.Sint32Kind:
- return protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
- case protoreflect.Uint32Kind:
- return protowire.SizeVarint(uint64(uint32(v.Uint())))
- case protoreflect.Int64Kind:
- return protowire.SizeVarint(uint64(v.Int()))
- case protoreflect.Sint64Kind:
- return protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
- case protoreflect.Uint64Kind:
- return protowire.SizeVarint(v.Uint())
- case protoreflect.Sfixed32Kind:
- return protowire.SizeFixed32()
- case protoreflect.Fixed32Kind:
- return protowire.SizeFixed32()
- case protoreflect.FloatKind:
- return protowire.SizeFixed32()
- case protoreflect.Sfixed64Kind:
- return protowire.SizeFixed64()
- case protoreflect.Fixed64Kind:
- return protowire.SizeFixed64()
- case protoreflect.DoubleKind:
- return protowire.SizeFixed64()
- case protoreflect.StringKind:
- return protowire.SizeBytes(len(v.String()))
- case protoreflect.BytesKind:
- return protowire.SizeBytes(len(v.Bytes()))
- case protoreflect.MessageKind:
- return protowire.SizeBytes(o.size(v.Message()))
- case protoreflect.GroupKind:
- return protowire.SizeGroup(num, o.size(v.Message()))
- default:
- return 0
- }
-}
diff --git a/vendor/google.golang.org/protobuf/proto/wrappers.go b/vendor/google.golang.org/protobuf/proto/wrappers.go
deleted file mode 100644
index 653b12c..0000000
--- a/vendor/google.golang.org/protobuf/proto/wrappers.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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.
-
-package proto
-
-// Bool stores v in a new bool value and returns a pointer to it.
-func Bool(v bool) *bool { return &v }
-
-// Int32 stores v in a new int32 value and returns a pointer to it.
-func Int32(v int32) *int32 { return &v }
-
-// Int64 stores v in a new int64 value and returns a pointer to it.
-func Int64(v int64) *int64 { return &v }
-
-// Float32 stores v in a new float32 value and returns a pointer to it.
-func Float32(v float32) *float32 { return &v }
-
-// Float64 stores v in a new float64 value and returns a pointer to it.
-func Float64(v float64) *float64 { return &v }
-
-// Uint32 stores v in a new uint32 value and returns a pointer to it.
-func Uint32(v uint32) *uint32 { return &v }
-
-// Uint64 stores v in a new uint64 value and returns a pointer to it.
-func Uint64(v uint64) *uint64 { return &v }
-
-// String stores v in a new string value and returns a pointer to it.
-func String(v string) *string { return &v }
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
deleted file mode 100644
index d5d5af6..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2020 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.
-
-package protoreflect
-
-import (
- "google.golang.org/protobuf/internal/pragma"
-)
-
-// The following types are used by the fast-path Message.ProtoMethods method.
-//
-// To avoid polluting the public protoreflect API with types used only by
-// low-level implementations, the canonical definitions of these types are
-// in the runtime/protoiface package. The definitions here and in protoiface
-// must be kept in sync.
-type (
- methods = struct {
- pragma.NoUnkeyedLiterals
- Flags supportFlags
- Size func(sizeInput) sizeOutput
- Marshal func(marshalInput) (marshalOutput, error)
- Unmarshal func(unmarshalInput) (unmarshalOutput, error)
- Merge func(mergeInput) mergeOutput
- CheckInitialized func(checkInitializedInput) (checkInitializedOutput, error)
- }
- supportFlags = uint64
- sizeInput = struct {
- pragma.NoUnkeyedLiterals
- Message Message
- Flags uint8
- }
- sizeOutput = struct {
- pragma.NoUnkeyedLiterals
- Size int
- }
- marshalInput = struct {
- pragma.NoUnkeyedLiterals
- Message Message
- Buf []byte
- Flags uint8
- }
- marshalOutput = struct {
- pragma.NoUnkeyedLiterals
- Buf []byte
- }
- unmarshalInput = struct {
- pragma.NoUnkeyedLiterals
- Message Message
- Buf []byte
- Flags uint8
- Resolver interface {
- FindExtensionByName(field FullName) (ExtensionType, error)
- FindExtensionByNumber(message FullName, field FieldNumber) (ExtensionType, error)
- }
- Depth int
- }
- unmarshalOutput = struct {
- pragma.NoUnkeyedLiterals
- Flags uint8
- }
- mergeInput = struct {
- pragma.NoUnkeyedLiterals
- Source Message
- Destination Message
- }
- mergeOutput = struct {
- pragma.NoUnkeyedLiterals
- Flags uint8
- }
- checkInitializedInput = struct {
- pragma.NoUnkeyedLiterals
- Message Message
- }
- checkInitializedOutput = struct {
- pragma.NoUnkeyedLiterals
- }
-)
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
deleted file mode 100644
index ec6572d..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go
+++ /dev/null
@@ -1,511 +0,0 @@
-// Copyright 2018 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.
-
-// Package protoreflect provides interfaces to dynamically manipulate messages.
-//
-// This package includes type descriptors which describe the structure of types
-// defined in proto source files and value interfaces which provide the
-// ability to examine and manipulate the contents of messages.
-//
-// # Protocol Buffer Descriptors
-//
-// Protobuf descriptors (e.g., [EnumDescriptor] or [MessageDescriptor])
-// are immutable objects that represent protobuf type information.
-// They are wrappers around the messages declared in descriptor.proto.
-// Protobuf descriptors alone lack any information regarding Go types.
-//
-// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
-// where the Descriptor and ProtoReflect.Descriptor accessors respectively
-// return the protobuf descriptor for the values.
-//
-// The protobuf descriptor interfaces are not meant to be implemented by
-// user code since they might need to be extended in the future to support
-// additions to the protobuf language.
-// The [google.golang.org/protobuf/reflect/protodesc] package converts between
-// google.protobuf.DescriptorProto messages and protobuf descriptors.
-//
-// # Go Type Descriptors
-//
-// A type descriptor (e.g., [EnumType] or [MessageType]) is a constructor for
-// a concrete Go type that represents the associated protobuf descriptor.
-// There is commonly a one-to-one relationship between protobuf descriptors and
-// Go type descriptors, but it can potentially be a one-to-many relationship.
-//
-// Enums and messages generated by this module implement [Enum] and [ProtoMessage],
-// where the Type and ProtoReflect.Type accessors respectively
-// return the protobuf descriptor for the values.
-//
-// The [google.golang.org/protobuf/types/dynamicpb] package can be used to
-// create Go type descriptors from protobuf descriptors.
-//
-// # Value Interfaces
-//
-// The [Enum] and [Message] interfaces provide a reflective view over an
-// enum or message instance. For enums, it provides the ability to retrieve
-// the enum value number for any concrete enum type. For messages, it provides
-// the ability to access or manipulate fields of the message.
-//
-// To convert a [google.golang.org/protobuf/proto.Message] to a [protoreflect.Message], use the
-// former's ProtoReflect method. Since the ProtoReflect method is new to the
-// v2 message interface, it may not be present on older message implementations.
-// The [github.com/golang/protobuf/proto.MessageReflect] function can be used
-// to obtain a reflective view on older messages.
-//
-// # Relationships
-//
-// The following diagrams demonstrate the relationships between
-// various types declared in this package.
-//
-// ┌───────────────────────────────────┐
-// V │
-// ┌────────────── New(n) ─────────────┐ │
-// │ │ │
-// │ ┌──── Descriptor() ──┐ │ ┌── Number() ──┐ │
-// │ │ V V │ V │
-// ╔════════════╗ ╔════════════════╗ ╔════════╗ ╔════════════╗
-// ║ EnumType ║ ║ EnumDescriptor ║ ║ Enum ║ ║ EnumNumber ║
-// ╚════════════╝ ╚════════════════╝ ╚════════╝ ╚════════════╝
-// Λ Λ │ │
-// │ └─── Descriptor() ──┘ │
-// │ │
-// └────────────────── Type() ───────┘
-//
-// • An [EnumType] describes a concrete Go enum type.
-// It has an EnumDescriptor and can construct an Enum instance.
-//
-// • An [EnumDescriptor] describes an abstract protobuf enum type.
-//
-// • An [Enum] is a concrete enum instance. Generated enums implement Enum.
-//
-// ┌──────────────── New() ─────────────────┐
-// │ │
-// │ ┌─── Descriptor() ─────┐ │ ┌── Interface() ───┐
-// │ │ V V │ V
-// ╔═════════════╗ ╔═══════════════════╗ ╔═════════╗ ╔══════════════╗
-// ║ MessageType ║ ║ MessageDescriptor ║ ║ Message ║ ║ ProtoMessage ║
-// ╚═════════════╝ ╚═══════════════════╝ ╚═════════╝ ╚══════════════╝
-// Λ Λ │ │ Λ │
-// │ └──── Descriptor() ────┘ │ └─ ProtoReflect() ─┘
-// │ │
-// └─────────────────── Type() ─────────┘
-//
-// • A [MessageType] describes a concrete Go message type.
-// It has a [MessageDescriptor] and can construct a [Message] instance.
-// Just as how Go's [reflect.Type] is a reflective description of a Go type,
-// a [MessageType] is a reflective description of a Go type for a protobuf message.
-//
-// • A [MessageDescriptor] describes an abstract protobuf message type.
-// It has no understanding of Go types. In order to construct a [MessageType]
-// from just a [MessageDescriptor], you can consider looking up the message type
-// in the global registry using the FindMessageByName method on
-// [google.golang.org/protobuf/reflect/protoregistry.GlobalTypes]
-// or constructing a dynamic [MessageType] using
-// [google.golang.org/protobuf/types/dynamicpb.NewMessageType].
-//
-// • A [Message] is a reflective view over a concrete message instance.
-// Generated messages implement [ProtoMessage], which can convert to a [Message].
-// Just as how Go's [reflect.Value] is a reflective view over a Go value,
-// a [Message] is a reflective view over a concrete protobuf message instance.
-// Using Go reflection as an analogy, the [ProtoMessage.ProtoReflect] method is similar to
-// calling [reflect.ValueOf], and the [Message.Interface] method is similar to
-// calling [reflect.Value.Interface].
-//
-// ┌── TypeDescriptor() ──┐ ┌───── Descriptor() ─────┐
-// │ V │ V
-// ╔═══════════════╗ ╔═════════════════════════╗ ╔═════════════════════╗
-// ║ ExtensionType ║ ║ ExtensionTypeDescriptor ║ ║ ExtensionDescriptor ║
-// ╚═══════════════╝ ╚═════════════════════════╝ ╚═════════════════════╝
-// Λ │ │ Λ │ Λ
-// └─────── Type() ───────┘ │ └─── may implement ────┘ │
-// │ │
-// └────── implements ────────┘
-//
-// • An [ExtensionType] describes a concrete Go implementation of an extension.
-// It has an [ExtensionTypeDescriptor] and can convert to/from
-// an abstract [Value] and a Go value.
-//
-// • An [ExtensionTypeDescriptor] is an [ExtensionDescriptor]
-// which also has an [ExtensionType].
-//
-// • An [ExtensionDescriptor] describes an abstract protobuf extension field and
-// may not always be an [ExtensionTypeDescriptor].
-package protoreflect
-
-import (
- "fmt"
- "strings"
-
- "google.golang.org/protobuf/encoding/protowire"
- "google.golang.org/protobuf/internal/pragma"
-)
-
-type doNotImplement pragma.DoNotImplement
-
-// ProtoMessage is the top-level interface that all proto messages implement.
-// This is declared in the protoreflect package to avoid a cyclic dependency;
-// use the [google.golang.org/protobuf/proto.Message] type instead, which aliases this type.
-type ProtoMessage interface{ ProtoReflect() Message }
-
-// Syntax is the language version of the proto file.
-type Syntax syntax
-
-type syntax int8 // keep exact type opaque as the int type may change
-
-const (
- Proto2 Syntax = 2
- Proto3 Syntax = 3
- Editions Syntax = 4
-)
-
-// IsValid reports whether the syntax is valid.
-func (s Syntax) IsValid() bool {
- switch s {
- case Proto2, Proto3:
- return true
- default:
- return false
- }
-}
-
-// String returns s as a proto source identifier (e.g., "proto2").
-func (s Syntax) String() string {
- switch s {
- case Proto2:
- return "proto2"
- case Proto3:
- return "proto3"
- default:
- return fmt.Sprintf("", s)
- }
-}
-
-// GoString returns s as a Go source identifier (e.g., "Proto2").
-func (s Syntax) GoString() string {
- switch s {
- case Proto2:
- return "Proto2"
- case Proto3:
- return "Proto3"
- default:
- return fmt.Sprintf("Syntax(%d)", s)
- }
-}
-
-// Cardinality determines whether a field is optional, required, or repeated.
-type Cardinality cardinality
-
-type cardinality int8 // keep exact type opaque as the int type may change
-
-// Constants as defined by the google.protobuf.Cardinality enumeration.
-const (
- Optional Cardinality = 1 // appears zero or one times
- Required Cardinality = 2 // appears exactly one time; invalid with Proto3
- Repeated Cardinality = 3 // appears zero or more times
-)
-
-// IsValid reports whether the cardinality is valid.
-func (c Cardinality) IsValid() bool {
- switch c {
- case Optional, Required, Repeated:
- return true
- default:
- return false
- }
-}
-
-// String returns c as a proto source identifier (e.g., "optional").
-func (c Cardinality) String() string {
- switch c {
- case Optional:
- return "optional"
- case Required:
- return "required"
- case Repeated:
- return "repeated"
- default:
- return fmt.Sprintf("", c)
- }
-}
-
-// GoString returns c as a Go source identifier (e.g., "Optional").
-func (c Cardinality) GoString() string {
- switch c {
- case Optional:
- return "Optional"
- case Required:
- return "Required"
- case Repeated:
- return "Repeated"
- default:
- return fmt.Sprintf("Cardinality(%d)", c)
- }
-}
-
-// Kind indicates the basic proto kind of a field.
-type Kind kind
-
-type kind int8 // keep exact type opaque as the int type may change
-
-// Constants as defined by the google.protobuf.Field.Kind enumeration.
-const (
- BoolKind Kind = 8
- EnumKind Kind = 14
- Int32Kind Kind = 5
- Sint32Kind Kind = 17
- Uint32Kind Kind = 13
- Int64Kind Kind = 3
- Sint64Kind Kind = 18
- Uint64Kind Kind = 4
- Sfixed32Kind Kind = 15
- Fixed32Kind Kind = 7
- FloatKind Kind = 2
- Sfixed64Kind Kind = 16
- Fixed64Kind Kind = 6
- DoubleKind Kind = 1
- StringKind Kind = 9
- BytesKind Kind = 12
- MessageKind Kind = 11
- GroupKind Kind = 10
-)
-
-// IsValid reports whether the kind is valid.
-func (k Kind) IsValid() bool {
- switch k {
- case BoolKind, EnumKind,
- Int32Kind, Sint32Kind, Uint32Kind,
- Int64Kind, Sint64Kind, Uint64Kind,
- Sfixed32Kind, Fixed32Kind, FloatKind,
- Sfixed64Kind, Fixed64Kind, DoubleKind,
- StringKind, BytesKind, MessageKind, GroupKind:
- return true
- default:
- return false
- }
-}
-
-// String returns k as a proto source identifier (e.g., "bool").
-func (k Kind) String() string {
- switch k {
- case BoolKind:
- return "bool"
- case EnumKind:
- return "enum"
- case Int32Kind:
- return "int32"
- case Sint32Kind:
- return "sint32"
- case Uint32Kind:
- return "uint32"
- case Int64Kind:
- return "int64"
- case Sint64Kind:
- return "sint64"
- case Uint64Kind:
- return "uint64"
- case Sfixed32Kind:
- return "sfixed32"
- case Fixed32Kind:
- return "fixed32"
- case FloatKind:
- return "float"
- case Sfixed64Kind:
- return "sfixed64"
- case Fixed64Kind:
- return "fixed64"
- case DoubleKind:
- return "double"
- case StringKind:
- return "string"
- case BytesKind:
- return "bytes"
- case MessageKind:
- return "message"
- case GroupKind:
- return "group"
- default:
- return fmt.Sprintf("", k)
- }
-}
-
-// GoString returns k as a Go source identifier (e.g., "BoolKind").
-func (k Kind) GoString() string {
- switch k {
- case BoolKind:
- return "BoolKind"
- case EnumKind:
- return "EnumKind"
- case Int32Kind:
- return "Int32Kind"
- case Sint32Kind:
- return "Sint32Kind"
- case Uint32Kind:
- return "Uint32Kind"
- case Int64Kind:
- return "Int64Kind"
- case Sint64Kind:
- return "Sint64Kind"
- case Uint64Kind:
- return "Uint64Kind"
- case Sfixed32Kind:
- return "Sfixed32Kind"
- case Fixed32Kind:
- return "Fixed32Kind"
- case FloatKind:
- return "FloatKind"
- case Sfixed64Kind:
- return "Sfixed64Kind"
- case Fixed64Kind:
- return "Fixed64Kind"
- case DoubleKind:
- return "DoubleKind"
- case StringKind:
- return "StringKind"
- case BytesKind:
- return "BytesKind"
- case MessageKind:
- return "MessageKind"
- case GroupKind:
- return "GroupKind"
- default:
- return fmt.Sprintf("Kind(%d)", k)
- }
-}
-
-// FieldNumber is the field number in a message.
-type FieldNumber = protowire.Number
-
-// FieldNumbers represent a list of field numbers.
-type FieldNumbers interface {
- // Len reports the number of fields in the list.
- Len() int
- // Get returns the ith field number. It panics if out of bounds.
- Get(i int) FieldNumber
- // Has reports whether n is within the list of fields.
- Has(n FieldNumber) bool
-
- doNotImplement
-}
-
-// FieldRanges represent a list of field number ranges.
-type FieldRanges interface {
- // Len reports the number of ranges in the list.
- Len() int
- // Get returns the ith range. It panics if out of bounds.
- Get(i int) [2]FieldNumber // start inclusive; end exclusive
- // Has reports whether n is within any of the ranges.
- Has(n FieldNumber) bool
-
- doNotImplement
-}
-
-// EnumNumber is the numeric value for an enum.
-type EnumNumber int32
-
-// EnumRanges represent a list of enum number ranges.
-type EnumRanges interface {
- // Len reports the number of ranges in the list.
- Len() int
- // Get returns the ith range. It panics if out of bounds.
- Get(i int) [2]EnumNumber // start inclusive; end inclusive
- // Has reports whether n is within any of the ranges.
- Has(n EnumNumber) bool
-
- doNotImplement
-}
-
-// Name is the short name for a proto declaration. This is not the name
-// as used in Go source code, which might not be identical to the proto name.
-type Name string // e.g., "Kind"
-
-// IsValid reports whether s is a syntactically valid name.
-// An empty name is invalid.
-func (s Name) IsValid() bool {
- return consumeIdent(string(s)) == len(s)
-}
-
-// Names represent a list of names.
-type Names interface {
- // Len reports the number of names in the list.
- Len() int
- // Get returns the ith name. It panics if out of bounds.
- Get(i int) Name
- // Has reports whether s matches any names in the list.
- Has(s Name) bool
-
- doNotImplement
-}
-
-// FullName is a qualified name that uniquely identifies a proto declaration.
-// A qualified name is the concatenation of the proto package along with the
-// fully-declared name (i.e., name of parent preceding the name of the child),
-// with a '.' delimiter placed between each [Name].
-//
-// This should not have any leading or trailing dots.
-type FullName string // e.g., "google.protobuf.Field.Kind"
-
-// IsValid reports whether s is a syntactically valid full name.
-// An empty full name is invalid.
-func (s FullName) IsValid() bool {
- i := consumeIdent(string(s))
- if i < 0 {
- return false
- }
- for len(s) > i {
- if s[i] != '.' {
- return false
- }
- i++
- n := consumeIdent(string(s[i:]))
- if n < 0 {
- return false
- }
- i += n
- }
- return true
-}
-
-func consumeIdent(s string) (i int) {
- if len(s) == 0 || !isLetter(s[i]) {
- return -1
- }
- i++
- for len(s) > i && isLetterDigit(s[i]) {
- i++
- }
- return i
-}
-func isLetter(c byte) bool {
- return c == '_' || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
-}
-func isLetterDigit(c byte) bool {
- return isLetter(c) || ('0' <= c && c <= '9')
-}
-
-// Name returns the short name, which is the last identifier segment.
-// A single segment FullName is the [Name] itself.
-func (n FullName) Name() Name {
- if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
- return Name(n[i+1:])
- }
- return Name(n)
-}
-
-// Parent returns the full name with the trailing identifier removed.
-// A single segment FullName has no parent.
-func (n FullName) Parent() FullName {
- if i := strings.LastIndexByte(string(n), '.'); i >= 0 {
- return n[:i]
- }
- return ""
-}
-
-// Append returns the qualified name appended with the provided short name.
-//
-// Invariant: n == n.Parent().Append(n.Name()) // assuming n is valid
-func (n FullName) Append(s Name) FullName {
- if n == "" {
- return FullName(s)
- }
- return n + "." + FullName(s)
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
deleted file mode 100644
index 0b99428..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go
+++ /dev/null
@@ -1,129 +0,0 @@
-// 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.
-
-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.
- Len() int
- // Get returns the ith SourceLocation. It panics if out of bounds.
- Get(int) SourceLocation
-
- // 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
-
- // 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
-// corresponds with the google.protobuf.SourceCodeInfo.Location message.
-type SourceLocation struct {
- // Path is the path to the declaration from the root file descriptor.
- // The contents of this slice must not be mutated.
- Path SourcePath
-
- // StartLine and StartColumn are the zero-indexed starting location
- // in the source file for the declaration.
- StartLine, StartColumn int
- // EndLine and EndColumn are the zero-indexed ending location
- // in the source file for the declaration.
- // In the descriptor.proto, the end line may be omitted if it is identical
- // to the start line. Here, it is always populated.
- EndLine, EndColumn int
-
- // LeadingDetachedComments are the leading detached comments
- // for the declaration. The contents of this slice must not be mutated.
- LeadingDetachedComments []string
- // LeadingComments is the leading attached comment for the declaration.
- 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.
-// The SourcePath is a sequence of either field numbers or indexes into
-// a repeated field that form a path starting from the root file descriptor.
-//
-// See google.protobuf.SourceCodeInfo.Location.path.
-type SourcePath []int32
-
-// 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
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
deleted file mode 100644
index 0c045db..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go
+++ /dev/null
@@ -1,554 +0,0 @@
-// 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)
- case 14:
- b = p.appendSingularField(b, "edition", 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 50:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- 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 11:
- b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
- case 12:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- 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 6:
- b = p.appendSingularField(b, "deprecated_legacy_json_field_conflicts", nil)
- case 7:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- 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 34:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- 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 15:
- b = p.appendSingularField(b, "unverified_lazy", nil)
- case 3:
- b = p.appendSingularField(b, "deprecated", nil)
- case 10:
- b = p.appendSingularField(b, "weak", nil)
- case 16:
- b = p.appendSingularField(b, "debug_redact", nil)
- case 17:
- b = p.appendSingularField(b, "retention", nil)
- case 19:
- b = p.appendRepeatedField(b, "targets", nil)
- case 20:
- b = p.appendRepeatedField(b, "edition_defaults", (*SourcePath).appendFieldOptions_EditionDefault)
- case 21:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- case 999:
- b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
- }
- return b
-}
-
-func (p *SourcePath) appendFeatureSet(b []byte) []byte {
- if len(*p) == 0 {
- return b
- }
- switch (*p)[0] {
- case 1:
- b = p.appendSingularField(b, "field_presence", nil)
- case 2:
- b = p.appendSingularField(b, "enum_type", nil)
- case 3:
- b = p.appendSingularField(b, "repeated_field_encoding", nil)
- case 4:
- b = p.appendSingularField(b, "utf8_validation", nil)
- case 5:
- b = p.appendSingularField(b, "message_encoding", nil)
- case 6:
- b = p.appendSingularField(b, "json_format", nil)
- }
- 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)
- case 2:
- b = p.appendRepeatedField(b, "declaration", (*SourcePath).appendExtensionRangeOptions_Declaration)
- case 50:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- case 3:
- b = p.appendSingularField(b, "verification", nil)
- }
- return b
-}
-
-func (p *SourcePath) appendOneofOptions(b []byte) []byte {
- if len(*p) == 0 {
- return b
- }
- switch (*p)[0] {
- case 1:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- 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 2:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- case 3:
- b = p.appendSingularField(b, "debug_redact", 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 35:
- b = p.appendSingularField(b, "features", (*SourcePath).appendFeatureSet)
- case 999:
- b = p.appendRepeatedField(b, "uninterpreted_option", (*SourcePath).appendUninterpretedOption)
- }
- return b
-}
-
-func (p *SourcePath) appendFieldOptions_EditionDefault(b []byte) []byte {
- if len(*p) == 0 {
- return b
- }
- switch (*p)[0] {
- case 3:
- b = p.appendSingularField(b, "edition", nil)
- case 2:
- b = p.appendSingularField(b, "value", nil)
- }
- 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
-}
-
-func (p *SourcePath) appendExtensionRangeOptions_Declaration(b []byte) []byte {
- if len(*p) == 0 {
- return b
- }
- switch (*p)[0] {
- case 1:
- b = p.appendSingularField(b, "number", nil)
- case 2:
- b = p.appendSingularField(b, "full_name", nil)
- case 3:
- b = p.appendSingularField(b, "type", nil)
- case 5:
- b = p.appendSingularField(b, "reserved", nil)
- case 6:
- b = p.appendSingularField(b, "repeated", nil)
- }
- return b
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
deleted file mode 100644
index 60ff62b..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go
+++ /dev/null
@@ -1,666 +0,0 @@
-// Copyright 2018 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.
-
-package protoreflect
-
-// Descriptor provides a set of accessors that are common to every descriptor.
-// Each descriptor type wraps the equivalent google.protobuf.XXXDescriptorProto,
-// but provides efficient lookup and immutability.
-//
-// Each descriptor is comparable. Equality implies that the two types are
-// exactly identical. However, it is possible for the same semantically
-// identical proto type to be represented by multiple type descriptors.
-//
-// For example, suppose we have t1 and t2 which are both an [MessageDescriptor].
-// If t1 == t2, then the types are definitely equal and all accessors return
-// the same information. However, if t1 != t2, then it is still possible that
-// they still represent the same proto type (e.g., t1.FullName == t2.FullName).
-// This can occur if a descriptor type is created dynamically, or multiple
-// versions of the same proto type are accidentally linked into the Go binary.
-type Descriptor interface {
- // ParentFile returns the parent file descriptor that this descriptor
- // is declared within. The parent file for the file descriptor is itself.
- //
- // Support for this functionality is optional and may return nil.
- ParentFile() FileDescriptor
-
- // Parent returns the parent containing this descriptor declaration.
- // The following shows the mapping from child type to possible parent types:
- //
- // ╔═════════════════════╤═══════════════════════════════════╗
- // ║ Child type │ Possible parent types ║
- // ╠═════════════════════╪═══════════════════════════════════╣
- // ║ FileDescriptor │ nil ║
- // ║ MessageDescriptor │ FileDescriptor, MessageDescriptor ║
- // ║ FieldDescriptor │ FileDescriptor, MessageDescriptor ║
- // ║ OneofDescriptor │ MessageDescriptor ║
- // ║ EnumDescriptor │ FileDescriptor, MessageDescriptor ║
- // ║ EnumValueDescriptor │ EnumDescriptor ║
- // ║ ServiceDescriptor │ FileDescriptor ║
- // ║ MethodDescriptor │ ServiceDescriptor ║
- // ╚═════════════════════╧═══════════════════════════════════╝
- //
- // Support for this functionality is optional and may return nil.
- Parent() Descriptor
-
- // Index returns the index of this descriptor within its parent.
- // It returns 0 if the descriptor does not have a parent or if the parent
- // is unknown.
- Index() int
-
- // Syntax is the protobuf syntax.
- Syntax() Syntax // e.g., Proto2 or Proto3
-
- // Name is the short name of the declaration (i.e., FullName.Name).
- Name() Name // e.g., "Any"
-
- // FullName is the fully-qualified name of the declaration.
- //
- // The FullName is a concatenation of the full name of the type that this
- // type is declared within and the declaration name. For example,
- // field "foo_field" in message "proto.package.MyMessage" is
- // uniquely identified as "proto.package.MyMessage.foo_field".
- // Enum values are an exception to the rule (see EnumValueDescriptor).
- FullName() FullName // e.g., "google.protobuf.Any"
-
- // IsPlaceholder reports whether type information is missing since a
- // dependency is not resolved, in which case only name information is known.
- //
- // Placeholder types may only be returned by the following accessors
- // as a result of unresolved dependencies or weak imports:
- //
- // ╔═══════════════════════════════════╤═════════════════════╗
- // ║ Accessor │ Descriptor ║
- // ╠═══════════════════════════════════╪═════════════════════╣
- // ║ FileImports.FileDescriptor │ FileDescriptor ║
- // ║ FieldDescriptor.Enum │ EnumDescriptor ║
- // ║ FieldDescriptor.Message │ MessageDescriptor ║
- // ║ FieldDescriptor.DefaultEnumValue │ EnumValueDescriptor ║
- // ║ FieldDescriptor.ContainingMessage │ MessageDescriptor ║
- // ║ MethodDescriptor.Input │ MessageDescriptor ║
- // ║ MethodDescriptor.Output │ MessageDescriptor ║
- // ╚═══════════════════════════════════╧═════════════════════╝
- //
- // If true, only Name and FullName are valid.
- // For FileDescriptor, the Path is also valid.
- IsPlaceholder() bool
-
- // Options returns the descriptor options. The caller must not modify
- // the returned value.
- //
- // To avoid a dependency cycle, this function returns a proto.Message value.
- // The proto message type returned for each descriptor type is as follows:
- // ╔═════════════════════╤══════════════════════════════════════════╗
- // ║ Go type │ Protobuf message type ║
- // ╠═════════════════════╪══════════════════════════════════════════╣
- // ║ FileDescriptor │ google.protobuf.FileOptions ║
- // ║ EnumDescriptor │ google.protobuf.EnumOptions ║
- // ║ EnumValueDescriptor │ google.protobuf.EnumValueOptions ║
- // ║ MessageDescriptor │ google.protobuf.MessageOptions ║
- // ║ FieldDescriptor │ google.protobuf.FieldOptions ║
- // ║ OneofDescriptor │ google.protobuf.OneofOptions ║
- // ║ ServiceDescriptor │ google.protobuf.ServiceOptions ║
- // ║ MethodDescriptor │ google.protobuf.MethodOptions ║
- // ╚═════════════════════╧══════════════════════════════════════════╝
- //
- // This method returns a typed nil-pointer if no options are present.
- // The caller must import the descriptorpb package to use this.
- Options() ProtoMessage
-
- doNotImplement
-}
-
-// FileDescriptor describes the types in a complete proto file and
-// corresponds with the google.protobuf.FileDescriptorProto message.
-//
-// Top-level declarations:
-// [EnumDescriptor], [MessageDescriptor], [FieldDescriptor], and/or [ServiceDescriptor].
-type FileDescriptor interface {
- Descriptor // Descriptor.FullName is identical to Package
-
- // Path returns the file name, relative to the source tree root.
- Path() string // e.g., "path/to/file.proto"
- // Package returns the protobuf package namespace.
- Package() FullName // e.g., "google.protobuf"
-
- // Imports is a list of imported proto files.
- Imports() FileImports
-
- // Enums is a list of the top-level enum declarations.
- Enums() EnumDescriptors
- // Messages is a list of the top-level message declarations.
- Messages() MessageDescriptors
- // Extensions is a list of the top-level extension declarations.
- Extensions() ExtensionDescriptors
- // Services is a list of the top-level service declarations.
- Services() ServiceDescriptors
-
- // SourceLocations is a list of source locations.
- SourceLocations() SourceLocations
-
- isFileDescriptor
-}
-type isFileDescriptor interface{ ProtoType(FileDescriptor) }
-
-// FileImports is a list of file imports.
-type FileImports interface {
- // Len reports the number of files imported by this proto file.
- Len() int
- // Get returns the ith FileImport. It panics if out of bounds.
- Get(i int) FileImport
-
- doNotImplement
-}
-
-// FileImport is the declaration for a proto file import.
-type FileImport struct {
- // FileDescriptor is the file type for the given import.
- // It is a placeholder descriptor if IsWeak is set or if a dependency has
- // not been regenerated to implement the new reflection APIs.
- FileDescriptor
-
- // IsPublic reports whether this is a public import, which causes this file
- // to alias declarations within the imported file. The intended use cases
- // for this feature is the ability to move proto files without breaking
- // existing dependencies.
- //
- // The current file and the imported file must be within proto package.
- IsPublic bool
-
- // IsWeak reports whether this is a weak import, which does not impose
- // a direct dependency on the target file.
- //
- // Weak imports are a legacy proto1 feature. Equivalent behavior is
- // achieved using proto2 extension fields or proto3 Any messages.
- IsWeak bool
-}
-
-// MessageDescriptor describes a message and
-// corresponds with the google.protobuf.DescriptorProto message.
-//
-// Nested declarations:
-// [FieldDescriptor], [OneofDescriptor], [FieldDescriptor], [EnumDescriptor],
-// and/or [MessageDescriptor].
-type MessageDescriptor interface {
- Descriptor
-
- // IsMapEntry indicates that this is an auto-generated message type to
- // represent the entry type for a map field.
- //
- // Map entry messages have only two fields:
- // • a "key" field with a field number of 1
- // • a "value" field with a field number of 2
- // The key and value types are determined by these two fields.
- //
- // If IsMapEntry is true, it implies that FieldDescriptor.IsMap is true
- // for some field with this message type.
- IsMapEntry() bool
-
- // Fields is a list of nested field declarations.
- Fields() FieldDescriptors
- // Oneofs is a list of nested oneof declarations.
- Oneofs() OneofDescriptors
-
- // ReservedNames is a list of reserved field names.
- ReservedNames() Names
- // ReservedRanges is a list of reserved ranges of field numbers.
- ReservedRanges() FieldRanges
- // RequiredNumbers is a list of required field numbers.
- // In Proto3, it is always an empty list.
- RequiredNumbers() FieldNumbers
- // ExtensionRanges is the field ranges used for extension fields.
- // In Proto3, it is always an empty ranges.
- ExtensionRanges() FieldRanges
- // ExtensionRangeOptions returns the ith extension range options.
- //
- // To avoid a dependency cycle, this method returns a proto.Message] value,
- // which always contains a google.protobuf.ExtensionRangeOptions message.
- // This method returns a typed nil-pointer if no options are present.
- // The caller must import the descriptorpb package to use this.
- ExtensionRangeOptions(i int) ProtoMessage
-
- // Enums is a list of nested enum declarations.
- Enums() EnumDescriptors
- // Messages is a list of nested message declarations.
- Messages() MessageDescriptors
- // Extensions is a list of nested extension declarations.
- Extensions() ExtensionDescriptors
-
- isMessageDescriptor
-}
-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.
- //
- // Invariant: t.Descriptor() == t.New().Descriptor()
- 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 MessageDescriptor.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 MessageDescriptor.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.
- Len() int
- // Get returns the ith MessageDescriptor. It panics if out of bounds.
- Get(i int) MessageDescriptor
- // ByName returns the MessageDescriptor for a message named s.
- // It returns nil if not found.
- ByName(s Name) MessageDescriptor
-
- doNotImplement
-}
-
-// FieldDescriptor describes a field within a message and
-// corresponds with the google.protobuf.FieldDescriptorProto message.
-//
-// It is used for both normal fields defined within the parent message
-// (e.g., [MessageDescriptor.Fields]) and fields that extend some remote message
-// (e.g., [FileDescriptor.Extensions] or [MessageDescriptor.Extensions]).
-type FieldDescriptor interface {
- Descriptor
-
- // Number reports the unique number for this field.
- Number() FieldNumber
- // Cardinality reports the cardinality for this field.
- Cardinality() Cardinality
- // Kind reports the basic kind for this field.
- Kind() Kind
-
- // HasJSONName reports whether this field has an explicitly set JSON name.
- HasJSONName() bool
-
- // 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
-
- // IsExtension reports whether this is an extension field. If false,
- // then Parent and ContainingMessage refer to the same message.
- // Otherwise, ContainingMessage and Parent likely differ.
- IsExtension() bool
-
- // HasOptionalKeyword reports whether the "optional" keyword was explicitly
- // specified in the source .proto file.
- HasOptionalKeyword() bool
-
- // IsWeak reports whether this is a weak field, which does not impose a
- // direct dependency on the target type.
- // If true, then Message returns a placeholder type.
- IsWeak() bool
-
- // IsPacked reports whether repeated primitive numeric kinds should be
- // serialized using a packed encoding.
- // If true, then it implies Cardinality is Repeated.
- IsPacked() bool
-
- // IsList reports whether this field represents a list,
- // where the value type for the associated field is a List.
- // It is equivalent to checking whether Cardinality is Repeated and
- // that IsMap reports false.
- IsList() bool
-
- // IsMap reports whether this field represents a map,
- // where the value type for the associated field is a Map.
- // It is equivalent to checking whether Cardinality is Repeated,
- // that the Kind is MessageKind, and that MessageDescriptor.IsMapEntry reports true.
- IsMap() bool
-
- // MapKey returns the field descriptor for the key in the map entry.
- // It returns nil if IsMap reports false.
- MapKey() FieldDescriptor
-
- // MapValue returns the field descriptor for the value in the map entry.
- // It returns nil if IsMap reports false.
- MapValue() FieldDescriptor
-
- // HasDefault reports whether this field has a default value.
- HasDefault() bool
-
- // Default returns the default value for scalar fields.
- // For proto2, it is the default value as specified in the proto file,
- // or the zero value if unspecified.
- // For proto3, it is always the zero value of the scalar.
- // The Value type is determined by the Kind.
- Default() Value
-
- // DefaultEnumValue returns the enum value descriptor for the default value
- // of an enum field, and is nil for any other kind of field.
- DefaultEnumValue() EnumValueDescriptor
-
- // ContainingOneof is the containing oneof that this field belongs to,
- // and is nil if this field is not part of a oneof.
- ContainingOneof() OneofDescriptor
-
- // ContainingMessage is the containing message that this field belongs to.
- // For extension fields, this may not necessarily be the parent message
- // that the field is declared within.
- ContainingMessage() MessageDescriptor
-
- // Enum is the enum descriptor if Kind is EnumKind.
- // It returns nil for any other Kind.
- Enum() EnumDescriptor
-
- // Message is the message descriptor if Kind is
- // MessageKind or GroupKind. It returns nil for any other Kind.
- Message() MessageDescriptor
-
- isFieldDescriptor
-}
-type isFieldDescriptor interface{ ProtoType(FieldDescriptor) }
-
-// FieldDescriptors is a list of field declarations.
-type FieldDescriptors interface {
- // Len reports the number of fields.
- Len() int
- // Get returns the ith FieldDescriptor. It panics if out of bounds.
- Get(i int) FieldDescriptor
- // ByName returns the FieldDescriptor for a field named s.
- // It returns nil if not found.
- ByName(s Name) FieldDescriptor
- // 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
-
- doNotImplement
-}
-
-// OneofDescriptor describes a oneof field set within a given message and
-// corresponds with the google.protobuf.OneofDescriptorProto message.
-type OneofDescriptor interface {
- Descriptor
-
- // IsSynthetic reports whether this is a synthetic oneof created to support
- // proto3 optional semantics. If true, Fields contains exactly one field
- // with FieldDescriptor.HasOptionalKeyword specified.
- IsSynthetic() bool
-
- // Fields is a list of fields belonging to this oneof.
- Fields() FieldDescriptors
-
- isOneofDescriptor
-}
-type isOneofDescriptor interface{ ProtoType(OneofDescriptor) }
-
-// OneofDescriptors is a list of oneof declarations.
-type OneofDescriptors interface {
- // Len reports the number of oneof fields.
- Len() int
- // Get returns the ith OneofDescriptor. It panics if out of bounds.
- Get(i int) OneofDescriptor
- // ByName returns the OneofDescriptor for a oneof named s.
- // It returns nil if not found.
- ByName(s Name) OneofDescriptor
-
- doNotImplement
-}
-
-// ExtensionDescriptor is an alias of [FieldDescriptor] for documentation.
-type ExtensionDescriptor = FieldDescriptor
-
-// ExtensionTypeDescriptor is an [ExtensionDescriptor] with an associated [ExtensionType].
-type ExtensionTypeDescriptor interface {
- ExtensionDescriptor
-
- // Type returns the associated ExtensionType.
- Type() ExtensionType
-
- // Descriptor returns the plain ExtensionDescriptor without the
- // associated ExtensionType.
- Descriptor() ExtensionDescriptor
-}
-
-// ExtensionDescriptors is a list of field declarations.
-type ExtensionDescriptors interface {
- // Len reports the number of fields.
- Len() int
- // Get returns the ith ExtensionDescriptor. It panics if out of bounds.
- Get(i int) ExtensionDescriptor
- // ByName returns the ExtensionDescriptor for a field named s.
- // It returns nil if not found.
- ByName(s Name) ExtensionDescriptor
-
- doNotImplement
-}
-
-// ExtensionType encapsulates an [ExtensionDescriptor] with a concrete
-// Go implementation. The nested field descriptor must be for a extension field.
-//
-// While a normal field is a member of the parent message that it is declared
-// within (see [Descriptor.Parent]), an extension field is a member of some other
-// target message (see [FieldDescriptor.ContainingMessage]) and may have no
-// relationship with the parent. However, the full name of an extension field is
-// relative to the parent that it is declared within.
-//
-// For example:
-//
-// syntax = "proto2";
-// package example;
-// message FooMessage {
-// extensions 100 to max;
-// }
-// message BarMessage {
-// extends FooMessage { optional BarMessage bar_field = 100; }
-// }
-//
-// Field "bar_field" is an extension of FooMessage, but its full name is
-// "example.BarMessage.bar_field" instead of "example.FooMessage.bar_field".
-type ExtensionType interface {
- // New returns a new value for the field.
- // For scalars, this returns the default value in native Go form.
- New() Value
-
- // Zero returns a new value for the field.
- // For scalars, this returns the default value in native Go form.
- // For composite types, this returns an empty, read-only message, list, or map.
- Zero() Value
-
- // TypeDescriptor returns the extension type descriptor.
- TypeDescriptor() ExtensionTypeDescriptor
-
- // ValueOf wraps the input and returns it as a Value.
- // ValueOf panics if the input value is invalid or not the appropriate type.
- //
- // ValueOf is more extensive than protoreflect.ValueOf for a given field's
- // value as it has more type information available.
- ValueOf(interface{}) Value
-
- // InterfaceOf completely unwraps the Value to the underlying Go type.
- // InterfaceOf panics if the input is nil or does not represent the
- // appropriate underlying Go type. For composite types, it panics if the
- // value is not mutable.
- //
- // InterfaceOf is able to unwrap the Value further than Value.Interface
- // as it has more type information available.
- InterfaceOf(Value) interface{}
-
- // IsValidValue reports whether the Value is valid to assign to the field.
- IsValidValue(Value) bool
-
- // IsValidInterface reports whether the input is valid to assign to the field.
- IsValidInterface(interface{}) bool
-}
-
-// EnumDescriptor describes an enum and
-// corresponds with the google.protobuf.EnumDescriptorProto message.
-//
-// Nested declarations:
-// [EnumValueDescriptor].
-type EnumDescriptor interface {
- Descriptor
-
- // Values is a list of nested enum value declarations.
- Values() EnumValueDescriptors
-
- // ReservedNames is a list of reserved enum names.
- ReservedNames() Names
- // ReservedRanges is a list of reserved ranges of enum numbers.
- ReservedRanges() EnumRanges
-
- isEnumDescriptor
-}
-type isEnumDescriptor interface{ ProtoType(EnumDescriptor) }
-
-// EnumType encapsulates an [EnumDescriptor] with a concrete Go implementation.
-type EnumType interface {
- // New returns an instance of this enum type with its value set to n.
- New(n EnumNumber) Enum
-
- // Descriptor returns the enum descriptor.
- //
- // Invariant: t.Descriptor() == t.New(0).Descriptor()
- Descriptor() EnumDescriptor
-}
-
-// EnumDescriptors is a list of enum declarations.
-type EnumDescriptors interface {
- // Len reports the number of enum types.
- Len() int
- // Get returns the ith EnumDescriptor. It panics if out of bounds.
- Get(i int) EnumDescriptor
- // ByName returns the EnumDescriptor for an enum named s.
- // It returns nil if not found.
- ByName(s Name) EnumDescriptor
-
- doNotImplement
-}
-
-// EnumValueDescriptor describes an enum value and
-// corresponds with the google.protobuf.EnumValueDescriptorProto message.
-//
-// All other proto declarations are in the namespace of the parent.
-// However, enum values do not follow this rule and are within the namespace
-// of the parent's parent (i.e., they are a sibling of the containing enum).
-// Thus, a value named "FOO_VALUE" declared within an enum uniquely identified
-// as "proto.package.MyEnum" has a full name of "proto.package.FOO_VALUE".
-type EnumValueDescriptor interface {
- Descriptor
-
- // Number returns the enum value as an integer.
- Number() EnumNumber
-
- isEnumValueDescriptor
-}
-type isEnumValueDescriptor interface{ ProtoType(EnumValueDescriptor) }
-
-// EnumValueDescriptors is a list of enum value declarations.
-type EnumValueDescriptors interface {
- // Len reports the number of enum values.
- Len() int
- // Get returns the ith EnumValueDescriptor. It panics if out of bounds.
- Get(i int) EnumValueDescriptor
- // ByName returns the EnumValueDescriptor for the enum value named s.
- // It returns nil if not found.
- ByName(s Name) EnumValueDescriptor
- // ByNumber returns the EnumValueDescriptor for the enum value numbered n.
- // If multiple have the same number, the first one defined is returned
- // It returns nil if not found.
- ByNumber(n EnumNumber) EnumValueDescriptor
-
- doNotImplement
-}
-
-// ServiceDescriptor describes a service and
-// corresponds with the google.protobuf.ServiceDescriptorProto message.
-//
-// Nested declarations: [MethodDescriptor].
-type ServiceDescriptor interface {
- Descriptor
-
- // Methods is a list of nested message declarations.
- Methods() MethodDescriptors
-
- isServiceDescriptor
-}
-type isServiceDescriptor interface{ ProtoType(ServiceDescriptor) }
-
-// ServiceDescriptors is a list of service declarations.
-type ServiceDescriptors interface {
- // Len reports the number of services.
- Len() int
- // Get returns the ith ServiceDescriptor. It panics if out of bounds.
- Get(i int) ServiceDescriptor
- // ByName returns the ServiceDescriptor for a service named s.
- // It returns nil if not found.
- ByName(s Name) ServiceDescriptor
-
- doNotImplement
-}
-
-// MethodDescriptor describes a method and
-// corresponds with the google.protobuf.MethodDescriptorProto message.
-type MethodDescriptor interface {
- Descriptor
-
- // Input is the input message descriptor.
- Input() MessageDescriptor
- // Output is the output message descriptor.
- Output() MessageDescriptor
- // IsStreamingClient reports whether the client streams multiple messages.
- IsStreamingClient() bool
- // IsStreamingServer reports whether the server streams multiple messages.
- IsStreamingServer() bool
-
- isMethodDescriptor
-}
-type isMethodDescriptor interface{ ProtoType(MethodDescriptor) }
-
-// MethodDescriptors is a list of method declarations.
-type MethodDescriptors interface {
- // Len reports the number of methods.
- Len() int
- // Get returns the ith MethodDescriptor. It panics if out of bounds.
- Get(i int) MethodDescriptor
- // ByName returns the MethodDescriptor for a service method named s.
- // It returns nil if not found.
- ByName(s Name) MethodDescriptor
-
- doNotImplement
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
deleted file mode 100644
index a7b0d06..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go
+++ /dev/null
@@ -1,285 +0,0 @@
-// Copyright 2018 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.
-
-package protoreflect
-
-import "google.golang.org/protobuf/encoding/protowire"
-
-// Enum is a reflection interface for a concrete enum value,
-// which provides type information and a getter for the enum number.
-// Enum does not provide a mutable API since enums are commonly backed by
-// Go constants, which are not addressable.
-type Enum interface {
- // Descriptor returns enum descriptor, which contains only the protobuf
- // type information for the enum.
- Descriptor() EnumDescriptor
-
- // Type returns the enum type, which encapsulates both Go and protobuf
- // type information. If the Go type information is not needed,
- // it is recommended that the enum descriptor be used instead.
- Type() EnumType
-
- // Number returns the enum value as an integer.
- Number() EnumNumber
-}
-
-// Message is a reflective interface for a concrete message value,
-// encapsulating both type and value information for the message.
-//
-// Accessor/mutators for individual fields are keyed by [FieldDescriptor].
-// For non-extension fields, the descriptor must exactly match the
-// field known by the parent message.
-// For extension fields, the descriptor must implement [ExtensionTypeDescriptor],
-// extend the parent message (i.e., have the same message [FullName]), and
-// be within the parent's extension range.
-//
-// Each field [Value] can be a scalar or a composite type ([Message], [List], or [Map]).
-// See [Value] for the Go types associated with a [FieldDescriptor].
-// Providing a [Value] that is invalid or of an incorrect type panics.
-type Message interface {
- // Descriptor returns message descriptor, which contains only the protobuf
- // type information for the message.
- Descriptor() MessageDescriptor
-
- // Type returns the message type, which encapsulates both Go and protobuf
- // type information. If the Go type information is not needed,
- // it is recommended that the message descriptor be used instead.
- Type() MessageType
-
- // New returns a newly allocated and mutable empty message.
- New() Message
-
- // Interface unwraps the message reflection interface and
- // returns the underlying ProtoMessage interface.
- Interface() ProtoMessage
-
- // Range iterates over every populated field in an undefined order,
- // calling f for each field descriptor and value encountered.
- // Range returns immediately if f returns false.
- // While iterating, mutating operations may only be performed
- // on the current field descriptor.
- Range(f func(FieldDescriptor, Value) bool)
-
- // Has reports whether a field is populated.
- //
- // Some fields have the property of nullability where it is possible to
- // distinguish between the default value of a field and whether the field
- // was explicitly populated with the default value. Singular message fields,
- // member fields of a oneof, and proto2 scalar fields are nullable. Such
- // fields are populated only if explicitly set.
- //
- // In other cases (aside from the nullable cases above),
- // a proto3 scalar field is populated if it contains a non-zero value, and
- // a repeated field is populated if it is non-empty.
- Has(FieldDescriptor) bool
-
- // Clear clears the field such that a subsequent Has call reports false.
- //
- // Clearing an extension field clears both the extension type and value
- // associated with the given field number.
- //
- // Clear is a mutating operation and unsafe for concurrent use.
- Clear(FieldDescriptor)
-
- // Get retrieves the value for a field.
- //
- // For unpopulated scalars, it returns the default value, where
- // the default value of a bytes scalar is guaranteed to be a copy.
- // For unpopulated composite types, it returns an empty, read-only view
- // of the value; to obtain a mutable reference, use Mutable.
- Get(FieldDescriptor) Value
-
- // Set stores the value for a field.
- //
- // For a field belonging to a oneof, it implicitly clears any other field
- // that may be currently set within the same oneof.
- // For extension fields, it implicitly stores the provided ExtensionType.
- // When setting a composite type, it is unspecified whether the stored value
- // aliases the source's memory in any way. If the composite value is an
- // empty, read-only value, then it panics.
- //
- // Set is a mutating operation and unsafe for concurrent use.
- Set(FieldDescriptor, Value)
-
- // Mutable returns a mutable reference to a composite type.
- //
- // If the field is unpopulated, it may allocate a composite value.
- // For a field belonging to a oneof, it implicitly clears any other field
- // that may be currently set within the same oneof.
- // For extension fields, it implicitly stores the provided ExtensionType
- // if not already stored.
- // It panics if the field does not contain a composite type.
- //
- // Mutable is a mutating operation and unsafe for concurrent use.
- Mutable(FieldDescriptor) Value
-
- // NewField returns a new value that is assignable to the field
- // for the given descriptor. For scalars, this returns the default value.
- // For lists, maps, and messages, this returns a new, empty, mutable value.
- NewField(FieldDescriptor) Value
-
- // WhichOneof reports which field within the oneof is populated,
- // returning nil if none are populated.
- // It panics if the oneof descriptor does not belong to this message.
- WhichOneof(OneofDescriptor) FieldDescriptor
-
- // GetUnknown retrieves the entire list of unknown fields.
- // The caller may only mutate the contents of the RawFields
- // if the mutated bytes are stored back into the message with SetUnknown.
- GetUnknown() RawFields
-
- // SetUnknown stores an entire list of unknown fields.
- // The raw fields must be syntactically valid according to the wire format.
- // An implementation may panic if this is not the case.
- // Once stored, the caller must not mutate the content of the RawFields.
- // An empty RawFields may be passed to clear the fields.
- //
- // SetUnknown is a mutating operation and unsafe for concurrent use.
- SetUnknown(RawFields)
-
- // IsValid reports whether the message is valid.
- //
- // An invalid message is an empty, read-only value.
- //
- // An invalid message often corresponds to a nil pointer of the concrete
- // message type, but the details are implementation dependent.
- // Validity is not part of the protobuf data model, and may not
- // be preserved in marshaling or other operations.
- IsValid() bool
-
- // ProtoMethods returns optional fast-path implementations of various operations.
- // This method may return nil.
- //
- // The returned methods type is identical to
- // google.golang.org/protobuf/runtime/protoiface.Methods.
- // Consult the protoiface package documentation for details.
- ProtoMethods() *methods
-}
-
-// RawFields is the raw bytes for an ordered sequence of fields.
-// Each field contains both the tag (representing field number and wire type),
-// and also the wire data itself.
-type RawFields []byte
-
-// IsValid reports whether b is syntactically correct wire format.
-func (b RawFields) IsValid() bool {
- for len(b) > 0 {
- _, _, n := protowire.ConsumeField(b)
- if n < 0 {
- return false
- }
- b = b[n:]
- }
- return true
-}
-
-// List is a zero-indexed, ordered list.
-// The element [Value] type is determined by [FieldDescriptor.Kind].
-// Providing a [Value] that is invalid or of an incorrect type panics.
-type List interface {
- // Len reports the number of entries in the List.
- // Get, Set, and Truncate panic with out of bound indexes.
- Len() int
-
- // Get retrieves the value at the given index.
- // It never returns an invalid value.
- Get(int) Value
-
- // Set stores a value for the given index.
- // When setting a composite type, it is unspecified whether the set
- // value aliases the source's memory in any way.
- //
- // Set is a mutating operation and unsafe for concurrent use.
- Set(int, Value)
-
- // Append appends the provided value to the end of the list.
- // When appending a composite type, it is unspecified whether the appended
- // value aliases the source's memory in any way.
- //
- // Append is a mutating operation and unsafe for concurrent use.
- Append(Value)
-
- // AppendMutable appends a new, empty, mutable message value to the end
- // of the list and returns it.
- // It panics if the list does not contain a message type.
- AppendMutable() Value
-
- // Truncate truncates the list to a smaller length.
- //
- // Truncate is a mutating operation and unsafe for concurrent use.
- Truncate(int)
-
- // NewElement returns a new value for a list element.
- // For enums, this returns the first enum value.
- // For other scalars, this returns the zero value.
- // For messages, this returns a new, empty, mutable value.
- NewElement() Value
-
- // IsValid reports whether the list is valid.
- //
- // An invalid list is an empty, read-only value.
- //
- // Validity is not part of the protobuf data model, and may not
- // be preserved in marshaling or other operations.
- IsValid() bool
-}
-
-// Map is an unordered, associative map.
-// The entry [MapKey] type is determined by [FieldDescriptor.MapKey].Kind.
-// The entry [Value] type is determined by [FieldDescriptor.MapValue].Kind.
-// Providing a [MapKey] or [Value] that is invalid or of an incorrect type panics.
-type Map interface {
- // Len reports the number of elements in the map.
- Len() int
-
- // Range iterates over every map entry in an undefined order,
- // calling f for each key and value encountered.
- // Range calls f Len times unless f returns false, which stops iteration.
- // While iterating, mutating operations may only be performed
- // on the current map key.
- Range(f func(MapKey, Value) bool)
-
- // Has reports whether an entry with the given key is in the map.
- Has(MapKey) bool
-
- // Clear clears the entry associated with they given key.
- // The operation does nothing if there is no entry associated with the key.
- //
- // Clear is a mutating operation and unsafe for concurrent use.
- Clear(MapKey)
-
- // Get retrieves the value for an entry with the given key.
- // It returns an invalid value for non-existent entries.
- Get(MapKey) Value
-
- // Set stores the value for an entry with the given key.
- // It panics when given a key or value that is invalid or the wrong type.
- // When setting a composite type, it is unspecified whether the set
- // value aliases the source's memory in any way.
- //
- // Set is a mutating operation and unsafe for concurrent use.
- Set(MapKey, Value)
-
- // Mutable retrieves a mutable reference to the entry for the given key.
- // If no entry exists for the key, it creates a new, empty, mutable value
- // and stores it as the entry for the key.
- // It panics if the map value is not a message.
- Mutable(MapKey) Value
-
- // NewValue returns a new value assignable as a map value.
- // For enums, this returns the first enum value.
- // For other scalars, this returns the zero value.
- // For messages, this returns a new, empty, mutable value.
- NewValue() Value
-
- // IsValid reports whether the map is valid.
- //
- // An invalid map is an empty, read-only value.
- //
- // An invalid message often corresponds to a nil Go map value,
- // but the details are implementation dependent.
- // Validity is not part of the protobuf data model, and may not
- // be preserved in marshaling or other operations.
- IsValid() bool
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go
deleted file mode 100644
index 654599d..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_equal.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright 2022 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.
-
-package protoreflect
-
-import (
- "bytes"
- "fmt"
- "math"
- "reflect"
-
- "google.golang.org/protobuf/encoding/protowire"
-)
-
-// Equal reports whether v1 and v2 are recursively equal.
-//
-// - Values of different types are always unequal.
-//
-// - Bytes values are equal if they contain identical bytes.
-// Empty bytes (regardless of nil-ness) are considered equal.
-//
-// - Floating point values are equal if they contain the same value.
-// Unlike the == operator, a NaN is equal to another NaN.
-//
-// - Enums are equal if they contain the same number.
-// Since [Value] does not contain an enum descriptor,
-// enum values do not consider the type of the enum.
-//
-// - Other scalar values are equal if they contain the same value.
-//
-// - [Message] values are equal if they belong to the same message descriptor,
-// have the same set of populated known and extension field values,
-// and the same set of unknown fields values.
-//
-// - [List] values are equal if they are the same length and
-// each corresponding element is equal.
-//
-// - [Map] values are equal if they have the same set of keys and
-// the corresponding value for each key is equal.
-func (v1 Value) Equal(v2 Value) bool {
- return equalValue(v1, v2)
-}
-
-func equalValue(x, y Value) bool {
- eqType := x.typ == y.typ
- switch x.typ {
- case nilType:
- return eqType
- case boolType:
- return eqType && x.Bool() == y.Bool()
- case int32Type, int64Type:
- return eqType && x.Int() == y.Int()
- case uint32Type, uint64Type:
- return eqType && x.Uint() == y.Uint()
- case float32Type, float64Type:
- return eqType && equalFloat(x.Float(), y.Float())
- case stringType:
- return eqType && x.String() == y.String()
- case bytesType:
- return eqType && bytes.Equal(x.Bytes(), y.Bytes())
- case enumType:
- return eqType && x.Enum() == y.Enum()
- default:
- switch x := x.Interface().(type) {
- case Message:
- y, ok := y.Interface().(Message)
- return ok && equalMessage(x, y)
- case List:
- y, ok := y.Interface().(List)
- return ok && equalList(x, y)
- case Map:
- y, ok := y.Interface().(Map)
- return ok && equalMap(x, y)
- default:
- panic(fmt.Sprintf("unknown type: %T", x))
- }
- }
-}
-
-// equalFloat compares two floats, where NaNs are treated as equal.
-func equalFloat(x, y float64) bool {
- if math.IsNaN(x) || math.IsNaN(y) {
- return math.IsNaN(x) && math.IsNaN(y)
- }
- return x == y
-}
-
-// equalMessage compares two messages.
-func equalMessage(mx, my Message) bool {
- if mx.Descriptor() != my.Descriptor() {
- return false
- }
-
- nx := 0
- equal := true
- mx.Range(func(fd FieldDescriptor, vx Value) bool {
- nx++
- vy := my.Get(fd)
- equal = my.Has(fd) && equalValue(vx, vy)
- return equal
- })
- if !equal {
- return false
- }
- ny := 0
- my.Range(func(fd FieldDescriptor, vx Value) bool {
- ny++
- return true
- })
- if nx != ny {
- return false
- }
-
- return equalUnknown(mx.GetUnknown(), my.GetUnknown())
-}
-
-// equalList compares two lists.
-func equalList(x, y List) bool {
- if x.Len() != y.Len() {
- return false
- }
- for i := x.Len() - 1; i >= 0; i-- {
- if !equalValue(x.Get(i), y.Get(i)) {
- return false
- }
- }
- return true
-}
-
-// equalMap compares two maps.
-func equalMap(x, y Map) bool {
- if x.Len() != y.Len() {
- return false
- }
- equal := true
- x.Range(func(k MapKey, vx Value) bool {
- vy := y.Get(k)
- equal = y.Has(k) && equalValue(vx, vy)
- return equal
- })
- return equal
-}
-
-// equalUnknown compares unknown fields by direct comparison on the raw bytes
-// of each individual field number.
-func equalUnknown(x, y RawFields) bool {
- if len(x) != len(y) {
- return false
- }
- if bytes.Equal([]byte(x), []byte(y)) {
- return true
- }
-
- mx := make(map[FieldNumber]RawFields)
- my := make(map[FieldNumber]RawFields)
- for len(x) > 0 {
- fnum, _, n := protowire.ConsumeField(x)
- mx[fnum] = append(mx[fnum], x[:n]...)
- x = x[n:]
- }
- for len(y) > 0 {
- fnum, _, n := protowire.ConsumeField(y)
- my[fnum] = append(my[fnum], y[:n]...)
- y = y[n:]
- }
- return reflect.DeepEqual(mx, my)
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
deleted file mode 100644
index 7ced876..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2018 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.
-
-//go:build purego || appengine
-// +build purego appengine
-
-package protoreflect
-
-import "google.golang.org/protobuf/internal/pragma"
-
-type valueType int
-
-const (
- nilType valueType = iota
- boolType
- int32Type
- int64Type
- uint32Type
- uint64Type
- float32Type
- float64Type
- stringType
- bytesType
- enumType
- ifaceType
-)
-
-// value is a union where only one type can be represented at a time.
-// This uses a distinct field for each type. This is type safe in Go, but
-// occupies more memory than necessary (72B).
-type value struct {
- pragma.DoNotCompare // 0B
-
- typ valueType // 8B
- num uint64 // 8B
- str string // 16B
- bin []byte // 24B
- iface interface{} // 16B
-}
-
-func valueOfString(v string) Value {
- return Value{typ: stringType, str: v}
-}
-func valueOfBytes(v []byte) Value {
- return Value{typ: bytesType, bin: v}
-}
-func valueOfIface(v interface{}) Value {
- return Value{typ: ifaceType, iface: v}
-}
-
-func (v Value) getString() string {
- return v.str
-}
-func (v Value) getBytes() []byte {
- return v.bin
-}
-func (v Value) getIface() interface{} {
- return v.iface
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
deleted file mode 100644
index 1603097..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright 2018 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.
-
-package protoreflect
-
-import (
- "fmt"
- "math"
-)
-
-// Value is a union where only one Go type may be set at a time.
-// The Value is used to represent all possible values a field may take.
-// The following shows which Go type is used to represent each proto [Kind]:
-//
-// ╔════════════╤═════════════════════════════════════╗
-// ║ Go type │ Protobuf kind ║
-// ╠════════════╪═════════════════════════════════════╣
-// ║ bool │ BoolKind ║
-// ║ int32 │ Int32Kind, Sint32Kind, Sfixed32Kind ║
-// ║ int64 │ Int64Kind, Sint64Kind, Sfixed64Kind ║
-// ║ uint32 │ Uint32Kind, Fixed32Kind ║
-// ║ uint64 │ Uint64Kind, Fixed64Kind ║
-// ║ float32 │ FloatKind ║
-// ║ float64 │ DoubleKind ║
-// ║ string │ StringKind ║
-// ║ []byte │ BytesKind ║
-// ║ EnumNumber │ EnumKind ║
-// ║ Message │ MessageKind, GroupKind ║
-// ╚════════════╧═════════════════════════════════════╝
-//
-// Multiple protobuf Kinds may be represented by a single Go type if the type
-// can losslessly represent the information for the proto kind. For example,
-// [Int64Kind], [Sint64Kind], and [Sfixed64Kind] are all represented by int64,
-// but use different integer encoding methods.
-//
-// The [List] or [Map] types are used if the field cardinality is repeated.
-// A field is a [List] if [FieldDescriptor.IsList] reports true.
-// A field is a [Map] if [FieldDescriptor.IsMap] reports true.
-//
-// Converting to/from a Value and a concrete Go value panics on type mismatch.
-// For example, [ValueOf]("hello").Int() panics because this attempts to
-// retrieve an int64 from a string.
-//
-// [List], [Map], and [Message] Values are called "composite" values.
-//
-// A composite Value may alias (reference) memory at some location,
-// such that changes to the Value updates the that location.
-// A composite value acquired with a Mutable method, such as [Message.Mutable],
-// always references the source object.
-//
-// For example:
-//
-// // Append a 0 to a "repeated int32" field.
-// // Since the Value returned by Mutable is guaranteed to alias
-// // the source message, modifying the Value modifies the message.
-// message.Mutable(fieldDesc).List().Append(protoreflect.ValueOfInt32(0))
-//
-// // Assign [0] to a "repeated int32" field by creating a new Value,
-// // modifying it, and assigning it.
-// list := message.NewField(fieldDesc).List()
-// list.Append(protoreflect.ValueOfInt32(0))
-// message.Set(fieldDesc, list)
-// // ERROR: Since it is not defined whether Set aliases the source,
-// // appending to the List here may or may not modify the message.
-// list.Append(protoreflect.ValueOfInt32(0))
-//
-// Some operations, such as [Message.Get], may return an "empty, read-only"
-// composite Value. Modifying an empty, read-only value panics.
-type Value value
-
-// The protoreflect API uses a custom Value union type instead of interface{}
-// to keep the future open for performance optimizations. Using an interface{}
-// always incurs an allocation for primitives (e.g., int64) since it needs to
-// be boxed on the heap (as interfaces can only contain pointers natively).
-// Instead, we represent the Value union as a flat struct that internally keeps
-// track of which type is set. Using unsafe, the Value union can be reduced
-// down to 24B, which is identical in size to a slice.
-//
-// The latest compiler (Go1.11) currently suffers from some limitations:
-// • With inlining, the compiler should be able to statically prove that
-// only one of these switch cases are taken and inline one specific case.
-// See https://golang.org/issue/22310.
-
-// ValueOf returns a Value initialized with the concrete value stored in v.
-// This panics if the type does not match one of the allowed types in the
-// Value union.
-func ValueOf(v interface{}) Value {
- switch v := v.(type) {
- case nil:
- return Value{}
- case bool:
- return ValueOfBool(v)
- case int32:
- return ValueOfInt32(v)
- case int64:
- return ValueOfInt64(v)
- case uint32:
- return ValueOfUint32(v)
- case uint64:
- return ValueOfUint64(v)
- case float32:
- return ValueOfFloat32(v)
- case float64:
- return ValueOfFloat64(v)
- case string:
- return ValueOfString(v)
- case []byte:
- return ValueOfBytes(v)
- case EnumNumber:
- return ValueOfEnum(v)
- case Message, List, Map:
- return valueOfIface(v)
- case ProtoMessage:
- panic(fmt.Sprintf("invalid proto.Message(%T) type, expected a protoreflect.Message type", v))
- default:
- panic(fmt.Sprintf("invalid type: %T", v))
- }
-}
-
-// ValueOfBool returns a new boolean value.
-func ValueOfBool(v bool) Value {
- if v {
- return Value{typ: boolType, num: 1}
- } else {
- return Value{typ: boolType, num: 0}
- }
-}
-
-// ValueOfInt32 returns a new int32 value.
-func ValueOfInt32(v int32) Value {
- return Value{typ: int32Type, num: uint64(v)}
-}
-
-// ValueOfInt64 returns a new int64 value.
-func ValueOfInt64(v int64) Value {
- return Value{typ: int64Type, num: uint64(v)}
-}
-
-// ValueOfUint32 returns a new uint32 value.
-func ValueOfUint32(v uint32) Value {
- return Value{typ: uint32Type, num: uint64(v)}
-}
-
-// ValueOfUint64 returns a new uint64 value.
-func ValueOfUint64(v uint64) Value {
- return Value{typ: uint64Type, num: v}
-}
-
-// ValueOfFloat32 returns a new float32 value.
-func ValueOfFloat32(v float32) Value {
- return Value{typ: float32Type, num: uint64(math.Float64bits(float64(v)))}
-}
-
-// ValueOfFloat64 returns a new float64 value.
-func ValueOfFloat64(v float64) Value {
- return Value{typ: float64Type, num: uint64(math.Float64bits(float64(v)))}
-}
-
-// ValueOfString returns a new string value.
-func ValueOfString(v string) Value {
- return valueOfString(v)
-}
-
-// ValueOfBytes returns a new bytes value.
-func ValueOfBytes(v []byte) Value {
- return valueOfBytes(v[:len(v):len(v)])
-}
-
-// ValueOfEnum returns a new enum value.
-func ValueOfEnum(v EnumNumber) Value {
- return Value{typ: enumType, num: uint64(v)}
-}
-
-// ValueOfMessage returns a new Message value.
-func ValueOfMessage(v Message) Value {
- return valueOfIface(v)
-}
-
-// ValueOfList returns a new List value.
-func ValueOfList(v List) Value {
- return valueOfIface(v)
-}
-
-// ValueOfMap returns a new Map value.
-func ValueOfMap(v Map) Value {
- return valueOfIface(v)
-}
-
-// IsValid reports whether v is populated with a value.
-func (v Value) IsValid() bool {
- return v.typ != nilType
-}
-
-// Interface returns v as an interface{}.
-//
-// Invariant: v == ValueOf(v).Interface()
-func (v Value) Interface() interface{} {
- switch v.typ {
- case nilType:
- return nil
- case boolType:
- return v.Bool()
- case int32Type:
- return int32(v.Int())
- case int64Type:
- return int64(v.Int())
- case uint32Type:
- return uint32(v.Uint())
- case uint64Type:
- return uint64(v.Uint())
- case float32Type:
- return float32(v.Float())
- case float64Type:
- return float64(v.Float())
- case stringType:
- return v.String()
- case bytesType:
- return v.Bytes()
- case enumType:
- return v.Enum()
- default:
- return v.getIface()
- }
-}
-
-func (v Value) typeName() string {
- switch v.typ {
- case nilType:
- return "nil"
- case boolType:
- return "bool"
- case int32Type:
- return "int32"
- case int64Type:
- return "int64"
- case uint32Type:
- return "uint32"
- case uint64Type:
- return "uint64"
- case float32Type:
- return "float32"
- case float64Type:
- return "float64"
- case stringType:
- return "string"
- case bytesType:
- return "bytes"
- case enumType:
- return "enum"
- default:
- switch v := v.getIface().(type) {
- case Message:
- return "message"
- case List:
- return "list"
- case Map:
- return "map"
- default:
- return fmt.Sprintf("", v)
- }
- }
-}
-
-func (v Value) panicMessage(what string) string {
- return fmt.Sprintf("type mismatch: cannot convert %v to %s", v.typeName(), what)
-}
-
-// Bool returns v as a bool and panics if the type is not a bool.
-func (v Value) Bool() bool {
- switch v.typ {
- case boolType:
- return v.num > 0
- default:
- panic(v.panicMessage("bool"))
- }
-}
-
-// Int returns v as a int64 and panics if the type is not a int32 or int64.
-func (v Value) Int() int64 {
- switch v.typ {
- case int32Type, int64Type:
- return int64(v.num)
- default:
- panic(v.panicMessage("int"))
- }
-}
-
-// Uint returns v as a uint64 and panics if the type is not a uint32 or uint64.
-func (v Value) Uint() uint64 {
- switch v.typ {
- case uint32Type, uint64Type:
- return uint64(v.num)
- default:
- panic(v.panicMessage("uint"))
- }
-}
-
-// Float returns v as a float64 and panics if the type is not a float32 or float64.
-func (v Value) Float() float64 {
- switch v.typ {
- case float32Type, float64Type:
- return math.Float64frombits(uint64(v.num))
- default:
- panic(v.panicMessage("float"))
- }
-}
-
-// String returns v as a string. Since this method implements [fmt.Stringer],
-// this returns the formatted string value for any non-string type.
-func (v Value) String() string {
- switch v.typ {
- case stringType:
- return v.getString()
- default:
- return fmt.Sprint(v.Interface())
- }
-}
-
-// Bytes returns v as a []byte and panics if the type is not a []byte.
-func (v Value) Bytes() []byte {
- switch v.typ {
- case bytesType:
- return v.getBytes()
- default:
- panic(v.panicMessage("bytes"))
- }
-}
-
-// Enum returns v as a [EnumNumber] and panics if the type is not a [EnumNumber].
-func (v Value) Enum() EnumNumber {
- switch v.typ {
- case enumType:
- return EnumNumber(v.num)
- default:
- panic(v.panicMessage("enum"))
- }
-}
-
-// Message returns v as a [Message] and panics if the type is not a [Message].
-func (v Value) Message() Message {
- switch vi := v.getIface().(type) {
- case Message:
- return vi
- default:
- panic(v.panicMessage("message"))
- }
-}
-
-// List returns v as a [List] and panics if the type is not a [List].
-func (v Value) List() List {
- switch vi := v.getIface().(type) {
- case List:
- return vi
- default:
- panic(v.panicMessage("list"))
- }
-}
-
-// Map returns v as a [Map] and panics if the type is not a [Map].
-func (v Value) Map() Map {
- switch vi := v.getIface().(type) {
- case Map:
- return vi
- default:
- panic(v.panicMessage("map"))
- }
-}
-
-// MapKey returns v as a [MapKey] and panics for invalid [MapKey] types.
-func (v Value) MapKey() MapKey {
- switch v.typ {
- case boolType, int32Type, int64Type, uint32Type, uint64Type, stringType:
- return MapKey(v)
- default:
- panic(v.panicMessage("map key"))
- }
-}
-
-// MapKey is used to index maps, where the Go type of the MapKey must match
-// the specified key [Kind] (see [MessageDescriptor.IsMapEntry]).
-// The following shows what Go type is used to represent each proto [Kind]:
-//
-// ╔═════════╤═════════════════════════════════════╗
-// ║ Go type │ Protobuf kind ║
-// ╠═════════╪═════════════════════════════════════╣
-// ║ bool │ BoolKind ║
-// ║ int32 │ Int32Kind, Sint32Kind, Sfixed32Kind ║
-// ║ int64 │ Int64Kind, Sint64Kind, Sfixed64Kind ║
-// ║ uint32 │ Uint32Kind, Fixed32Kind ║
-// ║ uint64 │ Uint64Kind, Fixed64Kind ║
-// ║ string │ StringKind ║
-// ╚═════════╧═════════════════════════════════════╝
-//
-// A MapKey is constructed and accessed through a [Value]:
-//
-// k := ValueOf("hash").MapKey() // convert string to MapKey
-// s := k.String() // convert MapKey to string
-//
-// The MapKey is a strict subset of valid types used in [Value];
-// converting a [Value] to a MapKey with an invalid type panics.
-type MapKey value
-
-// IsValid reports whether k is populated with a value.
-func (k MapKey) IsValid() bool {
- return Value(k).IsValid()
-}
-
-// Interface returns k as an interface{}.
-func (k MapKey) Interface() interface{} {
- return Value(k).Interface()
-}
-
-// Bool returns k as a bool and panics if the type is not a bool.
-func (k MapKey) Bool() bool {
- return Value(k).Bool()
-}
-
-// Int returns k as a int64 and panics if the type is not a int32 or int64.
-func (k MapKey) Int() int64 {
- return Value(k).Int()
-}
-
-// Uint returns k as a uint64 and panics if the type is not a uint32 or uint64.
-func (k MapKey) Uint() uint64 {
- return Value(k).Uint()
-}
-
-// String returns k as a string. Since this method implements [fmt.Stringer],
-// this returns the formatted string value for any non-string type.
-func (k MapKey) String() string {
- return Value(k).String()
-}
-
-// Value returns k as a [Value].
-func (k MapKey) Value() Value {
- return Value(k)
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
deleted file mode 100644
index b1fdbe3..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !purego && !appengine && !go1.21
-// +build !purego,!appengine,!go1.21
-
-package protoreflect
-
-import (
- "unsafe"
-
- "google.golang.org/protobuf/internal/pragma"
-)
-
-type (
- stringHeader struct {
- Data unsafe.Pointer
- Len int
- }
- sliceHeader struct {
- Data unsafe.Pointer
- Len int
- Cap int
- }
- ifaceHeader struct {
- Type unsafe.Pointer
- Data unsafe.Pointer
- }
-)
-
-var (
- nilType = typeOf(nil)
- boolType = typeOf(*new(bool))
- int32Type = typeOf(*new(int32))
- int64Type = typeOf(*new(int64))
- uint32Type = typeOf(*new(uint32))
- uint64Type = typeOf(*new(uint64))
- float32Type = typeOf(*new(float32))
- float64Type = typeOf(*new(float64))
- stringType = typeOf(*new(string))
- bytesType = typeOf(*new([]byte))
- enumType = typeOf(*new(EnumNumber))
-)
-
-// typeOf returns a pointer to the Go type information.
-// The pointer is comparable and equal if and only if the types are identical.
-func typeOf(t interface{}) unsafe.Pointer {
- return (*ifaceHeader)(unsafe.Pointer(&t)).Type
-}
-
-// value is a union where only one type can be represented at a time.
-// The struct is 24B large on 64-bit systems and requires the minimum storage
-// necessary to represent each possible type.
-//
-// The Go GC needs to be able to scan variables containing pointers.
-// As such, pointers and non-pointers cannot be intermixed.
-type value struct {
- pragma.DoNotCompare // 0B
-
- // typ stores the type of the value as a pointer to the Go type.
- typ unsafe.Pointer // 8B
-
- // ptr stores the data pointer for a String, Bytes, or interface value.
- ptr unsafe.Pointer // 8B
-
- // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or
- // Enum value as a raw uint64.
- //
- // It is also used to store the length of a String or Bytes value;
- // the capacity is ignored.
- num uint64 // 8B
-}
-
-func valueOfString(v string) Value {
- p := (*stringHeader)(unsafe.Pointer(&v))
- return Value{typ: stringType, ptr: p.Data, num: uint64(len(v))}
-}
-func valueOfBytes(v []byte) Value {
- p := (*sliceHeader)(unsafe.Pointer(&v))
- return Value{typ: bytesType, ptr: p.Data, num: uint64(len(v))}
-}
-func valueOfIface(v interface{}) Value {
- p := (*ifaceHeader)(unsafe.Pointer(&v))
- return Value{typ: p.Type, ptr: p.Data}
-}
-
-func (v Value) getString() (x string) {
- *(*stringHeader)(unsafe.Pointer(&x)) = stringHeader{Data: v.ptr, Len: int(v.num)}
- return x
-}
-func (v Value) getBytes() (x []byte) {
- *(*sliceHeader)(unsafe.Pointer(&x)) = sliceHeader{Data: v.ptr, Len: int(v.num), Cap: int(v.num)}
- return x
-}
-func (v Value) getIface() (x interface{}) {
- *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
- return x
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go b/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
deleted file mode 100644
index 4354701..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go121.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2018 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.
-
-//go:build !purego && !appengine && go1.21
-// +build !purego,!appengine,go1.21
-
-package protoreflect
-
-import (
- "unsafe"
-
- "google.golang.org/protobuf/internal/pragma"
-)
-
-type (
- ifaceHeader struct {
- _ [0]interface{} // if interfaces have greater alignment than unsafe.Pointer, this will enforce it.
- Type unsafe.Pointer
- Data unsafe.Pointer
- }
-)
-
-var (
- nilType = typeOf(nil)
- boolType = typeOf(*new(bool))
- int32Type = typeOf(*new(int32))
- int64Type = typeOf(*new(int64))
- uint32Type = typeOf(*new(uint32))
- uint64Type = typeOf(*new(uint64))
- float32Type = typeOf(*new(float32))
- float64Type = typeOf(*new(float64))
- stringType = typeOf(*new(string))
- bytesType = typeOf(*new([]byte))
- enumType = typeOf(*new(EnumNumber))
-)
-
-// typeOf returns a pointer to the Go type information.
-// The pointer is comparable and equal if and only if the types are identical.
-func typeOf(t interface{}) unsafe.Pointer {
- return (*ifaceHeader)(unsafe.Pointer(&t)).Type
-}
-
-// value is a union where only one type can be represented at a time.
-// The struct is 24B large on 64-bit systems and requires the minimum storage
-// necessary to represent each possible type.
-//
-// The Go GC needs to be able to scan variables containing pointers.
-// As such, pointers and non-pointers cannot be intermixed.
-type value struct {
- pragma.DoNotCompare // 0B
-
- // typ stores the type of the value as a pointer to the Go type.
- typ unsafe.Pointer // 8B
-
- // ptr stores the data pointer for a String, Bytes, or interface value.
- ptr unsafe.Pointer // 8B
-
- // num stores a Bool, Int32, Int64, Uint32, Uint64, Float32, Float64, or
- // Enum value as a raw uint64.
- //
- // It is also used to store the length of a String or Bytes value;
- // the capacity is ignored.
- num uint64 // 8B
-}
-
-func valueOfString(v string) Value {
- return Value{typ: stringType, ptr: unsafe.Pointer(unsafe.StringData(v)), num: uint64(len(v))}
-}
-func valueOfBytes(v []byte) Value {
- return Value{typ: bytesType, ptr: unsafe.Pointer(unsafe.SliceData(v)), num: uint64(len(v))}
-}
-func valueOfIface(v interface{}) Value {
- p := (*ifaceHeader)(unsafe.Pointer(&v))
- return Value{typ: p.Type, ptr: p.Data}
-}
-
-func (v Value) getString() string {
- return unsafe.String((*byte)(v.ptr), v.num)
-}
-func (v Value) getBytes() []byte {
- return unsafe.Slice((*byte)(v.ptr), v.num)
-}
-func (v Value) getIface() (x interface{}) {
- *(*ifaceHeader)(unsafe.Pointer(&x)) = ifaceHeader{Type: v.typ, Data: v.ptr}
- return x
-}
diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
deleted file mode 100644
index 6267dc5..0000000
--- a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go
+++ /dev/null
@@ -1,882 +0,0 @@
-// Copyright 2018 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.
-
-// Package protoregistry provides data structures to register and lookup
-// protobuf descriptor types.
-//
-// The [Files] registry contains file descriptors and provides the ability
-// to iterate over the files or lookup a specific descriptor within the files.
-// [Files] only contains protobuf descriptors and has no understanding of Go
-// type information that may be associated with each descriptor.
-//
-// The [Types] registry contains descriptor types for which there is a known
-// Go type associated with that descriptor. It provides the ability to iterate
-// over the registered types or lookup a type by name.
-package protoregistry
-
-import (
- "fmt"
- "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 {
- const env = "GOLANG_PROTOBUF_REGISTRATION_CONFLICT"
- const faq = "https://protobuf.dev/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
-
-// GlobalFiles is a global registry of file descriptors.
-var GlobalFiles *Files = new(Files)
-
-// GlobalTypes is the registry used by default for type lookups
-// unless a local registry is provided by the user.
-var GlobalTypes *Types = new(Types)
-
-// NotFound is a sentinel error value to indicate that the type was not found.
-//
-// Since registry lookup can happen in the critical performance path, resolvers
-// must return this exact error value, not an error wrapping it.
-var NotFound = errors.New("not found")
-
-// Files is a registry for looking up or iterating over files and the
-// descriptors contained within them.
-// The Find and Range methods are safe for concurrent use.
-type Files struct {
- // The map of descsByName contains:
- // EnumDescriptor
- // EnumValueDescriptor
- // MessageDescriptor
- // ExtensionDescriptor
- // ServiceDescriptor
- // *packageDescriptor
- //
- // Note that files are stored as a slice, since a package may contain
- // multiple files. Only top-level declarations are registered.
- // Note that enum values are in the top-level since that are in the same
- // scope as the parent enum.
- descsByName map[protoreflect.FullName]interface{}
- filesByPath map[string][]protoreflect.FileDescriptor
- numFiles int
-}
-
-type packageDescriptor struct {
- files []protoreflect.FileDescriptor
-}
-
-// RegisterFile registers the provided file descriptor.
-//
-// If any descriptor within the file conflicts with the descriptor of any
-// previously registered file (e.g., two enums with the same full name),
-// then the file is not registered and an error is returned.
-//
-// It is permitted for multiple files to have the same file path.
-func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error {
- if r == GlobalFiles {
- globalMutex.Lock()
- defer globalMutex.Unlock()
- }
- if r.descsByName == nil {
- r.descsByName = map[protoreflect.FullName]interface{}{
- "": &packageDescriptor{},
- }
- r.filesByPath = make(map[string][]protoreflect.FileDescriptor)
- }
- path := file.Path()
- if prev := r.filesByPath[path]; len(prev) > 0 {
- r.checkGenProtoConflict(path)
- err := errors.New("file %q is already registered", file.Path())
- err = amendErrorWithCaller(err, prev[0], file)
- if !(r == GlobalFiles && ignoreConflict(file, err)) {
- return err
- }
- }
-
- for name := file.Package(); name != ""; name = name.Parent() {
- switch prev := r.descsByName[name]; prev.(type) {
- case nil, *packageDescriptor:
- default:
- err := errors.New("file %q has a package name conflict over %v", file.Path(), name)
- err = amendErrorWithCaller(err, prev, file)
- if r == GlobalFiles && ignoreConflict(file, err) {
- err = nil
- }
- return err
- }
- }
- var err error
- var hasConflict bool
- rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {
- if prev := r.descsByName[d.FullName()]; prev != nil {
- hasConflict = true
- err = errors.New("file %q has a name conflict over %v", file.Path(), d.FullName())
- err = amendErrorWithCaller(err, prev, file)
- if r == GlobalFiles && ignoreConflict(d, err) {
- err = nil
- }
- }
- })
- if hasConflict {
- return err
- }
-
- for name := file.Package(); name != ""; name = name.Parent() {
- if r.descsByName[name] == nil {
- r.descsByName[name] = &packageDescriptor{}
- }
- }
- p := r.descsByName[file.Package()].(*packageDescriptor)
- p.files = append(p.files, file)
- rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) {
- r.descsByName[d.FullName()] = d
- })
- r.filesByPath[path] = append(r.filesByPath[path], file)
- r.numFiles++
- 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.
-func (r *Files) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error) {
- if r == nil {
- return nil, NotFound
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- prefix := name
- suffix := nameSuffix("")
- for prefix != "" {
- if d, ok := r.descsByName[prefix]; ok {
- switch d := d.(type) {
- case protoreflect.EnumDescriptor:
- if d.FullName() == name {
- return d, nil
- }
- case protoreflect.EnumValueDescriptor:
- if d.FullName() == name {
- return d, nil
- }
- case protoreflect.MessageDescriptor:
- if d.FullName() == name {
- return d, nil
- }
- if d := findDescriptorInMessage(d, suffix); d != nil && d.FullName() == name {
- return d, nil
- }
- case protoreflect.ExtensionDescriptor:
- if d.FullName() == name {
- return d, nil
- }
- case protoreflect.ServiceDescriptor:
- if d.FullName() == name {
- return d, nil
- }
- if d := d.Methods().ByName(suffix.Pop()); d != nil && d.FullName() == name {
- return d, nil
- }
- }
- return nil, NotFound
- }
- prefix = prefix.Parent()
- suffix = nameSuffix(name[len(prefix)+len("."):])
- }
- return nil, NotFound
-}
-
-func findDescriptorInMessage(md protoreflect.MessageDescriptor, suffix nameSuffix) protoreflect.Descriptor {
- name := suffix.Pop()
- if suffix == "" {
- if ed := md.Enums().ByName(name); ed != nil {
- return ed
- }
- for i := md.Enums().Len() - 1; i >= 0; i-- {
- if vd := md.Enums().Get(i).Values().ByName(name); vd != nil {
- return vd
- }
- }
- if xd := md.Extensions().ByName(name); xd != nil {
- return xd
- }
- if fd := md.Fields().ByName(name); fd != nil {
- return fd
- }
- if od := md.Oneofs().ByName(name); od != nil {
- return od
- }
- }
- if md := md.Messages().ByName(name); md != nil {
- if suffix == "" {
- return md
- }
- return findDescriptorInMessage(md, suffix)
- }
- return nil
-}
-
-type nameSuffix string
-
-func (s *nameSuffix) Pop() (name protoreflect.Name) {
- if i := strings.IndexByte(string(*s), '.'); i >= 0 {
- name, *s = protoreflect.Name((*s)[:i]), (*s)[i+1:]
- } else {
- name, *s = protoreflect.Name((*s)), ""
- }
- return name
-}
-
-// FindFileByPath looks up a file by the path.
-//
-// This returns (nil, [NotFound]) if not found.
-// This returns an error if multiple files have the same path.
-func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) {
- if r == nil {
- return nil, NotFound
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- fds := r.filesByPath[path]
- switch len(fds) {
- case 0:
- return nil, NotFound
- case 1:
- return fds[0], nil
- default:
- return nil, errors.New("multiple files named %q", path)
- }
-}
-
-// NumFiles reports the number of registered files,
-// including duplicate files with the same name.
-func (r *Files) NumFiles() int {
- if r == nil {
- return 0
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- return r.numFiles
-}
-
-// RangeFiles iterates over all registered files while f returns true.
-// If multiple files have the same name, RangeFiles iterates over all of them.
-// The iteration order is undefined.
-func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) {
- if r == nil {
- return
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- for _, files := range r.filesByPath {
- for _, file := range files {
- if !f(file) {
- return
- }
- }
- }
-}
-
-// NumFilesByPackage reports the number of registered files in a proto package.
-func (r *Files) NumFilesByPackage(name protoreflect.FullName) int {
- if r == nil {
- return 0
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- p, ok := r.descsByName[name].(*packageDescriptor)
- if !ok {
- return 0
- }
- return len(p.files)
-}
-
-// RangeFilesByPackage iterates over all registered files in a given proto package
-// while f returns true. The iteration order is undefined.
-func (r *Files) RangeFilesByPackage(name protoreflect.FullName, f func(protoreflect.FileDescriptor) bool) {
- if r == nil {
- return
- }
- if r == GlobalFiles {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- p, ok := r.descsByName[name].(*packageDescriptor)
- if !ok {
- return
- }
- for _, file := range p.files {
- if !f(file) {
- return
- }
- }
-}
-
-// rangeTopLevelDescriptors iterates over all top-level descriptors in a file
-// which will be directly entered into the registry.
-func rangeTopLevelDescriptors(fd protoreflect.FileDescriptor, f func(protoreflect.Descriptor)) {
- eds := fd.Enums()
- for i := eds.Len() - 1; i >= 0; i-- {
- f(eds.Get(i))
- vds := eds.Get(i).Values()
- for i := vds.Len() - 1; i >= 0; i-- {
- f(vds.Get(i))
- }
- }
- mds := fd.Messages()
- for i := mds.Len() - 1; i >= 0; i-- {
- f(mds.Get(i))
- }
- xds := fd.Extensions()
- for i := xds.Len() - 1; i >= 0; i-- {
- f(xds.Get(i))
- }
- sds := fd.Services()
- for i := sds.Len() - 1; i >= 0; i-- {
- f(sds.Get(i))
- }
-}
-
-// MessageTypeResolver is an interface for looking up messages.
-//
-// A compliant implementation must deterministically return the same type
-// if no error is encountered.
-//
-// The [Types] type implements this interface.
-type MessageTypeResolver interface {
- // FindMessageByName looks up a message by its full name.
- // E.g., "google.protobuf.Any"
- //
- // This return (nil, NotFound) if not found.
- FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error)
-
- // FindMessageByURL looks up a message by a URL identifier.
- // See documentation on google.protobuf.Any.type_url for the URL format.
- //
- // This returns (nil, NotFound) if not found.
- FindMessageByURL(url string) (protoreflect.MessageType, error)
-}
-
-// ExtensionTypeResolver is an interface for looking up extensions.
-//
-// A compliant implementation must deterministically return the same type
-// if no error is encountered.
-//
-// The [Types] type implements this interface.
-type ExtensionTypeResolver interface {
- // FindExtensionByName looks up a extension field by the field's full name.
- // Note that this is the full name of the field as determined by
- // where the extension is declared and is unrelated to the full name of the
- // message being extended.
- //
- // This returns (nil, NotFound) if not found.
- FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
-
- // FindExtensionByNumber looks up a extension field by the field number
- // within some parent message, identified by full name.
- //
- // This returns (nil, NotFound) if not found.
- FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
-}
-
-var (
- _ MessageTypeResolver = (*Types)(nil)
- _ ExtensionTypeResolver = (*Types)(nil)
-)
-
-// Types is a registry for looking up or iterating over descriptor types.
-// The Find and Range methods are safe for concurrent use.
-type Types struct {
- typesByName typesByName
- extensionsByMessage extensionsByMessage
-
- numEnums int
- numMessages int
- numExtensions int
-}
-
-type (
- typesByName map[protoreflect.FullName]interface{}
- extensionsByMessage map[protoreflect.FullName]extensionsByNumber
- extensionsByNumber map[protoreflect.FieldNumber]protoreflect.ExtensionType
-)
-
-// RegisterMessage registers the provided message type.
-//
-// If a naming conflict occurs, the type is not registered and an error is returned.
-func (r *Types) RegisterMessage(mt protoreflect.MessageType) error {
- // Under rare circumstances getting the descriptor might recursively
- // examine the registry, so fetch it before locking.
- md := mt.Descriptor()
-
- if r == GlobalTypes {
- globalMutex.Lock()
- defer globalMutex.Unlock()
- }
-
- if err := r.register("message", md, mt); err != nil {
- return err
- }
- r.numMessages++
- return nil
-}
-
-// RegisterEnum registers the provided enum type.
-//
-// If a naming conflict occurs, the type is not registered and an error is returned.
-func (r *Types) RegisterEnum(et protoreflect.EnumType) error {
- // Under rare circumstances getting the descriptor might recursively
- // examine the registry, so fetch it before locking.
- ed := et.Descriptor()
-
- if r == GlobalTypes {
- globalMutex.Lock()
- defer globalMutex.Unlock()
- }
-
- if err := r.register("enum", ed, et); err != nil {
- return err
- }
- r.numEnums++
- return nil
-}
-
-// RegisterExtension registers the provided extension type.
-//
-// If a naming conflict occurs, the type is not registered and an error is returned.
-func (r *Types) RegisterExtension(xt protoreflect.ExtensionType) error {
- // Under rare circumstances getting the descriptor might recursively
- // examine the registry, so fetch it before locking.
- //
- // A known case where this can happen: Fetching the TypeDescriptor for a
- // legacy ExtensionDesc can consult the global registry.
- xd := xt.TypeDescriptor()
-
- if r == GlobalTypes {
- globalMutex.Lock()
- defer globalMutex.Unlock()
- }
-
- field := xd.Number()
- message := xd.ContainingMessage().FullName()
- if prev := r.extensionsByMessage[message][field]; prev != nil {
- err := errors.New("extension number %d is already registered on message %v", field, message)
- err = amendErrorWithCaller(err, prev, xt)
- if !(r == GlobalTypes && ignoreConflict(xd, err)) {
- return err
- }
- }
-
- if err := r.register("extension", xd, xt); err != nil {
- return err
- }
- if r.extensionsByMessage == nil {
- r.extensionsByMessage = make(extensionsByMessage)
- }
- if r.extensionsByMessage[message] == nil {
- r.extensionsByMessage[message] = make(extensionsByNumber)
- }
- r.extensionsByMessage[message][field] = xt
- r.numExtensions++
- return nil
-}
-
-func (r *Types) register(kind string, desc protoreflect.Descriptor, typ interface{}) error {
- name := desc.FullName()
- prev := r.typesByName[name]
- if prev != nil {
- err := errors.New("%v %v is already registered", kind, name)
- err = amendErrorWithCaller(err, prev, typ)
- if !(r == GlobalTypes && ignoreConflict(desc, err)) {
- return err
- }
- }
- if r.typesByName == nil {
- r.typesByName = make(typesByName)
- }
- r.typesByName[name] = typ
- return nil
-}
-
-// FindEnumByName looks up an enum by its full name.
-// E.g., "google.protobuf.Field.Kind".
-//
-// This returns (nil, [NotFound]) if not found.
-func (r *Types) FindEnumByName(enum protoreflect.FullName) (protoreflect.EnumType, error) {
- if r == nil {
- return nil, NotFound
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- if v := r.typesByName[enum]; v != nil {
- if et, _ := v.(protoreflect.EnumType); et != nil {
- return et, nil
- }
- return nil, errors.New("found wrong type: got %v, want enum", typeName(v))
- }
- return nil, NotFound
-}
-
-// FindMessageByName looks up a message by its full name,
-// e.g. "google.protobuf.Any".
-//
-// This returns (nil, [NotFound]) if not found.
-func (r *Types) FindMessageByName(message protoreflect.FullName) (protoreflect.MessageType, error) {
- 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.
-// See documentation on google.protobuf.Any.type_url for the URL format.
-//
-// 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
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- message := protoreflect.FullName(url)
- if i := strings.LastIndexByte(url, '/'); i >= 0 {
- message = message[i+len("/"):]
- }
-
- 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
-}
-
-// FindExtensionByName looks up a extension field by the field's full name.
-// Note that this is the full name of the field as determined by
-// where the extension is declared and is unrelated to the full name of the
-// message being extended.
-//
-// This returns (nil, [NotFound]) if not found.
-func (r *Types) FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error) {
- if r == nil {
- return nil, NotFound
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- if v := r.typesByName[field]; v != nil {
- 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
-}
-
-// FindExtensionByNumber looks up a extension field by the field number
-// within some parent message, identified by full name.
-//
-// This returns (nil, [NotFound]) if not found.
-func (r *Types) FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error) {
- if r == nil {
- return nil, NotFound
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- if xt, ok := r.extensionsByMessage[message][field]; ok {
- return xt, nil
- }
- return nil, NotFound
-}
-
-// NumEnums reports the number of registered enums.
-func (r *Types) NumEnums() int {
- if r == nil {
- return 0
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- return r.numEnums
-}
-
-// RangeEnums iterates over all registered enums while f returns true.
-// Iteration order is undefined.
-func (r *Types) RangeEnums(f func(protoreflect.EnumType) bool) {
- if r == nil {
- return
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- for _, typ := range r.typesByName {
- if et, ok := typ.(protoreflect.EnumType); ok {
- if !f(et) {
- return
- }
- }
- }
-}
-
-// NumMessages reports the number of registered messages.
-func (r *Types) NumMessages() int {
- if r == nil {
- return 0
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- return r.numMessages
-}
-
-// RangeMessages iterates over all registered messages while f returns true.
-// Iteration order is undefined.
-func (r *Types) RangeMessages(f func(protoreflect.MessageType) bool) {
- if r == nil {
- return
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- for _, typ := range r.typesByName {
- if mt, ok := typ.(protoreflect.MessageType); ok {
- if !f(mt) {
- return
- }
- }
- }
-}
-
-// NumExtensions reports the number of registered extensions.
-func (r *Types) NumExtensions() int {
- if r == nil {
- return 0
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- return r.numExtensions
-}
-
-// RangeExtensions iterates over all registered extensions while f returns true.
-// Iteration order is undefined.
-func (r *Types) RangeExtensions(f func(protoreflect.ExtensionType) bool) {
- if r == nil {
- return
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- for _, typ := range r.typesByName {
- if xt, ok := typ.(protoreflect.ExtensionType); ok {
- if !f(xt) {
- return
- }
- }
- }
-}
-
-// NumExtensionsByMessage reports the number of registered extensions for
-// a given message type.
-func (r *Types) NumExtensionsByMessage(message protoreflect.FullName) int {
- if r == nil {
- return 0
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- return len(r.extensionsByMessage[message])
-}
-
-// RangeExtensionsByMessage iterates over all registered extensions filtered
-// by a given message type while f returns true. Iteration order is undefined.
-func (r *Types) RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) {
- if r == nil {
- return
- }
- if r == GlobalTypes {
- globalMutex.RLock()
- defer globalMutex.RUnlock()
- }
- for _, xt := range r.extensionsByMessage[message] {
- if !f(xt) {
- return
- }
- }
-}
-
-func typeName(t interface{}) string {
- switch t.(type) {
- case protoreflect.EnumType:
- return "enum"
- case protoreflect.MessageType:
- return "message"
- case protoreflect.ExtensionType:
- return "extension"
- default:
- return fmt.Sprintf("%T", t)
- }
-}
-
-func amendErrorWithCaller(err error, prev, curr interface{}) error {
- prevPkg := goPackage(prev)
- currPkg := goPackage(curr)
- if prevPkg == "" || currPkg == "" || prevPkg == currPkg {
- return err
- }
- return errors.New("%s\n\tpreviously from: %q\n\tcurrently from: %q", err, prevPkg, currPkg)
-}
-
-func goPackage(v interface{}) string {
- switch d := v.(type) {
- case protoreflect.EnumType:
- v = d.Descriptor()
- case protoreflect.MessageType:
- v = d.Descriptor()
- case protoreflect.ExtensionType:
- v = d.TypeDescriptor()
- }
- if d, ok := v.(protoreflect.Descriptor); ok {
- v = d.ParentFile()
- }
- if d, ok := v.(interface{ GoPackagePath() string }); ok {
- return d.GoPackagePath()
- }
- return ""
-}
diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go b/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go
deleted file mode 100644
index c587276..0000000
--- a/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2018 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.
-
-package protoiface
-
-type MessageV1 interface {
- Reset()
- String() string
- ProtoMessage()
-}
-
-type ExtensionRangeV1 struct {
- Start, End int32 // both inclusive
-}
diff --git a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go b/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go
deleted file mode 100644
index 44cf467..0000000
--- a/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go
+++ /dev/null
@@ -1,168 +0,0 @@
-// 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.
-
-// Package protoiface contains types referenced or implemented by messages.
-//
-// WARNING: This package should only be imported by message implementations.
-// The functionality found in this package should be accessed through
-// higher-level abstractions provided by the proto package.
-package protoiface
-
-import (
- "google.golang.org/protobuf/internal/pragma"
- "google.golang.org/protobuf/reflect/protoreflect"
-)
-
-// Methods is a set of optional fast-path implementations of various operations.
-type Methods = struct {
- pragma.NoUnkeyedLiterals
-
- // Flags indicate support for optional features.
- Flags SupportFlags
-
- // Size returns the size in bytes of the wire-format encoding of a message.
- // Marshal must be provided if a custom Size is provided.
- Size func(SizeInput) SizeOutput
-
- // Marshal formats a message in the wire-format encoding to the provided buffer.
- // Size should be provided if a custom Marshal is provided.
- // It must not return an error for a partial message.
- Marshal func(MarshalInput) (MarshalOutput, error)
-
- // Unmarshal parses the wire-format encoding and merges the result into a message.
- // It must not reset the target message or return an error for a partial message.
- Unmarshal func(UnmarshalInput) (UnmarshalOutput, error)
-
- // Merge merges the contents of a source message into a destination message.
- Merge func(MergeInput) MergeOutput
-
- // CheckInitialized returns an error if any required fields in the message are not set.
- CheckInitialized func(CheckInitializedInput) (CheckInitializedOutput, error)
-}
-
-// SupportFlags indicate support for optional features.
-type SupportFlags = uint64
-
-const (
- // SupportMarshalDeterministic reports whether MarshalOptions.Deterministic is supported.
- SupportMarshalDeterministic SupportFlags = 1 << iota
-
- // SupportUnmarshalDiscardUnknown reports whether UnmarshalOptions.DiscardUnknown is supported.
- SupportUnmarshalDiscardUnknown
-)
-
-// SizeInput is input to the Size method.
-type SizeInput = struct {
- pragma.NoUnkeyedLiterals
-
- Message protoreflect.Message
- Flags MarshalInputFlags
-}
-
-// SizeOutput is output from the Size method.
-type SizeOutput = struct {
- pragma.NoUnkeyedLiterals
-
- Size int
-}
-
-// MarshalInput is input to the Marshal method.
-type MarshalInput = struct {
- pragma.NoUnkeyedLiterals
-
- Message protoreflect.Message
- Buf []byte // output is appended to this buffer
- Flags MarshalInputFlags
-}
-
-// MarshalOutput is output from the Marshal method.
-type MarshalOutput = struct {
- pragma.NoUnkeyedLiterals
-
- Buf []byte // contains marshaled message
-}
-
-// MarshalInputFlags configure the marshaler.
-// Most flags correspond to fields in proto.MarshalOptions.
-type MarshalInputFlags = uint8
-
-const (
- MarshalDeterministic MarshalInputFlags = 1 << iota
- MarshalUseCachedSize
-)
-
-// UnmarshalInput is input to the Unmarshal method.
-type UnmarshalInput = struct {
- pragma.NoUnkeyedLiterals
-
- Message protoreflect.Message
- Buf []byte // input buffer
- Flags UnmarshalInputFlags
- Resolver interface {
- FindExtensionByName(field protoreflect.FullName) (protoreflect.ExtensionType, error)
- FindExtensionByNumber(message protoreflect.FullName, field protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- }
- Depth int
-}
-
-// UnmarshalOutput is output from the Unmarshal method.
-type UnmarshalOutput = struct {
- pragma.NoUnkeyedLiterals
-
- Flags UnmarshalOutputFlags
-}
-
-// UnmarshalInputFlags configure the unmarshaler.
-// Most flags correspond to fields in proto.UnmarshalOptions.
-type UnmarshalInputFlags = uint8
-
-const (
- UnmarshalDiscardUnknown UnmarshalInputFlags = 1 << iota
-)
-
-// UnmarshalOutputFlags are output from the Unmarshal method.
-type UnmarshalOutputFlags = uint8
-
-const (
- // UnmarshalInitialized may be set on return if all required fields are known to be set.
- // If unset, then it does not necessarily indicate that the message is uninitialized,
- // only that its status could not be confirmed.
- UnmarshalInitialized UnmarshalOutputFlags = 1 << iota
-)
-
-// MergeInput is input to the Merge method.
-type MergeInput = struct {
- pragma.NoUnkeyedLiterals
-
- Source protoreflect.Message
- Destination protoreflect.Message
-}
-
-// MergeOutput is output from the Merge method.
-type MergeOutput = struct {
- pragma.NoUnkeyedLiterals
-
- Flags MergeOutputFlags
-}
-
-// MergeOutputFlags are output from the Merge method.
-type MergeOutputFlags = uint8
-
-const (
- // MergeComplete reports whether the merge was performed.
- // If unset, the merger must have made no changes to the destination.
- MergeComplete MergeOutputFlags = 1 << iota
-)
-
-// CheckInitializedInput is input to the CheckInitialized method.
-type CheckInitializedInput = struct {
- pragma.NoUnkeyedLiterals
-
- Message protoreflect.Message
-}
-
-// CheckInitializedOutput is output from the CheckInitialized method.
-type CheckInitializedOutput = struct {
- pragma.NoUnkeyedLiterals
-}
diff --git a/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go b/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go
deleted file mode 100644
index 4a1ab7f..0000000
--- a/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2018 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.
-
-// Package protoimpl contains the default implementation for messages
-// generated by protoc-gen-go.
-//
-// WARNING: This package should only ever be imported by generated messages.
-// The compatibility agreement covers nothing except for functionality needed
-// to keep existing generated messages operational. Breakages that occur due
-// to unauthorized usages of this package are not the author's responsibility.
-package protoimpl
-
-import (
- "google.golang.org/protobuf/internal/filedesc"
- "google.golang.org/protobuf/internal/filetype"
- "google.golang.org/protobuf/internal/impl"
-)
-
-// UnsafeEnabled specifies whether package unsafe can be used.
-const UnsafeEnabled = impl.UnsafeEnabled
-
-type (
- // Types used by generated code in init functions.
- DescBuilder = filedesc.Builder
- TypeBuilder = filetype.Builder
-
- // Types used by generated code to implement EnumType, MessageType, and ExtensionType.
- EnumInfo = impl.EnumInfo
- MessageInfo = impl.MessageInfo
- ExtensionInfo = impl.ExtensionInfo
-
- // Types embedded in generated messages.
- MessageState = impl.MessageState
- SizeCache = impl.SizeCache
- WeakFields = impl.WeakFields
- UnknownFields = impl.UnknownFields
- ExtensionFields = impl.ExtensionFields
- ExtensionFieldV1 = impl.ExtensionField
-
- Pointer = impl.Pointer
-)
-
-var X impl.Export
diff --git a/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go b/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go
deleted file mode 100644
index a105cb2..0000000
--- a/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// 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.
-
-package protoimpl
-
-import (
- "google.golang.org/protobuf/internal/version"
-)
-
-const (
- // MaxVersion is the maximum supported version for generated .pb.go files.
- // It is always the current version of the module.
- MaxVersion = version.Minor
-
- // GenVersion is the runtime version required by generated .pb.go files.
- // This is incremented when generated code relies on new functionality
- // in the runtime.
- GenVersion = 20
-
- // MinVersion is the minimum supported version for generated .pb.go files.
- // This is incremented when the runtime drops support for old code.
- MinVersion = 0
-)
-
-// EnforceVersion is used by code generated by protoc-gen-go
-// to statically enforce minimum and maximum versions of this package.
-// A compilation failure implies either that:
-// - the runtime package is too old and needs to be updated OR
-// - the generated code is too old and needs to be regenerated.
-//
-// The runtime package can be upgraded by running:
-//
-// go get google.golang.org/protobuf
-//
-// The generated code can be regenerated by running:
-//
-// protoc --go_out=${PROTOC_GEN_GO_ARGS} ${PROTO_FILES}
-//
-// Example usage by generated code:
-//
-// const (
-// // Verify that this generated code is sufficiently up-to-date.
-// _ = protoimpl.EnforceVersion(genVersion - protoimpl.MinVersion)
-// // Verify that runtime/protoimpl is sufficiently up-to-date.
-// _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - genVersion)
-// )
-//
-// The genVersion is the current minor version used to generated the code.
-// This compile-time check relies on negative integer overflow of a uint
-// being a compilation failure (guaranteed by the Go specification).
-type EnforceVersion uint
-
-// This enforces the following invariant:
-//
-// MinVersion ≤ GenVersion ≤ MaxVersion
-const (
- _ = EnforceVersion(GenVersion - MinVersion)
- _ = EnforceVersion(MaxVersion - GenVersion)
-)
diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
deleted file mode 100644
index 81511a3..0000000
--- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go
+++ /dev/null
@@ -1,383 +0,0 @@
-// Protocol Buffers - Google's data interchange format
-// Copyright 2008 Google Inc. All rights reserved.
-// https://developers.google.com/protocol-buffers/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: google/protobuf/timestamp.proto
-
-// Package timestamppb contains generated types for google/protobuf/timestamp.proto.
-//
-// The Timestamp message represents a timestamp,
-// an instant in time since the Unix epoch (January 1st, 1970).
-//
-// # Conversion to a Go Time
-//
-// The AsTime method can be used to convert a Timestamp message to a
-// standard Go time.Time value in UTC:
-//
-// t := ts.AsTime()
-// ... // make use of t as a time.Time
-//
-// Converting to a time.Time is a common operation so that the extensive
-// set of time-based operations provided by the time package can be leveraged.
-// See https://golang.org/pkg/time for more information.
-//
-// The AsTime method performs the conversion on a best-effort basis. Timestamps
-// with denormal values (e.g., nanoseconds beyond 0 and 99999999, inclusive)
-// are normalized during the conversion to a time.Time. To manually check for
-// invalid Timestamps per the documented limitations in timestamp.proto,
-// additionally call the CheckValid method:
-//
-// if err := ts.CheckValid(); err != nil {
-// ... // handle error
-// }
-//
-// # Conversion from a Go Time
-//
-// The timestamppb.New function can be used to construct a Timestamp message
-// from a standard Go time.Time value:
-//
-// ts := timestamppb.New(t)
-// ... // make use of ts as a *timestamppb.Timestamp
-//
-// In order to construct a Timestamp representing the current time, use Now:
-//
-// ts := timestamppb.Now()
-// ... // make use of ts as a *timestamppb.Timestamp
-package timestamppb
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- reflect "reflect"
- sync "sync"
- time "time"
-)
-
-// A Timestamp represents a point in time independent of any time zone or local
-// calendar, encoded as a count of seconds and fractions of seconds at
-// nanosecond resolution. The count is relative to an epoch at UTC midnight on
-// January 1, 1970, in the proleptic Gregorian calendar which extends the
-// Gregorian calendar backwards to year one.
-//
-// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
-// second table is needed for interpretation, using a [24-hour linear
-// smear](https://developers.google.com/time/smear).
-//
-// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
-// restricting to that range, we ensure that we can convert to and from [RFC
-// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
-//
-// # Examples
-//
-// Example 1: Compute Timestamp from POSIX `time()`.
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(time(NULL));
-// timestamp.set_nanos(0);
-//
-// Example 2: Compute Timestamp from POSIX `gettimeofday()`.
-//
-// struct timeval tv;
-// gettimeofday(&tv, NULL);
-//
-// Timestamp timestamp;
-// timestamp.set_seconds(tv.tv_sec);
-// timestamp.set_nanos(tv.tv_usec * 1000);
-//
-// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
-//
-// FILETIME ft;
-// GetSystemTimeAsFileTime(&ft);
-// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-//
-// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
-// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
-// Timestamp timestamp;
-// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
-// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
-//
-// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
-//
-// long millis = System.currentTimeMillis();
-//
-// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
-// .setNanos((int) ((millis % 1000) * 1000000)).build();
-//
-// Example 5: Compute Timestamp from Java `Instant.now()`.
-//
-// Instant now = Instant.now();
-//
-// Timestamp timestamp =
-// Timestamp.newBuilder().setSeconds(now.getEpochSecond())
-// .setNanos(now.getNano()).build();
-//
-// Example 6: Compute Timestamp from current time in Python.
-//
-// timestamp = Timestamp()
-// timestamp.GetCurrentTime()
-//
-// # JSON Mapping
-//
-// In JSON format, the Timestamp type is encoded as a string in the
-// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
-// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
-// where {year} is always expressed using four digits while {month}, {day},
-// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
-// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
-// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
-// is required. A proto3 JSON serializer should always use UTC (as indicated by
-// "Z") when printing the Timestamp type and a proto3 JSON parser should be
-// able to accept both UTC and other timezones (as indicated by an offset).
-//
-// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
-// 01:30 UTC on January 15, 2017.
-//
-// In JavaScript, one can convert a Date object to this format using the
-// standard
-// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
-// method. In Python, a standard `datetime.datetime` object can be converted
-// to this format using
-// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
-// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
-// the Joda Time's [`ISODateTimeFormat.dateTime()`](
-// http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
-// ) to obtain a formatter capable of generating timestamps in this format.
-type Timestamp struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- // Represents seconds of UTC time since Unix epoch
- // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
- // 9999-12-31T23:59:59Z inclusive.
- Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
- // Non-negative fractions of a second at nanosecond resolution. Negative
- // second values with fractions must still have non-negative nanos values
- // that count forward in time. Must be from 0 to 999,999,999
- // inclusive.
- Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
-}
-
-// Now constructs a new Timestamp from the current time.
-func Now() *Timestamp {
- return New(time.Now())
-}
-
-// New constructs a new Timestamp from the provided time.Time.
-func New(t time.Time) *Timestamp {
- return &Timestamp{Seconds: int64(t.Unix()), Nanos: int32(t.Nanosecond())}
-}
-
-// AsTime converts x to a time.Time.
-func (x *Timestamp) AsTime() time.Time {
- return time.Unix(int64(x.GetSeconds()), int64(x.GetNanos())).UTC()
-}
-
-// IsValid reports whether the timestamp is valid.
-// It is equivalent to CheckValid == nil.
-func (x *Timestamp) IsValid() bool {
- return x.check() == 0
-}
-
-// CheckValid returns an error if the timestamp is invalid.
-// In particular, it checks whether the value represents a date that is
-// in the range of 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
-// An error is reported for a nil Timestamp.
-func (x *Timestamp) CheckValid() error {
- switch x.check() {
- case invalidNil:
- return protoimpl.X.NewError("invalid nil Timestamp")
- case invalidUnderflow:
- return protoimpl.X.NewError("timestamp (%v) before 0001-01-01", x)
- case invalidOverflow:
- return protoimpl.X.NewError("timestamp (%v) after 9999-12-31", x)
- case invalidNanos:
- return protoimpl.X.NewError("timestamp (%v) has out-of-range nanos", x)
- default:
- return nil
- }
-}
-
-const (
- _ = iota
- invalidNil
- invalidUnderflow
- invalidOverflow
- invalidNanos
-)
-
-func (x *Timestamp) check() uint {
- const minTimestamp = -62135596800 // Seconds between 1970-01-01T00:00:00Z and 0001-01-01T00:00:00Z, inclusive
- const maxTimestamp = +253402300799 // Seconds between 1970-01-01T00:00:00Z and 9999-12-31T23:59:59Z, inclusive
- secs := x.GetSeconds()
- nanos := x.GetNanos()
- switch {
- case x == nil:
- return invalidNil
- case secs < minTimestamp:
- return invalidUnderflow
- case secs > maxTimestamp:
- return invalidOverflow
- case nanos < 0 || nanos >= 1e9:
- return invalidNanos
- default:
- return 0
- }
-}
-
-func (x *Timestamp) Reset() {
- *x = Timestamp{}
- if protoimpl.UnsafeEnabled {
- mi := &file_google_protobuf_timestamp_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Timestamp) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Timestamp) ProtoMessage() {}
-
-func (x *Timestamp) ProtoReflect() protoreflect.Message {
- mi := &file_google_protobuf_timestamp_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Timestamp.ProtoReflect.Descriptor instead.
-func (*Timestamp) Descriptor() ([]byte, []int) {
- return file_google_protobuf_timestamp_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Timestamp) GetSeconds() int64 {
- if x != nil {
- return x.Seconds
- }
- return 0
-}
-
-func (x *Timestamp) GetNanos() int32 {
- if x != nil {
- return x.Nanos
- }
- return 0
-}
-
-var File_google_protobuf_timestamp_proto protoreflect.FileDescriptor
-
-var file_google_protobuf_timestamp_proto_rawDesc = []byte{
- 0x0a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x12, 0x0f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
- 0x75, 0x66, 0x22, 0x3b, 0x0a, 0x09, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12,
- 0x18, 0x0a, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
- 0x52, 0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6e,
- 0x6f, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x42,
- 0x85, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
- 0x6d, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b, 0x6e, 0x6f, 0x77,
- 0x6e, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x70, 0x62, 0xf8, 0x01, 0x01,
- 0xa2, 0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
- 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f,
- 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_google_protobuf_timestamp_proto_rawDescOnce sync.Once
- file_google_protobuf_timestamp_proto_rawDescData = file_google_protobuf_timestamp_proto_rawDesc
-)
-
-func file_google_protobuf_timestamp_proto_rawDescGZIP() []byte {
- file_google_protobuf_timestamp_proto_rawDescOnce.Do(func() {
- file_google_protobuf_timestamp_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_timestamp_proto_rawDescData)
- })
- return file_google_protobuf_timestamp_proto_rawDescData
-}
-
-var file_google_protobuf_timestamp_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_google_protobuf_timestamp_proto_goTypes = []interface{}{
- (*Timestamp)(nil), // 0: google.protobuf.Timestamp
-}
-var file_google_protobuf_timestamp_proto_depIdxs = []int32{
- 0, // [0:0] is the sub-list for method output_type
- 0, // [0:0] is the sub-list for method input_type
- 0, // [0:0] is the sub-list for extension type_name
- 0, // [0:0] is the sub-list for extension extendee
- 0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_google_protobuf_timestamp_proto_init() }
-func file_google_protobuf_timestamp_proto_init() {
- if File_google_protobuf_timestamp_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_google_protobuf_timestamp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Timestamp); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_google_protobuf_timestamp_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 1,
- NumExtensions: 0,
- NumServices: 0,
- },
- GoTypes: file_google_protobuf_timestamp_proto_goTypes,
- DependencyIndexes: file_google_protobuf_timestamp_proto_depIdxs,
- MessageInfos: file_google_protobuf_timestamp_proto_msgTypes,
- }.Build()
- File_google_protobuf_timestamp_proto = out.File
- file_google_protobuf_timestamp_proto_rawDesc = nil
- file_google_protobuf_timestamp_proto_goTypes = nil
- file_google_protobuf_timestamp_proto_depIdxs = nil
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index a7b12b7..0e01bf8 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -4,12 +4,6 @@ github.com/alecthomas/kingpin/v2
# github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9
## explicit; go 1.15
github.com/alecthomas/units
-# github.com/beorn7/perks v1.0.1
-## explicit; go 1.11
-github.com/beorn7/perks/quantile
-# github.com/cespare/xxhash/v2 v2.2.0
-## explicit; go 1.11
-github.com/cespare/xxhash/v2
# github.com/fsnotify/fsnotify v1.7.0
## explicit; go 1.17
github.com/fsnotify/fsnotify
@@ -55,8 +49,8 @@ github.com/gravitational/trace/internal
# github.com/jonboulle/clockwork v0.4.0
## explicit; go 1.15
github.com/jonboulle/clockwork
-# github.com/kr/text v0.2.0
-## explicit
+# github.com/kr/pretty v0.3.1
+## explicit; go 1.12
# github.com/mailgun/multibuf v0.2.0
## explicit; go 1.17
github.com/mailgun/multibuf
@@ -109,24 +103,9 @@ github.com/onsi/gomega/matchers/support/goraph/edge
github.com/onsi/gomega/matchers/support/goraph/node
github.com/onsi/gomega/matchers/support/goraph/util
github.com/onsi/gomega/types
-# github.com/prometheus/client_golang v1.19.0
-## explicit; go 1.20
-github.com/prometheus/client_golang/prometheus
-github.com/prometheus/client_golang/prometheus/internal
-# github.com/prometheus/client_model v0.6.0
-## explicit; go 1.19
-github.com/prometheus/client_model/go
-# github.com/prometheus/common v0.49.0
+# github.com/prometheus/common v0.50.0
## explicit; go 1.21
-github.com/prometheus/common/expfmt
-github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
-github.com/prometheus/common/model
github.com/prometheus/common/version
-# github.com/prometheus/procfs v0.12.0
-## explicit; go 1.19
-github.com/prometheus/procfs
-github.com/prometheus/procfs/internal/fs
-github.com/prometheus/procfs/internal/util
# github.com/sirupsen/logrus v1.9.3
## explicit; go 1.13
github.com/sirupsen/logrus
@@ -143,10 +122,10 @@ github.com/vulcand/predicate
# github.com/xhit/go-str2duration/v2 v2.1.0
## explicit; go 1.13
github.com/xhit/go-str2duration/v2
-# golang.org/x/crypto v0.19.0
+# golang.org/x/crypto v0.21.0
## explicit; go 1.18
golang.org/x/crypto/ssh/terminal
-# golang.org/x/net v0.21.0
+# golang.org/x/net v0.22.0
## explicit; go 1.18
golang.org/x/net/context
golang.org/x/net/html
@@ -154,12 +133,12 @@ golang.org/x/net/html/atom
golang.org/x/net/html/charset
golang.org/x/net/internal/socks
golang.org/x/net/proxy
-# golang.org/x/sys v0.17.0
+# golang.org/x/sys v0.18.0
## explicit; go 1.18
golang.org/x/sys/plan9
golang.org/x/sys/unix
golang.org/x/sys/windows
-# golang.org/x/term v0.17.0
+# golang.org/x/term v0.18.0
## explicit; go 1.18
golang.org/x/term
# golang.org/x/text v0.14.0
@@ -187,35 +166,6 @@ golang.org/x/text/unicode/norm
# golang.org/x/tools v0.16.1
## explicit; go 1.18
golang.org/x/tools/go/ast/inspector
-# google.golang.org/protobuf v1.32.0
-## explicit; go 1.17
-google.golang.org/protobuf/encoding/protodelim
-google.golang.org/protobuf/encoding/prototext
-google.golang.org/protobuf/encoding/protowire
-google.golang.org/protobuf/internal/descfmt
-google.golang.org/protobuf/internal/descopts
-google.golang.org/protobuf/internal/detrand
-google.golang.org/protobuf/internal/encoding/defval
-google.golang.org/protobuf/internal/encoding/messageset
-google.golang.org/protobuf/internal/encoding/tag
-google.golang.org/protobuf/internal/encoding/text
-google.golang.org/protobuf/internal/errors
-google.golang.org/protobuf/internal/filedesc
-google.golang.org/protobuf/internal/filetype
-google.golang.org/protobuf/internal/flags
-google.golang.org/protobuf/internal/genid
-google.golang.org/protobuf/internal/impl
-google.golang.org/protobuf/internal/order
-google.golang.org/protobuf/internal/pragma
-google.golang.org/protobuf/internal/set
-google.golang.org/protobuf/internal/strs
-google.golang.org/protobuf/internal/version
-google.golang.org/protobuf/proto
-google.golang.org/protobuf/reflect/protoreflect
-google.golang.org/protobuf/reflect/protoregistry
-google.golang.org/protobuf/runtime/protoiface
-google.golang.org/protobuf/runtime/protoimpl
-google.golang.org/protobuf/types/known/timestamppb
# gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
## explicit
gopkg.in/tomb.v1